mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 04:52:39 +02:00
Sync jit SVC names with wiki + updated the comment for JitType_JitMemory in jit.h.
This commit is contained in:
parent
93957370a9
commit
a12eb11eab
@ -10,7 +10,7 @@
|
|||||||
/// JIT implementation type.
|
/// JIT implementation type.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JitType_CodeMemory, ///< JIT supported using svcSetProcessMemoryPermission
|
JitType_CodeMemory, ///< JIT supported using svcSetProcessMemoryPermission
|
||||||
JitType_JitMemory, ///< JIT supported using 4.0.0+ JIT syscalls.
|
JitType_JitMemory, ///< JIT supported using 4.0.0+ code-memory syscalls (this isn't usable on 5.0.0+ so JitType_CodeMemory is used instead).
|
||||||
} JitType;
|
} JitType;
|
||||||
|
|
||||||
/// JIT buffer object.
|
/// JIT buffer object.
|
||||||
|
@ -34,8 +34,8 @@ typedef enum {
|
|||||||
MemType_IpcBuffer1=0x11, ///< IPC buffers with descriptor flags=1.
|
MemType_IpcBuffer1=0x11, ///< IPC buffers with descriptor flags=1.
|
||||||
MemType_IpcBuffer3=0x12, ///< IPC buffers with descriptor flags=3.
|
MemType_IpcBuffer3=0x12, ///< IPC buffers with descriptor flags=3.
|
||||||
MemType_KernelStack=0x13, ///< Mapped in kernel during \ref svcCreateThread.
|
MemType_KernelStack=0x13, ///< Mapped in kernel during \ref svcCreateThread.
|
||||||
MemType_JitReadOnly=0x14, ///< Mapped in kernel during \ref svcMapJitMemory.
|
MemType_CodeReadOnly=0x14, ///< Mapped in kernel during \ref svcControlCodeMemory.
|
||||||
MemType_JitWritable=0x15, ///< Mapped in kernel during \ref svcMapJitMemory.
|
MemType_CodeWritable=0x15, ///< Mapped in kernel during \ref svcControlCodeMemory.
|
||||||
} MemoryType;
|
} MemoryType;
|
||||||
|
|
||||||
/// Memory state bitmasks.
|
/// Memory state bitmasks.
|
||||||
@ -58,7 +58,7 @@ typedef enum {
|
|||||||
MemState_IsRefCounted=MemState_IsPoolAllocated, ///< Alias for \ref MemState_IsPoolAllocated.
|
MemState_IsRefCounted=MemState_IsPoolAllocated, ///< Alias for \ref MemState_IsPoolAllocated.
|
||||||
MemState_MapProcessAllowed=BIT(23), ///< Map process allowed.
|
MemState_MapProcessAllowed=BIT(23), ///< Map process allowed.
|
||||||
MemState_AttrChangeAllowed=BIT(24), ///< Attribute change allowed.
|
MemState_AttrChangeAllowed=BIT(24), ///< Attribute change allowed.
|
||||||
MemState_JitMemAllowed=BIT(25), ///< JIT memory allowed.
|
MemState_CodeMemAllowed=BIT(25), ///< Code memory allowed.
|
||||||
} MemoryState;
|
} MemoryState;
|
||||||
|
|
||||||
/// Memory attribute bitmasks.
|
/// Memory attribute bitmasks.
|
||||||
@ -97,13 +97,13 @@ typedef struct {
|
|||||||
u64 X[8]; ///< Values of X0 through X7.
|
u64 X[8]; ///< Values of X0 through X7.
|
||||||
} PACKED SecmonArgs;
|
} PACKED SecmonArgs;
|
||||||
|
|
||||||
/// JIT mapping operations
|
/// Code memory mapping operations
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JitMapOperation_MapOwner=0, ///< Map owner.
|
CodeMapOperation_MapOwner=0, ///< Map owner.
|
||||||
JitMapOperation_MapSlave=1, ///< Map slave.
|
CodeMapOperation_MapSlave=1, ///< Map slave.
|
||||||
JitMapOperation_UnmapOwner=2, ///< Unmap owner.
|
CodeMapOperation_UnmapOwner=2, ///< Unmap owner.
|
||||||
JitMapOperation_UnmapSlave=3, ///< Unmap slave.
|
CodeMapOperation_UnmapSlave=3, ///< Unmap slave.
|
||||||
} JitMapOperation;
|
} CodeMapOperation;
|
||||||
|
|
||||||
/// Limitable Resources.
|
/// Limitable Resources.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -630,24 +630,24 @@ Result svcSetUnsafeLimit(u64 size);
|
|||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
|
||||||
///@name Just-in-time (JIT) compilation support
|
///@name Code memory / Just-in-time (JIT) compilation support
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates JIT memory in the caller's address space [4.0.0+].
|
* @brief Creates code memory in the caller's address space [4.0.0+].
|
||||||
* @return Result code.
|
* @return Result code.
|
||||||
* @note Syscall number 0x4B.
|
* @note Syscall number 0x4B.
|
||||||
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
||||||
*/
|
*/
|
||||||
Result svcCreateJitMemory(Handle* jit_handle, void* src_addr, u64 size);
|
Result svcCreateCodeMemory(Handle* code_handle, void* src_addr, u64 size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maps JIT memory in the caller's address space [4.0.0+].
|
* @brief Maps code memory in the caller's address space [4.0.0+].
|
||||||
* @return Result code.
|
* @return Result code.
|
||||||
* @note Syscall number 0x4C.
|
* @note Syscall number 0x4C.
|
||||||
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
||||||
*/
|
*/
|
||||||
Result svcMapJitMemory(Handle jit_handle, JitMapOperation op, void* dst_addr, u64 size, u64 perm);
|
Result svcControlCodeMemory(Handle code_handle, CodeMapOperation op, void* dst_addr, u64 size, u64 perm);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
@ -52,16 +52,16 @@ Result jitCreate(Jit* j, size_t size)
|
|||||||
case JitType_JitMemory:
|
case JitType_JitMemory:
|
||||||
j->rw_addr = virtmemReserve(j->size);
|
j->rw_addr = virtmemReserve(j->size);
|
||||||
|
|
||||||
rc = svcCreateJitMemory(&j->handle, j->src_addr, j->size);
|
rc = svcCreateCodeMemory(&j->handle, j->src_addr, j->size);
|
||||||
if (R_SUCCEEDED(rc))
|
if (R_SUCCEEDED(rc))
|
||||||
{
|
{
|
||||||
rc = svcMapJitMemory(j->handle, JitMapOperation_MapOwner, j->rw_addr, j->size, Perm_Rw);
|
rc = svcControlCodeMemory(j->handle, CodeMapOperation_MapOwner, j->rw_addr, j->size, Perm_Rw);
|
||||||
if (R_SUCCEEDED(rc))
|
if (R_SUCCEEDED(rc))
|
||||||
{
|
{
|
||||||
rc = svcMapJitMemory(j->handle, JitMapOperation_MapSlave, j->rx_addr, j->size, Perm_Rx);
|
rc = svcControlCodeMemory(j->handle, CodeMapOperation_MapSlave, j->rx_addr, j->size, Perm_Rx);
|
||||||
|
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
svcMapJitMemory(j->handle, JitMapOperation_UnmapOwner, j->rw_addr, j->size, 0);
|
svcControlCodeMemory(j->handle, CodeMapOperation_UnmapOwner, j->rw_addr, j->size, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,12 +146,12 @@ Result jitClose(Jit* j)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case JitType_JitMemory:
|
case JitType_JitMemory:
|
||||||
rc = svcMapJitMemory(j->handle, JitMapOperation_UnmapOwner, j->rw_addr, j->size, 0);
|
rc = svcControlCodeMemory(j->handle, CodeMapOperation_UnmapOwner, j->rw_addr, j->size, 0);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
virtmemFree(j->rw_addr, j->size);
|
virtmemFree(j->rw_addr, j->size);
|
||||||
|
|
||||||
rc = svcMapJitMemory(j->handle, JitMapOperation_UnmapSlave, j->rx_addr, j->size, 0);
|
rc = svcControlCodeMemory(j->handle, CodeMapOperation_UnmapSlave, j->rx_addr, j->size, 0);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
virtmemFree(j->rw_addr, j->size);
|
virtmemFree(j->rw_addr, j->size);
|
||||||
|
@ -317,7 +317,7 @@ SVC_BEGIN svcSetUnsafeLimit
|
|||||||
ret
|
ret
|
||||||
SVC_END
|
SVC_END
|
||||||
|
|
||||||
SVC_BEGIN svcCreateJitMemory
|
SVC_BEGIN svcCreateCodeMemory
|
||||||
str x0, [sp, #-16]!
|
str x0, [sp, #-16]!
|
||||||
svc 0x4B
|
svc 0x4B
|
||||||
ldr x2, [sp], #16
|
ldr x2, [sp], #16
|
||||||
@ -325,7 +325,7 @@ SVC_BEGIN svcCreateJitMemory
|
|||||||
ret
|
ret
|
||||||
SVC_END
|
SVC_END
|
||||||
|
|
||||||
SVC_BEGIN svcMapJitMemory
|
SVC_BEGIN svcControlCodeMemory
|
||||||
svc 0x4C
|
svc 0x4C
|
||||||
ret
|
ret
|
||||||
SVC_END
|
SVC_END
|
||||||
|
Loading…
Reference in New Issue
Block a user