In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
3,757 bytes added ,  07:13, 7 April 2016
Complete rework with syscall access as of 5.5.0
Line 1: Line 1: −
The kernel contains several different system call tables that controls the availability of syscalls to different process modes.
+
Cafe OS syscalls are issued by doing the following:
 +
li r0, 0x0100 # load syscall value->r0
 +
sc            # syscall instruction
 +
blr          # return control to program
   −
Access modes:
+
When you send a call to the kernel, it goes to FFF00C00, which then jumps to FFF021A0 + (fastcall << 5).
* L: Loader
     −
{| class="wikitable"
+
Normal syscalls are divisible by 0x100, so all of them will jump to FFF0021A0 itself, which is a jump to the table dispatcher.
 +
 
 +
The dispatcher uses the RAMPID and syscall it was sent to load an address from its table which it then jumps to (which, if zero, just crashes as it's invalid).
 +
 
 +
Below is all RAMPIDs' access to syscalls. The loader mostly has its own special variations of syscalls.
 +
 
 +
RAMPID 1, system (home menu, browser, and error handler), and apps/games usually all have access to the same syscalls.
 +
 
 +
{| class="wikitable sortable"
 +
|-
 +
! scope="col" | #
 +
! scope="col" | Name
 +
! scope="col" style="width: 24px;" | ID 1
 +
! scope="col" style="width: 24px;" | Sys
 +
! scope="col" style="width: 24px;" | App
 +
! scope="col" style="width: 24px;" | Ldr
 +
|-
 +
| 0x0000 || ConsoleWrite || Y || Y || Y || Y (sp)
 +
|-
 +
| 0x0006 || LoadContext || ? || ? || ? || ?
 +
|-
 +
| 0x0008 || SetContext || ? || ? || ? || ?
 +
|-
 +
| 0x0009 || GetCurrentFPUContext || ? || ? || ? || ?
 +
|-
 +
| 0x000A || SetCurrentFPUContext || ? || ? || ? || ?
 +
|-
 +
| 0x000C || WriteGatherInit || ? || ? || ? || ?
 +
|-
 +
| 0x000D || SetPerformanceMonitor || ? || ? || ? || ?
 +
|-
 +
| 0x0011 || ReadRegister32Ex || ? || ? || ? || ?
 +
|-
 +
| 0x0012 || WriteRegister32Ex || ? || ? || ? || ?
 +
|-
 +
| 0x0017 || WriteGatherGetPtr || ? || ? || ? || ?
 +
|-
 +
| 0x0019 || GetSecurityLevel (always zero) || ? || ? || ? || ?
 +
|-
 +
| 0x0100 || AppPanic || Y || Y || Y || Y
 +
|-
 +
| 0x0200 || EffectiveToPhysical || Y || Y || Y || N
 +
|-
 +
| 0x0300 || PhysicalToEffectiveCached || Y || Y || Y || N
 +
|-
 +
| 0x0400 || PhysicalToEffectiveUncached || Y || Y || Y || N
 +
|-
 +
| 0x0500 || ValidateAddrRange || Y || Y || Y || Y
 +
|-
 +
| 0x0600 || UpdateCoreTime || Y || Y || Y || N
 +
|-
 +
| 0x0800 || SetUserModeExHandler || Y || Y || Y || N
 +
|-
 +
| 0x0B00 || AllocateTimer || Y || Y || Y || N
 +
|-
 +
| 0x0C00 || FreeTimer || Y || Y || Y || N
 +
|-
 +
| 0x0D00 || PrimeTimer || Y || Y || Y || N
 +
|-
 +
| 0x0E00 || StopTimer || Y || Y || Y || N
 +
|-
 +
| 0x0F00 || LogLoadedRPLs || Y || Y || Y || N
 +
|-
 +
| 0x1000 || SetInterruptHandler || Y || Y || Y || N
 +
|-
 +
| 0x1100 || GetInterruptHandler || Y || Y || Y || N
 +
|-
 +
| 0x1200 || DisableInterrupt || Y || Y || Y || N
 +
|-
 +
| 0x1300 || EnableInterrupt || Y || Y || Y || N
 +
|-
 +
| 0x1400 || ClearAndEnableInterrupt || Y || Y || Y || N
 +
|-
 +
| 0x1500 || GetInterruptStatus || Y || Y || Y || N
 +
|-
 +
| 0x1600 || ClearInterruptStatus || Y || Y || Y || N
 +
|-
 +
| 0x1700 || FindClosestSymbol || Y || Y || Y || Y (sp)
 +
|-
 +
| 0x1900 || Exit/Halt || Y || Y || Y || N
 
|-
 
|-
! # !! Name !! Access
+
| 0x1A00 || GetInfo || Y || Y || Y || N
 
|-
 
|-
| 0x0000 || ConsoleWrite ||  
+
| 0x1B00 || SetInfo || Y || Y || Y || N
 
|-
 
|-
| 0x0006 || LoadContext ||  
+
| 0x1C00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x0008 || SetContext ||  
+
| 0x1D00 || SendICI || Y || Y || Y || N
 
|-
 
|-
| 0x0009 || GetCurrentFPUContext ||
+
| 0x1E00 || IPCKDriver_<nowiki>{Loader|User}</nowiki>Open || Y || Y || Y || Y (sp)
 
|-
 
|-
| 0x000A || SetCurrentFPUContext ||
+
| 0x1F00 || IPCKDriver_<nowiki>{Loader|User}</nowiki>Close || Y || Y || Y || Y (sp)
 
|-
 
|-
| 0x000C || WriteGatherInit ||
+
| 0x2000 || IPCKDriver_SubmitRequest || Y || Y || Y || Y (sp)
 
|-
 
|-
| 0x000D || SetPerformanceMonitor ||
+
| 0x2200 || GetEnvironmentVariable || Y || Y || Y || N
 
|-
 
|-
| 0x0011 || ReadRegister32Ex ||  
+
| 0x2700 || GetNotifyTarget || Y || Y || Y || N
 
|-
 
|-
| 0x0012 || WriteRegister32Ex ||  
+
| 0x2800 || ProcCtrl || Y || Y || Y || N
 
|-
 
|-
| 0x0017 || WriteGatherGetPtr ||  
+
| 0x2900 || GetForegroundBucket || Y || Y || Y || N
 
|-
 
|-
| 0x0019 || GetSecurityLevel ||  
+
| 0x2A00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x0100 || AppPanic || L
+
| 0x2B00 || PrepareTitle || Y || Y || Y || N
 
|-
 
|-
| 0x0200 || EffectiveToPhysical ||  
+
| 0x2C00 || ProcYield || Y || Y || Y || N
 
|-
 
|-
| 0x0300 || PhysicalToEffectiveCached ||
+
| 0x2E00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x0400 || PhysicalToEffectiveUncached ||
+
| 0x2F00 || GetCallArgs || Y || Y || Y || N
 
|-
 
|-
| 0x0500 || ValidateAddrRange || L
+
| 0x3000 || GetAbsoluteSystemTimeInternal || Y || Y || Y || N
 
|-
 
|-
| 0x0600 || UpdateCoretime ||  
+
| 0x3100 || SetAbsoluteSystemTimeInternal || Y || Y || Y || N
 
|-
 
|-
| 0x0800 || SetUserModeExHandler ||  
+
| 0x3200 || Driver_Register || Y || Y || Y || N
 
|-
 
|-
| 0x0B00 || AllocateTimer ||  
+
| 0x3300 || Driver_Deregister || Y || Y || Y || N
 
|-
 
|-
| 0x0C00 || FreeTimer ||  
+
| 0x3800 || AllocVirtAddr || Y || Y || Y || N
 
|-
 
|-
| 0x0D00 || PrimeTimer ||  
+
| 0x3900 || FreeVirtAddr || Y || Y || Y || N
 
|-
 
|-
| 0x0E00 || StopTimer ||  
+
| 0x3A00 || GetMapVirtAddrRange || Y || Y || Y || N
 
|-
 
|-
| 0x0F00 || LogLoadedRPLs ||  
+
| 0x3B00 || GetDataPhysAddrRange || Y || Y || Y || N
 
|-
 
|-
| 0x1200 || DisableInterrupt ||  
+
| 0x3C00 || GetAvailPhysAddrRange || Y || Y || Y || N
 
|-
 
|-
| 0x1400 || ClearAndEnableInterrupt ||  
+
| 0x3D00 || MapMemory || Y || Y || Y || N
 
|-
 
|-
| 0x1700 || FindClosestSymbol || L
+
| 0x3E00 || UnmapMemory || Y || Y || Y || N
 
|-
 
|-
| 0x1900 || Exit/Halt ||
+
| 0x3F00 || LogBuffer || Y || Y || Y || Y
 
|-
 
|-
| 0x1A00 || GetInfo ||  
+
| 0x4000 || LogArgs || Y || Y || Y || Y
 
|-
 
|-
| 0x1B00 || SetInfo ||
+
| 0x4100 || LogFunc || Y || Y || Y || Y
 
|-
 
|-
| 0x1D00 || SendICI ||  
+
| 0x4200 || LogReportKernel || Y || Y || Y || Y
 
|-
 
|-
| 0x1E00 || IPCKDriver_<nowiki>{Loader|User}</nowiki>Open || L
+
| 0x4300 || LogRetrieve || Y || Y || Y || Y
 
|-
 
|-
| 0x1F00 || IPCKDriver_<nowiki>{Loader|User}</nowiki>Close || L
+
| 0x4400 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x2000 || IPCKDriver_SubmitRequest ||  
+
| 0x4500 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x2200 || GetEnvironmentVariable ||  
+
| 0x4600 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x2700 || GetNotifyTarget ||  
+
| 0x4700 || Driver_CopyFromSaveArea || Y || Y || Y || N
 
|-
 
|-
| 0x2800 || ProcCtrl ||  
+
| 0x4800 || Driver_CopyToSaveArea || Y || Y || Y || N
 
|-
 
|-
| 0x2900 || GetForegroundBucket ||  
+
| 0x4900 || SavesDone_ReadyToRelease || Y || Y || Y || N
 
|-
 
|-
| 0x2B00 || PrepareTitle ||  
+
| 0x4A00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x2C00 || ProcYield ||  
+
| 0x4B00 || SetDABR || Y || Y || Y || N
 
|-
 
|-
| 0x2F00 || GetCallArgs ||  
+
| 0x4C00 || SetIABR || Y || Y || Y || N
 
|-
 
|-
| 0x3000 || GetAbsoluteSystemTimeInternal ||  
+
| 0x4D00 || GetProcessInfo || Y || Y || Y || N
 
|-
 
|-
| 0x3100 || SetAbsoluteSystemTimeInternal ||  
+
| 0x4E00 || GetCodegenVirtAddrRange || Y || Y || Y || N
 
|-
 
|-
| 0x3800 || AllocVirtAddr ||  
+
| 0x4F00 || LoaderCall || Y || Y || Y || N
 
|-
 
|-
| 0x3900 || FreeVirtAddr ||  
+
| 0x5000 || RPLLoaderResumeContext || N || N || N || Y
 
|-
 
|-
| 0x3A00 || GetMapVirtAddrRange ||  
+
| 0x5200 || WaitIopComplete || N || N || N || Y
 
|-
 
|-
| 0x3B00 || GetDataPhysAddrRange ||  
+
| 0x5300 || FlushCode || N || N || N || Y
 
|-
 
|-
| 0x3C00 || GetAvailPhysAddrRange ||  
+
| 0x5400 || FlushData || N || N || N || Y
 
|-
 
|-
| 0x3D00 || MapMemory ||  
+
| 0x5500 || UpdateHeartbeat || N || N || N || Y
 
|-
 
|-
| 0x3E00 || UnmapMemory ||  
+
| 0x5600 || LogEntry || N || N || N || Y
 
|-
 
|-
| 0x3F00 || LogBuffer || L
+
| 0x5700 || FastClearMemory || N || N || N || Y
 
|-
 
|-
| 0x4000 || LogArgs || L
+
| 0x5800 || GetBusClockSpeed || N || N || N || Y
 
|-
 
|-
| 0x4100 || LogFunc || L
+
| 0x5900 || GetSharedArea || Y || Y || Y || N
 
|-
 
|-
| 0x4200 || LogReportKernel || L
+
| 0x5A00 || SendPolicy || Y || Y || Y || N
 
|-
 
|-
| 0x4300 || LogRetrieve ||  
+
| 0x5B00 || GetProcessIndex || N || N || N || Y
 
|-
 
|-
| 0x4700 || Driver_CopyFromSaveArea ||  
+
| 0x5C00 || IPCKDriver_PollLoaderCompletion || N || N || N || Y
 
|-
 
|-
| 0x4800 || Driver_CopyToSaveArea ||  
+
| 0x5D00 || BlockLogSave || Y || Y || Y || N
 
|-
 
|-
| 0x4900 || SavesDone_ReadyToRelease ||  
+
| 0x5E00 || FinishInitandPreload || N || N || N || Y
 
|-
 
|-
| 0x4B00 || SetDABR ||
+
| 0x5F00 || ContinueStartProcess || N || N || N || Y
 
|-
 
|-
| 0x4C00 || SetIABR ||
+
| 0x6000 || OpenMCP || N || N || N || Y
 
|-
 
|-
| 0x4D00 || GetProcessInfo ||
+
| 0x6100 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x4E00 || GetCodegenVirtAddrRange ||  
+
| 0x6200 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x4F00 || LoaderCall ||  
+
| 0x6300 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5000 || RPLLoaderResumeContext || L
+
| 0x6400 || SetTimeInternal || N || Y || N || N
 
|-
 
|-
| 0x5200 || WaitIopComplete || L
+
| 0x6500 || (blr) || Y || Y || Y || N
 
|-
 
|-
| 0x5300 || FlushCode || L
+
| 0x6600 || ProfileEntry (blr) || N || N || N || Y
 
|-
 
|-
| 0x5400 || FlushData || L
+
| 0x6700 || RequestFastExit || Y || Y || Y || N
 
|-
 
|-
| 0x5500 || UpdateHeartBeat || L
+
| 0x6800 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5600 || LogEntry || L
+
| 0x6900 || GetSwitchTarget || Y || Y || Y || N
 
|-
 
|-
| 0x5700 || FastClearMemory || L
+
| 0x6A00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5800 || GetBusClockSpeed || L
+
| 0x6B00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5900 || GetSharedArea ||  
+
| 0x6C00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5A00 || SendPolicy ||  
+
| 0x6E00 || SwitchSecCodeGenMode || Y || Y || Y || N
 
|-
 
|-
| 0x5B00 || GetProcessIndex || L
+
| 0x6F00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5C00 || IPCKDriver_PollLoaderCompletion || L
+
| 0x7000 || GetTitleVersion || Y || Y || Y || N
 
|-
 
|-
| 0x5D00 || BlockLogSave ||  
+
| 0x7100 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x5E00 || FinishInitAndPreload || L
+
| 0x7200 || ForceFullRelaunch || Y || Y || Y || N
 
|-
 
|-
| 0x5F00 || ContinueStartProcess || L
+
| 0x7300 || ??? || Y || N || N || N
 
|-
 
|-
| 0x6000 || OpenMCP || L
+
| 0x7400 || get_mode_flags(?) || Y || Y || Y || Y
 
|-
 
|-
| 0x6400 || SetTimeInternal ||
+
| 0x7500 || QueryVirtAddr || Y || Y || Y || N
 
|-
 
|-
| 0x6600 || ProfileEntry || L
+
| 0x7600 || GetCodegenCore || Y || Y || Y || N
 
|-
 
|-
| 0x6700 || RequestFastExit ||  
+
| 0x7700 || GetSecCodeGenMode || Y || Y || Y || N
 
|-
 
|-
| 0x6900 || GetSwitchTarget ||  
+
| 0x7800 || CodegenCopy || Y || Y || Y || N
 
|-
 
|-
| 0x6E00 || SwitchSecCodeGenMode ||  
+
| 0x7900 || ??? || Y || N || N || N
 
|-
 
|-
| 0x7000 || GetTitleVersion ||  
+
| 0x7A00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x7200 || ForceFullRelaunch ||  
+
| 0x7B00 || IopShell_InjectCommand || Y || Y || Y || N
 
|-
 
|-
| 0x7400 || get_mode_flags(?) || L
+
| 0x7C00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x7500 || QueryVirtAddr ||  
+
| 0x7D00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x7600 || GetCodegenCore ||  
+
| 0x7E00 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x7700 || GetSecCodeGenMode ||  
+
| 0x7F00 || GetSystemMode || Y || Y || Y || N
 
|-
 
|-
| 0x7B00 || IopShell_InjectCommand ||  
+
| 0x8000 || ??? || Y || Y || Y || N
 
|-
 
|-
| 0x7800 || CodegenCopy ||  
+
| 0x8100 || ZeroProcessMemory || Y || N || N || N
 
|-
 
|-
| 0x7F00 || GetSystemMode ||  
+
| 0x8200 || HandleIopPowerEvents || Y || Y || Y || N
 
|-
 
|-
| 0x8100 || ZeroProcessMemory ||
+
| 0x8300 || ??? || Y || Y || Y || Y
 
|-
 
|-
| 0x8200 || HandleIopPowerEvents ||  
+
| 0x8400 || ??? || N || N || N || Y
 
|}
 
|}
52

edits

Navigation menu