Implement svcMap/UnmapPhysicalMemory(Unsafe), svcSetUnsafeLimit

This commit is contained in:
Michael Scire 2018-05-07 03:40:01 -06:00 committed by fincs
parent 8496264811
commit ef47389228
2 changed files with 74 additions and 0 deletions

View File

@ -500,6 +500,25 @@ Result svcGetInfo(u64* out, u64 id0, Handle handle, u64 id1);
///@}
///@name Memory management
///@{
/**
* @brief Maps new heap memory at the desired address. [3.0.0+]
* @return Result code.
* @note Syscall number 0x2A.
*/
Result svcMapPhysicalMemory(void *address, u64 size);
/**
* @brief Undoes the effects of \ref svcMapPhysicalMemory. [3.0.0+]
* @return Result code.
* @note Syscall number 0x2B.
*/
Result svcUnmapPhysicalMemory(void *address, u64 size);
///@}
///@name Process and thread management
///@{
@ -581,6 +600,36 @@ Result svcCreateEvent(Handle* server_handle, Handle* client_handle);
///@}
///@name Memory management
///@{
/**
* @brief Maps unsafe memory (usable for GPU DMA) for a system module at the desired address. [5.0.0+]
* @return Result code.
* @note Syscall number 0x48.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcMapPhysicalMemoryUnsafe(void *address, u64 size);
/**
* @brief Undoes the effects of \ref svcMapPhysicalMemoryUnsafe. [5.0.0+]
* @return Result code.
* @note Syscall number 0x49.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcUnmapPhysicalMemoryUnsafe(void *address, u64 size);
/**
* @brief Sets the system-wide limit for unsafe memory mappable using \ref svcMapPhysicalMemoryUnsafe. [5.0.0+]
* @return Result code.
* @note Syscall number 0x4A.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcSetUnsafeLimit(u64 size);
///@}
///@name Just-in-time (JIT) compilation support
///@{

View File

@ -229,6 +229,16 @@ SVC_BEGIN svcGetInfo
ret
SVC_END
SVC_BEGIN svcMapPhysicalMemory
svc 0x2A
ret
SVC_END
SVC_BEGIN svcUnmapPhysicalMemory
svc 0x2B
ret
SVC_END
SVC_BEGIN svcGetResourceLimitLimitValue
str x0, [sp, #-16]!
svc 0x30
@ -292,6 +302,21 @@ SVC_BEGIN svcCreateEvent
ret
SVC_END
SVC_BEGIN svcMapPhysicalMemoryUnsafe
svc 0x48
ret
SVC_END
SVC_BEGIN svcUnmapPhysicalMemoryUnsafe
svc 0x49
ret
SVC_END
SVC_BEGIN svcSetUnsafeLimit
svc 0x4A
ret
SVC_END
SVC_BEGIN svcCreateJitMemory
str x0, [sp, #-16]!
svc 0x4B