Changes

21 bytes removed ,  08:04, 12 November 2012
no edit summary
Line 323: Line 323:  
|-
 
|-
 
| 0x7D
 
| 0x7D
| GetMemoryInfo(MemInfo *Info, unsigned int *Out, Handle KProcess, unsigned int Addr)
+
| QueryProcessMemory(MemInfo *Info, unsigned int *Out, Handle KProcess, unsigned int Addr)
 
|}
 
|}
   −
Each process can only use SVCs which are enabled in the NCCH [https://github.com/3dshax/ctr/blob/master/ctrtool/exheader.c exheader] for this process. The ARM11 kernel SVC handler checks whether the SVC is enabled in the syscall access control mask stored on the SVC-mode stack. When a process context switch is done, the syscall mask is loaded from the KProcess object and is written to the SVC-mode stack.
+
Each process can only use SVCs which are enabled in the [[NCCH#CXI|exheader]] for this process. The ARM11 kernel SVC handler checks whether the SVC is enabled in the syscall access control mask stored on the SVC-mode stack. When a process context switch is done, the syscall mask is loaded from the KProcess object and is written to the SVC-mode stack.
    
Calling svcBreak on retail will only terminate the process which called this SVC.
 
Calling svcBreak on retail will only terminate the process which called this SVC.
   −
ControlMemory and MapMemoryBlock can be used to map memory pages, these two SVCs only support mapping execute-never R/W pages. The input permissions parameter for these SVCs must be <=3, where value zero is used when un-mapping memory. Bitmask 0xf00 for ControlMemory parameter MemoryType is the memory-type, when this is zero the memory-type is loaded from the kernel flags stored in the exheader ARM11 kernel descriptors, for the process using the SVC. The low 8-bits are the type: 1 is for un-mapping memory, 3 for mapping memory. Addr1 is not used for type1 and type3. Address 0x08000000 for ControlMemory is used for mapping the heap.
+
ControlMemory and MapMemoryBlock can be used to map memory pages, these two SVCs only support mapping execute-never R/W pages. The input permissions parameter for these SVCs must be <=3, where value zero is used when un-mapping memory. Bitmask 0xf00 for ControlMemory parameter MemoryType is the memory-type, when this is zero the memory-type is loaded from the kernel flags stored in the exheader ARM11 kernel descriptors, for the process using the SVC. The low 8-bits are the type: 1 is for un-mapping memory, 3 for mapping memory. Addr1 is not used for type1 and type3.
   −
ControlProcessMemory maps memory in the specified process, where permissions is: bit0=R, bit1=W, bit2=X. This SVC can also be used to change the page permissions of already mapped memory.
+
ControlProcessMemory maps memory in the specified process, this is the only SVC which allows mapping executable memory. Format of the permissions field for memory mapping SVCs: bit0=R, bit1=W, bit2=X. This SVC can also be used to change the page permissions of already mapped memory.
    
MapProcessMemory maps RW memory starting at address 0x00100000 in the specified KProcess, at the specified StartAddr in the current process. MapProcessMemory then maps 0x08000000 in the specified process, to StartAddr+0x7f00000 in the current process. UnmapProcessMemory unmaps the memory which was mapped by MapProcessMemory.
 
MapProcessMemory maps RW memory starting at address 0x00100000 in the specified KProcess, at the specified StartAddr in the current process. MapProcessMemory then maps 0x08000000 in the specified process, to StartAddr+0x7f00000 in the current process. UnmapProcessMemory unmaps the memory which was mapped by MapProcessMemory.
    
DebugActiveProcess is used to attach to a process for debugging. This SVC can only be used when the target process' ARM11 descriptors stored in the exheader have the kernel flag for "Enable debug" set. Otherwise when that flag is clear, the kernel flags for the process using this SVC must have the "Force debug" flag set.
 
DebugActiveProcess is used to attach to a process for debugging. This SVC can only be used when the target process' ARM11 descriptors stored in the exheader have the kernel flag for "Enable debug" set. Otherwise when that flag is clear, the kernel flags for the process using this SVC must have the "Force debug" flag set.