From 778d5fc4fb306f59a430c7ebfea0beaa4d159a53 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 9 Sep 2017 12:10:45 -0400 Subject: [PATCH 1/2] Added proper svcQueryIoMapping. --- nx/include/switch/svc.h | 1 + nx/source/svc.s | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/nx/include/switch/svc.h b/nx/include/switch/svc.h index 5c110975..87571c58 100644 --- a/nx/include/switch/svc.h +++ b/nx/include/switch/svc.h @@ -24,5 +24,6 @@ Result svcConnectToNamedPort(Handle* session, const char* name); Result svcBreak(u32 BreakReason, u64 inval1, u64 inval2); Result svcAcceptSession(Handle *session_handle, Handle port_handle); Result svcReplyAndReceive(s32* index, const Handle* handles, s32 handleCount, Handle replyTarget, u64 timeout); +Result svcQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size); Result svcManageNamedPort(Handle* portServer, const char* name, s32 maxSessions); diff --git a/nx/source/svc.s b/nx/source/svc.s index 784953bf..372723df 100644 --- a/nx/source/svc.s +++ b/nx/source/svc.s @@ -53,6 +53,14 @@ SVC_BEGIN svcReplyAndReceive ret SVC_END +SVC_BEGIN svcQueryIoMapping + str x0, [sp, #-16]! + svc 0x55 + ldr x2, [sp], #16 + str x1, [x2] + ret +SVC_END + SVC_BEGIN svcManageNamedPort str x0, [sp, #-16]! svc 0x71 From 59290a5b87fda5d77a45053b2d55d79ca5e33331 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 9 Sep 2017 16:27:55 -0400 Subject: [PATCH 2/2] Added svcQueryPhysicalAddress. --- nx/include/switch/svc.h | 1 + nx/source/svc.s | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/nx/include/switch/svc.h b/nx/include/switch/svc.h index 1530ecf3..8900f2e0 100644 --- a/nx/include/switch/svc.h +++ b/nx/include/switch/svc.h @@ -25,5 +25,6 @@ Result svcSendSyncRequest(Handle session); Result svcBreak(u32 BreakReason, u64 inval1, u64 inval2); Result svcAcceptSession(Handle *session_handle, Handle port_handle); Result svcReplyAndReceive(s32* index, const Handle* handles, s32 handleCount, Handle replyTarget, u64 timeout); +Result svcQueryPhysicalAddress(u64* out, u64 virtaddr);//3 output u64s are written to out. Result svcQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size); Result svcManageNamedPort(Handle* portServer, const char* name, s32 maxSessions); diff --git a/nx/source/svc.s b/nx/source/svc.s index 1b97149f..75cc03f0 100644 --- a/nx/source/svc.s +++ b/nx/source/svc.s @@ -58,6 +58,16 @@ SVC_BEGIN svcReplyAndReceive ret SVC_END +SVC_BEGIN svcQueryPhysicalAddress + str x0, [sp, #-16]! + svc 0x54 + ldr x2, [sp], #16 + str x1, [x2] + str x2, [x2, #8] + str x3, [x2, #16] + ret +SVC_END + SVC_BEGIN svcQueryIoMapping str x0, [sp, #-16]! svc 0x55