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 PermissionChangeAllowed bit set in its [[#MemoryState]], and must not have the IsBorrowed or IsUncached [[#MemoryAttribute]]. | + | '''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> |
− |
| |
− | The newly mapped pages will have [[#MemoryState]] type 0xE.
| |
| | | |
| 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|MapDeviceAllowed]] bit set. Bit [[SVC#MemoryAttribute|IsDeviceMapped]] will be set after mapping. | + | 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|MapDeviceAlignedAllowed]] bit set instead. | + | 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 || AllowedCpuIdBitmask | + | | Process || 0 || 0 || CoreMask |
| |- | | |- |
− | | Process || 1 || 0 || AllowedThreadPrioBitmask | + | | Process || 1 || 0 || PriorityMask |
| |- | | |- |
− | | Process || 2 || 0 || AliasRegionBaseAddr | + | | Process || 2 || 0 || AliasRegionAddress |
| |- | | |- |
| | Process || 3 || 0 || AliasRegionSize | | | Process || 3 || 0 || AliasRegionSize |
| |- | | |- |
− | | Process || 4 || 0 || HeapRegionBaseAddr | + | | Process || 4 || 0 || HeapRegionAddress |
| |- | | |- |
| | Process || 5 || 0 || HeapRegionSize | | | Process || 5 || 0 || HeapRegionSize |
| |- | | |- |
− | | Process || 6 || 0 || TotalMemoryAvailable. Total memory available(free+used). | + | | Process || 6 || 0 || TotalMemorySize. Total memory available(free+used). |
| |- | | |- |
− | | Process || 7 || 0 || TotalMemoryUsage. Total used size of codebin memory + main-thread stack + allocated heap. | + | | Process || 7 || 0 || UsedMemorySize. Total used size of codebin memory + main-thread stack + allocated heap. |
| |- | | |- |
− | | Zero || 8 || 0 || IsCurrentProcessBeingDebugged | + | | Zero || 8 || 0 || DebuggerAttached |
| |- | | |- |
− | | Zero || 9 || 0 || Returns ResourceLimit handle for current process. Used by [[Process_Manager_services|PM]]. | + | | Zero || 9 || 0 || ResourceLimit |
| |- | | |- |
| | Zero || 10 || -1, {current coreid} || IdleTickCount | | | Zero || 10 || -1, {current coreid} || IdleTickCount |
| |- | | |- |
− | | Zero || 11 || 0-3 || RandomEntropy from current process. TRNG. Used to seed usermode PRNGs. | + | | Zero || 11 || 0-3 || RandomEntropy. Used to seed usermode PRNGs. |
| |- | | |- |
− | | Process || 12 || 0 || [2.0.0+] AddressSpaceBaseAddr | + | | Process || 12 || 0 || [2.0.0+] AslrRegionAddress |
| |- | | |- |
− | | Process || 13 || 0 || [2.0.0+] AddressSpaceSize | + | | Process || 13 || 0 || [2.0.0+] AslrRegionSize |
| |- | | |- |
− | | Process || 14 || 0 || [2.0.0+] StackRegionBaseAddr | + | | 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+] PersonalMmHeapSize | + | | Process || 16 || 0 || [3.0.0+] SystemResourceSizeTotal |
| |- | | |- |
− | | Process || 17 || 0 || [3.0.0+] PersonalMmHeapUsage | + | | 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] PrivilegedProcessId_LowerBound | + | | Zero || 19 || 0 || [4.0.0-4.1.0] InitialProcessIdRange_LowerBound |
| |- | | |- |
− | | Zero || 19 || 1 || [4.0.0-4.1.0] PrivilegedProcessId_UpperBound | + | | Zero || 19 || 1 || [4.0.0-4.1.0] InitialProcessIdRange_UpperBound |
| |- | | |- |
− | | Process || 20 || 0 || [5.0.0+] UserExceptionContextAddr | + | | Process || 20 || 0 || [5.0.0+] UserExceptionContextAddress |
| |- | | |- |
− | | Process || 21 || 0 || [6.0.0+] TotalMemoryAvailableWithoutMmHeap | + | | Process || 21 || 0 || [6.0.0+] TotalNonSystemMemorySize |
| |- | | |- |
− | | Process || 22 || 0 || [6.0.0+] TotalMemoryUsedWithoutMmHeap | + | | 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 Ticks. When 0-3 are passed, gets specific core CPU ticks spent on thread. When -1 is passed, gets total CPU ticks spent on thread. | + | | 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 || TotalMemorySize_Application | + | | Zero || 0 || 0 || TotalPhysicalMemorySize_Application |
| |- | | |- |
− | | Zero || 0 || 1 || TotalMemorySize_Applet | + | | Zero || 0 || 1 || TotalPhysicalMemorySize_Applet |
| |- | | |- |
− | | Zero || 0 || 2 || TotalMemorySize_System | + | | Zero || 0 || 2 || TotalPhysicalMemorySize_System |
| |- | | |- |
− | | Zero || 0 || 3 || TotalMemorySize_SystemUnsafe | + | | Zero || 0 || 3 || TotalPhysicalMemorySize_SystemUnsafe |
| |- | | |- |
− | | Zero || 1 || 0 || CurrentMemorySize_Application | + | | Zero || 1 || 0 || UsedPhysicalMemorySize_Application |
| |- | | |- |
− | | Zero || 1 || 1 || CurrentMemorySize_Applet | + | | Zero || 1 || 1 || UsedPhysicalMemorySize_Applet |
| |- | | |- |
− | | Zero || 1 || 2 || CurrentMemorySize_System | + | | Zero || 1 || 2 || UsedPhysicalMemorySize_System |
| |- | | |- |
− | | Zero || 1 || 3 || CurrentMemorySize_SystemUnsafe | + | | Zero || 1 || 3 || UsedPhysicalMemorySize_SystemUnsafe |
| |- | | |- |
− | | Zero || 2 || 0 || PrivilegedProcessId_LowerBound | + | | Zero || 2 || 0 || InitialProcessIdRange_LowerBound |
| |- | | |- |
− | | Zero || 2 || 1 || PrivilegedProcessId_UpperBound | + | | 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|PermissionChangeAllowed]] || | + | | 8 || [[#SetMemoryPermission|FlagCanReprotect]] || |
| + | |- |
| + | | 9 || FlagCanDebug || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only. |
| |- | | |- |
− | | 9 || ForceReadWritableByDebugSyscalls || Allows using [[#WriteDebugProcessMemory]] on segments mapped read-only. | + | | 10 || FlagCanUseIpc || Allows sending this region as an IPC A/B/W buffer with flags=0. |
| |- | | |- |
− | | 10 || IpcSendAllowed || 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. |
| |- | | |- |
− | | 11 || NonDeviceIpcSendAllowed || 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. |
| |- | | |- |
− | | 12 || NonSecureIpcSendAllowed || Allows sending this region as an IPC A/B/W buffer with flags=3. | + | | 13 || FlagMapped || |
| |- | | |- |
− | | 14 || [[#SetProcessMemoryPermission|ProcessPermissionChangeAllowed]] || | + | | 14 || [[#SetProcessMemoryPermission|FlagCode]] || |
| |- | | |- |
− | | 15 || [[#MapMemory|MapAllowed]] || | + | | 15 || [[#MapMemory|FlagCanAlias]] || |
| |- | | |- |
− | | 16 || [[#UnmapProcessCodeMemory|UnmapProcessCodeMemoryAllowed]] || | + | | 16 || [[#MapProcessCodeMemory|FlagCanCodeAlias]] || |
| |- | | |- |
− | | 17 || [[#CreateTransferMemory|TransferMemoryAllowed]] || | + | | 17 || [[#CreateTransferMemory|FlagCanTransfer]] || |
| |- | | |- |
− | | 18 || [[#QueryPhysicalAddress|QueryPhysicalAddressAllowed]] || | + | | 18 || [[#QueryPhysicalAddress|FlagCanQueryPhysical]] || |
| |- | | |- |
− | | 19 || MapDeviceAllowed ([[#MapDeviceAddressSpace]] and [[#MapDeviceAddressSpaceByForce]]) || | + | | 19 || [[#MapDeviceAddressSpace|FlagCanDeviceMap]] || |
| |- | | |- |
− | | 20 || [[#MapDeviceAddressSpaceAligned|MapDeviceAlignedAllowed]] || | + | | 20 || [[#MapDeviceAddressSpaceAligned|FlagCanAlignedDeviceMap]] || |
| |- | | |- |
− | | 21 || [[#SendSyncRequestWithUserBuffer|IpcBufferAllowed]] || | + | | 21 || [[#SendSyncRequestWithUserBuffer|FlagCanIpcUserBuffer]] || |
| |- | | |- |
− | | 22 || IsPoolAllocated/IsReferenceCounted || The physical memory blocks backing this region are refcounted. | + | | 22 || FlagReferenceCounted || The physical memory blocks backing this region are refcounted. |
| |- | | |- |
− | | 23 || [[#MapProcessMemory|MapProcessAllowed]] || | + | | 23 || [[#MapProcessMemory|FlagCanMapProcess]] || |
| |- | | |- |
− | | 24 || [[#SetMemoryAttribute|AttributeChangeAllowed]] || | + | | 24 || [[#SetMemoryAttribute|FlagCanChangeAttribute]] || |
| |- | | |- |
− | | 25 || [4.0.0+] [[#CreateCodeMemory|CodeMemoryAllowed]] || | + | | 25 || [4.0.0+] [[#CreateCodeMemory|FlagCanCodeMemory]] || |
| |} | | |} |
| | | |