SVC: Difference between revisions
Synchronize with AMS enums |
|||
Line 313: | Line 313: | ||
'''0xD801:''' Invalid permission specified. Valid permissions are ---, r-- and rw-. | '''0xD801:''' Invalid permission specified. Valid permissions are ---, r-- and rw-. | ||
'''0xD401:''' The provided memory region was in an invalid state. The region must have the | '''0xD401:''' The provided memory region was in an invalid state. The region must have the [[#MemoryState|FlagCanReprotect]] state, and must not have the [[#MemoryAttribute|Locked]] or [[#MemoryAttribute|Uncached]] attributes. | ||
'''0xCE01:''' Kernel resource exhausted. | '''0xCE01:''' Kernel resource exhausted. | ||
Line 1,659: | Line 1,659: | ||
|} | |} | ||
</div> | </div> | ||
You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error. | You must pass same size and permissions as given in [[#CreateTransferMemory]], otherwise error. | ||
Line 1,831: | Line 1,829: | ||
Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]). | Address is the userspace destination address, while DeviceAddressSpaceAddress is the source address between DeviceAddressSpaceStartAddress and DeviceAddressSpaceEndAddress (passed to [[#CreateDeviceAddressSpace]]). | ||
The userspace destination address must have the [[SVC#MemoryState| | The userspace destination address must have the [[SVC#MemoryState|FlagCanDeviceMap]] bit set. Bit [[SVC#MemoryAttribute|DeviceShared]] will be set after mapping. | ||
== MapDeviceAddressSpaceAligned == | == MapDeviceAddressSpaceAligned == | ||
Line 1,857: | Line 1,855: | ||
Maps an attached device address space to an userspace address. | Maps an attached device address space to an userspace address. | ||
Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState| | Same as [[#MapDeviceAddressSpaceByForce]], but the userspace destination address must have the [[SVC#MemoryState|FlagCanAlignedDeviceMap]] bit set instead. | ||
== MapDeviceAddressSpace == | == MapDeviceAddressSpace == | ||
Line 2,562: | Line 2,560: | ||
! Handle type || InfoType || InfoSubType || Description | ! Handle type || InfoType || InfoSubType || Description | ||
|- | |- | ||
| Process || 0 || 0 || | | Process || 0 || 0 || CoreMask | ||
|- | |- | ||
| Process || 1 || 0 || | | Process || 1 || 0 || PriorityMask | ||
|- | |- | ||
| Process || 2 || 0 || | | Process || 2 || 0 || AliasRegionAddress | ||
|- | |- | ||
| Process || 3 || 0 || AliasRegionSize | | Process || 3 || 0 || AliasRegionSize | ||
|- | |- | ||
| Process || 4 || 0 || | | Process || 4 || 0 || HeapRegionAddress | ||
|- | |- | ||
| Process || 5 || 0 || HeapRegionSize | | Process || 5 || 0 || HeapRegionSize | ||
|- | |- | ||
| Process || 6 || 0 || | | Process || 6 || 0 || TotalMemorySize. Total memory available(free+used). | ||
|- | |- | ||
| Process || 7 || 0 || | | Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap. | ||
|- | |- | ||
| Zero || 8 || 0 || | | Zero || 8 || 0 || DebuggerAttached | ||
|- | |- | ||
| Zero || 9 || 0 || | | Zero || 9 || 0 || ResourceLimit | ||
|- | |- | ||
| Zero || 10 || -1, {current coreid} || IdleTickCount | | Zero || 10 || -1, {current coreid} || IdleTickCount | ||
|- | |- | ||
| Zero || 11 || 0-3 || RandomEntropy | | Zero || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs. | ||
|- | |- | ||
| Process || 12 || 0 || [2.0.0+] | | Process || 12 || 0 || [2.0.0+] AslrRegionAddress | ||
|- | |- | ||
| Process || 13 || 0 || [2.0.0+] | | Process || 13 || 0 || [2.0.0+] AslrRegionSize | ||
|- | |- | ||
| Process || 14 || 0 || [2.0.0+] | | Process || 14 || 0 || [2.0.0+] StackRegionAddress | ||
|- | |- | ||
| Process || 15 || 0 || [2.0.0+] StackRegionSize | | Process || 15 || 0 || [2.0.0+] StackRegionSize | ||
|- | |- | ||
| Process || 16 || 0 || [3.0.0+] | | Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal | ||
|- | |- | ||
| Process || 17 || 0 || [3.0.0+] | | Process || 17 || 0 || [3.0.0+] SystemResourceSizeUsed | ||
|- | |- | ||
| Process || 18 || 0 || [3.0.0+] ProgramId | | Process || 18 || 0 || [3.0.0+] ProgramId | ||
|- | |- | ||
| Zero || 19 || 0 || [4.0.0-4.1.0] | | Zero || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| Zero || 19 || 1 || [4.0.0-4.1.0] | | Zero || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound | ||
|- | |- | ||
| Process || 20 || 0 || [5.0.0+] | | Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress | ||
|- | |- | ||
| Process || 21 || 0 || [6.0.0+] | | Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize | ||
|- | |- | ||
| Process || 22 || 0 || [6.0.0+] | | Process || 22 || 0 || [6.0.0+] UsedNonSystemMemorySize | ||
|- | |- | ||
| Process || 23 || 0 || [9.0.0+] IsApplication | | Process || 23 || 0 || [9.0.0+] IsApplication | ||
|- | |- | ||
| Thread || 0xF0000002 || 0-3, -1 || | | Thread || 0xF0000002 || 0-3, -1 || ThreadTickCount. When 0-3 are passed, gets specific core CPU ticks spent on thread. When -1 is passed, gets total CPU ticks spent on thread. | ||
|} | |} | ||
== SystemInfoType == | == SystemInfoType == | ||
{| class=wikitable | {| class=wikitable | ||
! Handle type || SystemInfoType || SystemInfoSubType|| Description | ! Handle type || SystemInfoType || SystemInfoSubType || Description | ||
|- | |- | ||
| Zero || 0 || 0 || | | Zero || 0 || 0 || TotalPhysicalMemorySize_Application | ||
|- | |- | ||
| Zero || 0 || 1 || | | Zero || 0 || 1 || TotalPhysicalMemorySize_Applet | ||
|- | |- | ||
| Zero || 0 || 2 || | | Zero || 0 || 2 || TotalPhysicalMemorySize_System | ||
|- | |- | ||
| Zero || 0 || 3 || | | Zero || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| Zero || 1 || 0 || | | Zero || 1 || 0 || UsedPhysicalMemorySize_Application | ||
|- | |- | ||
| Zero || 1 || 1 || | | Zero || 1 || 1 || UsedPhysicalMemorySize_Applet | ||
|- | |- | ||
| Zero || 1 || 2 || | | Zero || 1 || 2 || UsedPhysicalMemorySize_System | ||
|- | |- | ||
| Zero || 1 || 3 || | | Zero || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe | ||
|- | |- | ||
| Zero || 2 || 0 || | | Zero || 2 || 0 || InitialProcessIdRange_LowerBound | ||
|- | |- | ||
| Zero || 2 || 1 || | | Zero || 2 || 1 || InitialProcessIdRange_UpperBound | ||
|} | |} | ||
Line 2,931: | Line 2,929: | ||
|- | |- | ||
| 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]]. | | 2 || Execute || Can be set by [[#SetProcessMemoryPermission]] and [[#ControlCodeMemory]]. | ||
|- | |||
| 28 || DontCare || | |||
|} | |} | ||
Line 2,952: | Line 2,952: | ||
| 7-0 || [[#MemoryType]] || | | 7-0 || [[#MemoryType]] || | ||
|- | |- | ||
| 8 || [[#SetMemoryPermission| | | 8 || [[#SetMemoryPermission|FlagCanReprotect]] || | ||
|- | |||
| 9 || FlagCanDebug || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only. | |||
|- | |- | ||
| | | 10 || FlagCanUseIpc || Allows sending this region as an IPC A/B/W buffer with flags=0. | ||
|- | |- | ||
| | | 11 || FlagCanUseNonDeviceIpc || Allows sending this region as an IPC A/B/W buffer with flags=1. | ||
|- | |- | ||
| | | 12 || FlagCanUseNonSecureIpc || Allows sending this region as an IPC A/B/W buffer with flags=3. | ||
|- | |- | ||
| | | 13 || FlagMapped || | ||
|- | |- | ||
| 14 || [[#SetProcessMemoryPermission| | | 14 || [[#SetProcessMemoryPermission|FlagCode]] || | ||
|- | |- | ||
| 15 || [[#MapMemory| | | 15 || [[#MapMemory|FlagCanAlias]] || | ||
|- | |- | ||
| 16 || [[# | | 16 || [[#MapProcessCodeMemory|FlagCanCodeAlias]] || | ||
|- | |- | ||
| 17 || [[#CreateTransferMemory| | | 17 || [[#CreateTransferMemory|FlagCanTransfer]] || | ||
|- | |- | ||
| 18 || [[#QueryPhysicalAddress| | | 18 || [[#QueryPhysicalAddress|FlagCanQueryPhysical]] || | ||
|- | |- | ||
| 19 || | | 19 || [[#MapDeviceAddressSpace|FlagCanDeviceMap]] || | ||
|- | |- | ||
| 20 || [[#MapDeviceAddressSpaceAligned| | | 20 || [[#MapDeviceAddressSpaceAligned|FlagCanAlignedDeviceMap]] || | ||
|- | |- | ||
| 21 || [[#SendSyncRequestWithUserBuffer| | | 21 || [[#SendSyncRequestWithUserBuffer|FlagCanIpcUserBuffer]] || | ||
|- | |- | ||
| 22 || | | 22 || FlagReferenceCounted || The physical memory blocks backing this region are refcounted. | ||
|- | |- | ||
| 23 || [[#MapProcessMemory| | | 23 || [[#MapProcessMemory|FlagCanMapProcess]] || | ||
|- | |- | ||
| 24 || [[#SetMemoryAttribute| | | 24 || [[#SetMemoryAttribute|FlagCanChangeAttribute]] || | ||
|- | |- | ||
| 25 || [4.0.0+] [[#CreateCodeMemory| | | 25 || [4.0.0+] [[#CreateCodeMemory|FlagCanCodeMemory]] || | ||
|} | |} | ||