Changes

16 bytes removed ,  03:06, 11 February 2024
no edit summary
Line 1: Line 1:  
Cafe OS is the operating system running on the PowerPC in Wii U mode. It consists of the Cafe OS kernel, the executable loader, and system libraries. Unlike on the Wii, where each game provided its own copy of [https://wiibrew.org/wiki/Revolution_OS Revolution OS] with no isolation between libraries, Wii U applications run under the supervision of a common PowerPC kernel, isolating them from each other. All applications are [[RPL|modified ELFs]], as are the libraries themselves, and applications dynamically link with them to gain access to OS services. Cafe OS also contains a few system processes, like the home menu and error handler.
 
Cafe OS is the operating system running on the PowerPC in Wii U mode. It consists of the Cafe OS kernel, the executable loader, and system libraries. Unlike on the Wii, where each game provided its own copy of [https://wiibrew.org/wiki/Revolution_OS Revolution OS] with no isolation between libraries, Wii U applications run under the supervision of a common PowerPC kernel, isolating them from each other. All applications are [[RPL|modified ELFs]], as are the libraries themselves, and applications dynamically link with them to gain access to OS services. Cafe OS also contains a few system processes, like the home menu and error handler.
   −
== Kernel ==
+
= Kernel =
 
The kernel runs in supervisor mode on the PowerPC, and performs the basic tasks of a microkernel. It is responsible for process isolation, memory management, and interrupt dispatching, as well as communication with [[IOSU]]. Cafe OS applications run as user mode processes, with separate address spaces and W^X memory protection.
 
The kernel runs in supervisor mode on the PowerPC, and performs the basic tasks of a microkernel. It is responsible for process isolation, memory management, and interrupt dispatching, as well as communication with [[IOSU]]. Cafe OS applications run as user mode processes, with separate address spaces and W^X memory protection.
   −
=== Syscalls ===
+
== Syscalls ==
 
Cafe OS syscalls are issued by doing the following:
 
Cafe OS syscalls are issued by doing the following:
 
  li r0, 0x0100 # load syscall value->r0
 
  li r0, 0x0100 # load syscall value->r0
Line 266: Line 266:  
|}
 
|}
   −
=== Fastcalls ===
+
== Fastcalls ==
 
Fastcalls, on the other hand, are system calls that aren't routed through the dispatcher and can be accessed by any RAMPID.
 
Fastcalls, on the other hand, are system calls that aren't routed through the dispatcher and can be accessed by any RAMPID.
 
Attempting to access an unimplemented fastcall will redirect the code flow to syscall 0x0100 (AppPanic).
 
Attempting to access an unimplemented fastcall will redirect the code flow to syscall 0x0100 (AppPanic).
Line 324: Line 324:  
|}
 
|}
   −
=== CosParams ===
+
== CosParams ==
 
This is a structure mapped to address 0x1FFF000 in MEM1 for communicating with the [[IOSU|MCP]] process.
 
This is a structure mapped to address 0x1FFF000 in MEM1 for communicating with the [[IOSU|MCP]] process.
   Line 418: Line 418:  
|}
 
|}
   −
== Processes ==
+
= Processes =
 
A process in Cafe OS represents a single running application, with its own code, memory, and permissions. Cafe OS only executes the code of a single process at a time, but it can hold the data of multiple processes in memory simultaneously, and switch between them. Rather than allowing arbitrary process creation, there is RAM reserved for a single foreground app, a single background app, and various other special processes. Each running process is assigned a unique identifier called a RAMPID:
 
A process in Cafe OS represents a single running application, with its own code, memory, and permissions. Cafe OS only executes the code of a single process at a time, but it can hold the data of multiple processes in memory simultaneously, and switch between them. Rather than allowing arbitrary process creation, there is RAM reserved for a single foreground app, a single background app, and various other special processes. Each running process is assigned a unique identifier called a RAMPID:
 
{| class="wikitable"
 
{| class="wikitable"
Line 531: Line 531:  
|}
 
|}
   −
== Loader ==
+
= Loader =
 
{{Main|Loader}}
 
{{Main|Loader}}
    
The loader is responsible for loading RPL formatted libraries and executables into memory. It is a standard ELF executable named loader.elf. It includes a statically linked copy of zlib, probably for decompressing sections of RPL files.
 
The loader is responsible for loading RPL formatted libraries and executables into memory. It is a standard ELF executable named loader.elf. It includes a statically linked copy of zlib, probably for decompressing sections of RPL files.
   −
== Libraries ==
+
= Libraries =
 
Cafe OS applications dynamically link with system libraries to get access to OS services. These OS services include memory management, graphics, audio, and controller input. All libraries are [[RPL|RPL files]], a modification of the standard ELF format with compressed sections and more Windows-like dynamic linking. The main system libraries are listed below, with some having their own pages of documentation:
 
Cafe OS applications dynamically link with system libraries to get access to OS services. These OS services include memory management, graphics, audio, and controller input. All libraries are [[RPL|RPL files]], a modification of the standard ELF format with compressed sections and more Windows-like dynamic linking. The main system libraries are listed below, with some having their own pages of documentation:
 
*[[avm.rpl]] - Audio/Video Manager
 
*[[avm.rpl]] - Audio/Video Manager
Line 605: Line 605:  
*[https://github.com/madler/zlib/tree/9712272c78b9d9c93746d9c8e156a3728c65ca72 zlib125.rpl] - ZLIB 1.2.5, functions match official library
 
*[https://github.com/madler/zlib/tree/9712272c78b9d9c93746d9c8e156a3728c65ca72 zlib125.rpl] - ZLIB 1.2.5, functions match official library
   −
== Virtual Memory Map ==
+
= Virtual Memory Map =
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-