svc: add MapInsecureMemory/UnmapInsecureMemory

This commit is contained in:
Michael Scire 2022-10-11 20:18:30 -07:00
parent 328d041c5c
commit 1543e84627
2 changed files with 31 additions and 0 deletions

View File

@ -40,6 +40,8 @@ typedef enum {
MemType_KernelStack=0x13, ///< Mapped in kernel during \ref svcCreateThread.
MemType_CodeReadOnly=0x14, ///< Mapped in kernel during \ref svcControlCodeMemory.
MemType_CodeWritable=0x15, ///< Mapped in kernel during \ref svcControlCodeMemory.
MemType_Coverage=0x16, ///< Not available.
MemType_Insecure=0x17, ///< Mapped in kernel during \ref svcMapInsecureMemory.
} MemoryType;
/// Memory state bitmasks.
@ -1568,3 +1570,22 @@ Result svcSetResourceLimitLimitValue(Handle reslimit, LimitableResource which, u
void svcCallSecureMonitor(SecmonArgs* regs);
///@}
///@name Memory management
///@{
/**
* @brief Maps new insecure memory at the desired address. [15.0.0+]
* @return Result code.
* @note Syscall number 0x90.
*/
Result svcMapInsecureMemory(void *address, u64 size);
/**
* @brief Undoes the effects of \ref svcMapInsecureMemory. [15.0.0+]
* @return Result code.
* @note Syscall number 0x91.
*/
Result svcUnmapInsecureMemory(void *address, u64 size);
///@}

View File

@ -798,3 +798,13 @@ SVC_BEGIN svcCallSecureMonitor
stp x6, x7, [x8, #0x30]
ret
SVC_END
SVC_BEGIN svcMapInsecureMemory
svc 0x90
ret
SVC_END
SVC_BEGIN svcUnmapInsecureMemory
svc 0x91
ret
SVC_END