Changes

20 bytes added ,  00:43, 14 October 2017
no edit summary
Line 243: Line 243:     
== svcSetMemoryPermission ==
 
== svcSetMemoryPermission ==
'''Description:''' Change permission of page-aligned memory region.
  −
  −
Bit2 of permission (exec) is not allowed. Setting write-only is not allowed either (bit1).
  −
  −
This can be used to move back and forth between ---, r-- and rw-.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 264: Line 259:  
</div>
 
</div>
   −
== svcSetMemoryAttribute ==
+
'''Description:''' Change permission of page-aligned memory region.
'''Description:''' Change attribute of page-aligned memory region.  
+
 
 +
Bit2 of permission (exec) is not allowed. Setting write-only is not allowed either (bit1).
   −
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU.
+
This can be used to move back and forth between ---, r-- and rw-.
   −
What happens "under the hood" is the "Memory Attribute Indirection Register" index is changed from 2 to 3 in the MMU descriptor.
+
== svcSetMemoryAttribute ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 287: Line 283:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Change attribute of page-aligned memory region.
 +
 +
This is used to turn on/off caching for a given memory area. Useful when talking to devices such as the GPU.
 +
 +
What happens "under the hood" is the "Memory Attribute Indirection Register" index is changed from 2 to 3 in the MMU descriptor.
    
