From cb7c1f87a8350ba9c43def0e1c820cfcbd34bca4 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 14 Apr 2020 08:49:06 -0700 Subject: [PATCH] svc: QueryIoMapping ABI change in 10.x --- nx/include/switch/kernel/svc.h | 12 +++++++++++- nx/source/kernel/svc.s | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/nx/include/switch/kernel/svc.h b/nx/include/switch/kernel/svc.h index 74b078aa..e7eb85e6 100644 --- a/nx/include/switch/kernel/svc.h +++ b/nx/include/switch/kernel/svc.h @@ -1034,8 +1034,18 @@ Result svcQueryPhysicalAddress(PhysicalMemoryInfo *out, u64 virtaddr); * @return Result code. * @note Syscall number 0x55. * @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available. + * @warning Only exists on [10.0.0+]. For older versions use \ref svcLegacyQueryIoMapping. */ -Result svcQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size); +Result svcQueryIoMapping(u64* virtaddr, u64* size, u64 physaddr); + +/** + * @brief Returns a virtual address mapped to a given IO range. + * @return Result code. + * @note Syscall number 0x55. + * @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available. + * @warning Only exists on [1.0.0-9.2.0]. For newer versions use \ref svcQueryIoMapping. + */ +Result svcLegacyQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size); ///@} diff --git a/nx/source/kernel/svc.s b/nx/source/kernel/svc.s index 7d76dd94..20003405 100644 --- a/nx/source/kernel/svc.s +++ b/nx/source/kernel/svc.s @@ -481,6 +481,15 @@ SVC_BEGIN svcQueryPhysicalAddress SVC_END SVC_BEGIN svcQueryIoMapping + stp x0, x1, [sp, #-16]! + svc 0x55 + ldp x3, x4, [sp], #16 + str x1, [x3] + str x2, [x4] + ret +SVC_END + +SVC_BEGIN svcLegacyQueryIoMapping str x0, [sp, #-16]! svc 0x55 ldr x2, [sp], #16