Implement svcUnmapProcessMemory

This commit is contained in:
Michael Scire 2018-04-24 05:42:19 -06:00
parent 8b57aa3092
commit 35ac78053b
2 changed files with 19 additions and 1 deletions

View File

@ -720,7 +720,7 @@ Result svcSetProcessMemoryPermission(Handle proc, u64 addr, u64 size, u32 perm);
* @brief Maps the src address from the supplied process handle into the current process. * @brief Maps the src address from the supplied process handle into the current process.
* @param[in] dst Address to which map the memory in the current process. * @param[in] dst Address to which map the memory in the current process.
* @param[in] proc Process handle. * @param[in] proc Process handle.
* @param[in] src Address of the memory in the process. * @param[in] src Source mapping address.
* @param[in] size Size of the memory. * @param[in] size Size of the memory.
* @return Result code. * @return Result code.
* @remark This allows mapping code and rodata with RW- permission. * @remark This allows mapping code and rodata with RW- permission.
@ -729,6 +729,19 @@ Result svcSetProcessMemoryPermission(Handle proc, u64 addr, u64 size, u32 perm);
*/ */
Result svcMapProcessMemory(void* dst, Handle proc, u64 src, u64 size); Result svcMapProcessMemory(void* dst, Handle proc, u64 src, u64 size);
/**
* @brief Undoes the effects of \ref svcMapProcessMemory.
* @param[in] dst Destination mapping address
* @param[in] proc Process handle.
* @param[in] src Address of the memory in the process.
* @param[in] size Size of the memory.
* @return Result code.
* @remark This allows mapping code and rodata with RW- permission.
* @note Syscall number 0x75.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcUnmapProcessMemory(void* dst, Handle proc, u64 src, u64 size);
/** /**
* @brief Maps normal heap in a certain process as executable code (used when loading NROs). * @brief Maps normal heap in a certain process as executable code (used when loading NROs).
* @param[in] proc Process handle (cannot be \ref CUR_PROCESS_HANDLE). * @param[in] proc Process handle (cannot be \ref CUR_PROCESS_HANDLE).

View File

@ -382,6 +382,11 @@ SVC_BEGIN svcMapProcessMemory
ret ret
SVC_END SVC_END
SVC_BEGIN svcUnmapProcessMemory
svc 0x75
ret
SVC_END
SVC_BEGIN svcMapProcessCodeMemory SVC_BEGIN svcMapProcessCodeMemory
svc 0x77 svc 0x77
ret ret