Merge branch 'master' of github.com:switchbrew/libnx

This commit is contained in:
yellows8 2018-04-25 12:49:10 -04:00
commit c2b4f586f2
2 changed files with 78 additions and 1 deletions

View File

@ -671,9 +671,35 @@ Result svcWriteDebugProcessMemory(Handle debug, void* buffer, u64 addr, u64 size
///@} ///@}
///@name Miscellaneous
///@{
/**
* @brief Retrieves privileged information about the system, or a certain kernel object.
* @param[out] out Variable to which store the information.
* @param[in] id0 First ID of the property to retrieve.
* @param[in] handle Handle of the object to retrieve information from, or \ref INVALID_HANDLE to retrieve information about the system.
* @param[in] id1 Second ID of the property to retrieve.
* @return Result code.
* @remark The full list of property IDs can be found on the <a href="http://switchbrew.org/index.php?title=SVC#svcGetSystemInfo">switchbrew.org wiki</a>.
* @note Syscall number 0x6F.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcGetSystemInfo(u64* out, u64 id0, Handle handle, u64 id1);
///@}
///@name Inter-process communication (IPC) ///@name Inter-process communication (IPC)
///@{ ///@{
/**
* @brief Creates a port.
* @return Result code.
* @note Syscall number 0x70.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcCreatePort(Handle* portServer, Handle *portClient, s32 max_sessions, bool is_light, const char* name);
/** /**
* @brief Manages a named port. * @brief Manages a named port.
* @return Result code. * @return Result code.
@ -682,6 +708,14 @@ Result svcWriteDebugProcessMemory(Handle debug, void* buffer, u64 addr, u64 size
*/ */
Result svcManageNamedPort(Handle* portServer, const char* name, s32 maxSessions); Result svcManageNamedPort(Handle* portServer, const char* name, s32 maxSessions);
/**
* @brief Manages a named port.
* @return Result code.
* @note Syscall number 0x72.
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
*/
Result svcConnectToPort(Handle* session, Handle port);
///@} ///@}
///@name Memory management ///@name Memory management
@ -704,7 +738,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.
@ -713,6 +747,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

@ -345,6 +345,23 @@ SVC_BEGIN svcWriteDebugProcessMemory
ret ret
SVC_END SVC_END
SVC_BEGIN svcGetSystemInfo
str x0, [sp, #-16]!
svc 0x6F
ldr x2, [sp], #16
str x1, [x2]
ret
SVC_END
SVC_BEGIN svcCreatePort
stp x0, x1, [sp, #-16]!
svc 0x70
ldp x3, x4, [sp], #16
str w1, [x3]
str w2, [x4]
ret
SVC_END
SVC_BEGIN svcManageNamedPort SVC_BEGIN svcManageNamedPort
str x0, [sp, #-16]! str x0, [sp, #-16]!
svc 0x71 svc 0x71
@ -353,6 +370,14 @@ SVC_BEGIN svcManageNamedPort
ret ret
SVC_END SVC_END
SVC_BEGIN svcConnectToPort
str x0, [sp, #-16]!
svc 0x72
ldr x2, [sp], #16
str w1, [x2]
ret
SVC_END
SVC_BEGIN svcSetProcessMemoryPermission SVC_BEGIN svcSetProcessMemoryPermission
svc 0x73 svc 0x73
ret ret
@ -363,6 +388,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