{| class=wikitable
 
{| class=wikitable
Line 299: Line 301:     
== svcMapMemory ==
 
== svcMapMemory ==
 +
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! Argument || Type || Name
 +
|-
 +
| (In) X0 || u64 || <code>Dst</code>
 +
|-
 +
| (In) X1 || u64 || <code>Src</code>
 +
|-
 +
| (In) X2 || u64 || <code>Size</code>
 +
|-
 +
| (Out) W0 || [[#Result]] || <code>Ret</code>
 +
|}
 +
</div>
 +
 
'''Description:''' Maps a memory range into a different range.
 
'''Description:''' Maps a memory range into a different range.
   Line 314: Line 332:     
[2.0.0+] Support for the <code>0x482907</code> mappings outside the "MapRegion" were removed.
 
[2.0.0+] Support for the <code>0x482907</code> mappings outside the "MapRegion" were removed.
 +
 +
== svcUnmapMemory ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 330: Line 350:  
</div>
 
</div>
   −
== svcUnmapMemory ==
   
'''Description:''' Unmaps a region that was previously mapped with [[#svcMapMemory]].
 
'''Description:''' Unmaps a region that was previously mapped with [[#svcMapMemory]].
   Line 336: Line 355:     
The srcaddr/dstaddr must match what was given when the pages were originally mapped.
 
The srcaddr/dstaddr must match what was given when the pages were originally mapped.
  −
<div style="display: inline-block;">
  −
{| class="wikitable" border="1"
  −
|-
  −
! Argument || Type || Name
  −
|-
  −
| (In) X0 || u64 || <code>Dst</code>
  −
|-
  −
| (In) X1 || u64 || <code>Src</code>
  −
|-
  −
| (In) X2 || u64 || <code>Size</code>
  −
|-
  −
| (Out) W0 || [[#Result]] || <code>Ret</code>
  −
|}
  −
</div>
      
== svcQueryMemory ==
 
== svcQueryMemory ==
'''Description:''' Query information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address.
  −
  −
Outputs a [[#MemoryInfo]] struct.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 371: Line 372:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Query information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address.
 +
 +
Outputs a [[#MemoryInfo]] struct.
    
== svcExitProcess ==
 
== svcExitProcess ==
'''Description:''' Exits the current process.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 385: Line 389:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Exits the current process.
    
== svcCreateThread ==
 
== svcCreateThread ==
'''Description:''' Create a thread in the current process.
  −
  −
Processor_id must be 0,1,2,3 or -2, where -2 uses the default cpuid for process.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 411: Line 414:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Create a thread in the current process.
 +
 +
Processor_id must be 0,1,2,3 or -2, where -2 uses the default cpuid for process.
    
== svcStartThread ==
 
== svcStartThread ==
'''Description:''' Starts the thread for the provided handle.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 425: Line 431:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Starts the thread for the provided handle.
    
== svcExitThread ==
 
== svcExitThread ==
'''Description:''' Exits the current thread.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 439: Line 446:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Exits the current thread.
    
== svcSleepThread ==
 
== svcSleepThread ==
'''Description:''' Sleep for a specified amount of time, or yield thread.
  −
  −
Setting nano=0 means "yield thread".
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 455: Line 461:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Sleep for a specified amount of time, or yield thread.
 +
 +
Setting nano=0 means "yield thread".
    
== svcGetThreadPriority ==
 
== svcGetThreadPriority ==
'''Description:''' Get priority of provided thread handle.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 471: Line 480:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Get priority of provided thread handle.
    
== svcSetThreadPriority ==
 
== svcSetThreadPriority ==
'''Description:''' Set priority of provided thread handle.
  −
  −
Priority is a number 0-0x3F. Lower value means higher priority.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 489: Line 497:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Set priority of provided thread handle.
 +
 +
Priority is a number 0-0x3F. Lower value means higher priority.
    
== svcGetThreadCoreMask ==
 
== svcGetThreadCoreMask ==
'''Description:''' Get affinity mask of provided thread handle.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 507: Line 518:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Get affinity mask of provided thread handle.
    
== svcSetThreadCoreMask ==
 
== svcSetThreadCoreMask ==
'''Description:''' Set affinity mask of provided thread handle.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 525: Line 537:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Set affinity mask of provided thread handle.
    
== svcGetCurrentProcessorNumber ==
 
== svcGetCurrentProcessorNumber ==
'''Description:''' Get which cpu is executing the current thread.
  −
  −
Cpu-id is an integer in the range 0-3.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 541: Line 552:  
|}
 
|}
 
</div>
 
</div>
 +
 +
'''Description:''' Get which cpu is executing the current thread.
 +
 +
Cpu-id is an integer in the range 0-3.
    
== svcMapSharedMemory ==
 
== svcMapSharedMemory ==
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.
  −
  −
Increases reference count for the KSharedMemory object. Thus in order to release the memory associated with the object, all handles to it must be closed and all mappings must be unmapped.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 564: Line 576:  
</div>
 
</div>
   −
== svcCreateTransferMemory ==
+
Maps the block supplied by the handle. The required permissions are different for the process that created the handle and all other processes.
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].
     −
Executable bit perm not allowed.
+
Increases reference count for the KSharedMemory object. Thus in order to release the memory associated with the object, all handles to it must be closed and all mappings must be unmapped.
   −
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.
+
== svcCreateTransferMemory ==
    
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 587: Line 598:  
|}
 
|}
 
</div>
 
</div>
 +
 +
This one reprotects the src block with perms you give it. It also sets bit0 into [[#MemoryAttribute]].
 +
 +
Executable bit perm not allowed.
 +
 +
Closing all handles automatically causes the bit0 in [[#MemoryAttribute]] to clear, and the permission to reset.
    
== svcWaitSynchronization ==
 
== svcWaitSynchronization ==
Works with num_handles <= 0x40, error on num_handles == 0.
  −
  −
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 609: Line 623:  
|}
 
|}
 
</div>
 
</div>
 +
 +
Works with num_handles <= 0x40, error on num_handles == 0.
 +
 +
Does not accept 0xFFFF8001 or 0xFFFF8000 as handles.
    
== svcSendSyncRequestWithUserBuffer ==
 
== svcSendSyncRequestWithUserBuffer ==
Size must be 0x1000-aligned.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 627: Line 644:  
|}
 
|}
 
</div>
 
</div>
 +
 +
Size must be 0x1000-aligned.
    
== svcBreak ==
 
== svcBreak ==
When used on retail where inx0 bit31 is clear, the system will throw a [[Error_codes|fatal-error]]. Otherwise when bit31 is set, it will return 0.
      
<div style="display: inline-block;">
 
<div style="display: inline-block;">
Line 645: Line 663:  
|}
 
|}
 
</div>
 
</div>
 +
 +
When used on retail where inx0 bit31 is clear, the system will throw a [[Error_codes|fatal-error]]. Otherwise when bit31 is set, it will return 0.
    
== svcGetInfo ==
 
== svcGetInfo ==
48

edits