Line 1: |
Line 1: |
| {{TOCright}} | | {{TOCright}} |
| | | |
− | '''IOS''' is the operating system that runs on the [[Starlet]] coprocessor inside the [[Hollywood]] package. It provides the services that are used by Wii code to access most of the system devices. | + | '''IOS''' is the operating system that runs on the [[Starlet]] coprocessor inside the [[Hollywood]] package. It provides services that are used by Wii code to access many system devices: USB, networking, security, app management, NAND flash storage, SD card, optical disc, and also WiiConnect24 features. |
| | | |
− | IOS is a somewhat unique system in that many games use (and come with) their own version of the IOS, though many games use the same IOS versions. There is no "true" version of the operating system, instead there are many of what could be called "slots" for different versions of IOS to sit in. IOS versions are not aware of each other, and are not used or invoked at all unless software specifically requests to run using them. In this way it can be considered "safe" to install custom IOS modules, or to patch any IOS module so long as it is not used by the system menu, as if it becomes corrupt it can be deleted and replaced without damaging the system as a whole. | + | All software using the Wii SDK or libogc relies on a running IOS on the Starlet (with a few exceptions in the latter case - it is possible to shut down IOS services from libogc and work without it). Typically, the only times IOS is not in use is when running GameCube software (which uses [[MIOS]] instead - effectively a dummy IOS), or when [[BootMii]] and related software is in use (which uses [mini] instead). |
| | | |
− | It should be noted that the IOS does not act as a hypervisor, the "Home" menu you see when you press the Home button is part of the game, it is not provided by the running IOS or the System Menu. To put it simply, the game does not run "on top of" the system menu. When a game is launched the system menu is closed and the game is started, and when the game calls to return to the system menu, the game closes and the system menu is restarted. There can only be one IOS running at a time.
| + | IOS is versioned in a somewhat unique way. Instead of there being a single canonical version of IOS, there are multiple branches, each typically corresponding to one or more versions of the Wii SDK. Each branch is apparently specified to have a completely frozen API, and old versions are only updated to patch bugs (often security bugs) - Nintendo at one point created an entirely new IOS branch that differed only in the default value for the TCP buffer size. A fully updated Wii contains one copy of the latest version of each branch of IOS. On a Wii, these are installed as separate titles, often called "IOS slots". Due to this design, it is generally considered safe to uninstall, reinstall, or patch an IOS or IOS module, as long as it is not the slot used by the System Menu - if anything goes wrong, the broken version can be safely uninstalled and a vanilla copy reinstalled. IOS slots have title IDs 1-3 through 1-255. Unused (high) IOS slots are often used to install patched versions of IOS or alternative Starlet software (e.g. [[BootMii]] as IOS is installed as IOS254, which when invoked will subsequently load armboot.bin from the SD card, typically [[mini]]). See [[IOS History]] for a comprehensive list of IOS slots and versions. |
| | | |
− | The only time an IOS is not running is during GameCube mode (during which time [[MIOS]] is running instead), or when [[BootMii]] is running (during which time [[mini]] is running instead).
| + | IOS is not a "hypervisor", as it runs on a dedicated, separate CPU. However, IOS does isolate its memory from access by the main [[Hardware/Broadway|Broadway]] CPU, has the ability to reboot (and hence bootstrap) it, and is designed to be secure if the PowerPC side is compromised (although in practice many exploits have been found). In that sense, IOS is higher in the security hierarchy than code running on the PowerPC. |
| + | |
| + | Since the IOS API is largely forwards-compatible, it is often possible (though not recommended) to run official software with an alternate IOS branch or slot. Homebrew software will often run under a relatively large range of IOS versions, sometimes constrained by requiring newer features (e.g. USB EHCI support). |
| | | |
| == See Also == | | == See Also == |
Line 18: |
Line 20: |
| *[[IOS/resource request|Resource request]] | | *[[IOS/resource request|Resource request]] |
| | | |
− | == IPC == | + | == Architecture == |
| + | IOS is a Nintendo-proprietary, embedded operating system. It uses a microkernel architecture, where independent processes communicate using a standard file API (open/read/write/seek/ioctl/ioctlv/close) on resources identified by /dev/ entries in a virtual filesystem hierarchy. Real filesystems (chiefly the NAND filesystem) are also mounted this way (the NAND driver registers itself as the fallback handler for the root node, /). |
| + | |
| + | === Kernel === |
| + | The kernel is the piece of code that is launched first; it consists of a small ELF-loader header followed by the ELF executable of the kernel proper. In addition to the core microkernel and the cryptography core, it contains the bare minimum set of processes/drivers necessary to load the rest of the modules from the NAND filesystem: FFS (Flash Filesystem), ES (E-Ticket Services), and IOSP (responsible for booting and managing the Broadway and its IPC interface). Older IOS versions were monolithic and contained all modules inside the single main ELF kernel. [[boot2]] is essentially a standalone IOS kernel with no additional modules or drivers, whose sole purpose is to launch the System Menu (and, as part of that process, load the IOS slot that it requires). |
| + | |
| + | === IPC === |
| | | |
| Communication with IOS from PPC code is done using an IPC mechanism. There are 7 calls that can be made using this system: | | Communication with IOS from PPC code is done using an IPC mechanism. There are 7 calls that can be made using this system: |
Line 76: |
Line 84: |
| Most non-trivial operations are performed by opening one of the below resources, then calling ioctl or ioctlv on it. | | Most non-trivial operations are performed by opening one of the below resources, then calling ioctl or ioctlv on it. |
| | | |
− | The Starlet kernel hands these calls over to the individual drivers / processes within the Starlet. The processes register themselves to handle requests by creating one or more queues and assigning them to handle requests from a particular /dev device. | + | The Starlet kernel hands these calls over to the individual drivers / processes within the Starlet. The processes register themselves to handle requests by creating one or more queues and assigning them to handle requests from a particular /dev device. The IPC interface is essentially identical to the internal microkernel inter-process communication system calls, and indeed maps directly: PPC requests are marshalled by IOSP and appear to come from its process ID to other IOS modules. Oversights in checking whether a request comes from another IOS module or the PowerPC have resulted in several exploitable bugs. |
| | | |
− | == IOS Modules == | + | === Modules === |
− | IOS is a Nintendo-proprietary, embedded operating system. It uses a microkernel architecture, with several independent modules that talk to each other via "resources", which are organized as entries in the /dev tree. | + | IOS modules are ELF executables contained in separate title content entries within an IOS title. Modules roughly map to processes and drivers inside the kernel. |
| | | |
− | === Kernel === | + | ==== FFS ==== |
− | The Kernel is the piece of code that is actually booted; it contains a small ELF-loader header at the beginning, and then is an ELF file. In addition to the core microkernel stuff, it contains the bare minimum drivers necessary to read the rest of the drivers from the NAND filesystem -- specifically, FFS (Flash Filesystem), ES (E-Ticket Services), and IOSP (Responsible for booting and managing Broadway?).
| + | Flash Filesystem |
| | | |
− | ==== FFS ====
| |
| * [[:/dev/boot2]] | | * [[:/dev/boot2]] |
| * [[:/dev/flash]] | | * [[:/dev/flash]] |
Line 90: |
Line 97: |
| | | |
| ==== ES ==== | | ==== ES ==== |
| + | ETicket Services (title installation/uninstallation and security) |
| + | |
| * [[:/dev/aes]] | | * [[:/dev/aes]] |
| * [[:/dev/es]] | | * [[:/dev/es]] |
Line 95: |
Line 104: |
| * [[:/dev/sha]] | | * [[:/dev/sha]] |
| | | |
− | === DIP === | + | ==== DIP ==== |
| + | Disc Interface (optical drive I/O, including partition management and hashtree checks) |
| + | |
| * [[:/dev/di]] | | * [[:/dev/di]] |
| | | |
− | === ETH === | + | ==== ETH ==== |
| + | USB-Ethernet driver |
| + | |
| * [[:/dev/net/usbeth/top]] | | * [[:/dev/net/usbeth/top]] |
| | | |
− | === KBD === | + | ==== KBD ==== |
| + | USB Keyboard driver |
| + | |
| * [[:/dev/usb/kbd]] | | * [[:/dev/usb/kbd]] |
| | | |
− | === KD === | + | ==== KD ==== |
| + | WiiConnect24 |
| + | |
| * [[:/dev/net/kd/request]] | | * [[:/dev/net/kd/request]] |
| * [[:/dev/net/kd/time]] | | * [[:/dev/net/kd/time]] |
| | | |
− | === NCD === | + | ==== NCD ==== |
| + | Network interface management |
| + | |
| * [[:/dev/net/ncd/manage]] | | * [[:/dev/net/ncd/manage]] |
| * [[:/dev/net/wd/top]] (Yes, this is actually created by NCD, not WD) | | * [[:/dev/net/wd/top]] (Yes, this is actually created by NCD, not WD) |
| | | |
− | === OH0/1 === | + | ==== OH0/1 ==== |
| + | USB OHCI (1.1) driver |
| + | |
| * [[:/dev/usb/ehc]] | | * [[:/dev/usb/ehc]] |
| * [[:/dev/usb]] | | * [[:/dev/usb]] |
Line 118: |
Line 139: |
| * [[:/dev/usb/oh1]] | | * [[:/dev/usb/oh1]] |
| | | |
− | === SDI === | + | ==== SDI ==== |
| + | SDHCI (SD card host) driver |
| + | |
| * [[:/dev/sdio/slot0]] | | * [[:/dev/sdio/slot0]] |
| * [[:/dev/sdio/slot1]] | | * [[:/dev/sdio/slot1]] |
| | | |
− | === SO === | + | ==== SO ==== |
| + | TCP/IP stack (sockets) |
| + | |
| * [[:/dev/net/ip/top]] - TCP/IP [[Socket]] operations | | * [[:/dev/net/ip/top]] - TCP/IP [[Socket]] operations |
| * [[:/dev/net/ip/bottom]] | | * [[:/dev/net/ip/bottom]] |
Line 128: |
Line 153: |
| * Opens [[:/dev/net/usbeth/top]] | | * Opens [[:/dev/net/usbeth/top]] |
| | | |
− | === SSL === | + | ==== SSL ==== |
| + | SSL sockets |
| + | |
| * [[:/dev/net/ssl]] | | * [[:/dev/net/ssl]] |
| | | |
− | === STM === | + | ==== STM ==== |
| + | Power and LED/etc management (State Transition Manager?) |
| + | |
| * [[:/dev/stm/eventhook]] | | * [[:/dev/stm/eventhook]] |
| * [[:/dev/stm/immediate]] | | * [[:/dev/stm/immediate]] |
| | | |
− | === WD === | + | ==== WD ==== |
| + | High-level WLAN driver (includes Nintendo DS comms) |
| + | |
| * [[:/dev/net/wd/command]] | | * [[:/dev/net/wd/command]] |
| * [[:/dev/listen]] ("Indication RM") | | * [[:/dev/listen]] ("Indication RM") |
Line 141: |
Line 172: |
| * Opens [[:/dev/stm/immediate]] | | * Opens [[:/dev/stm/immediate]] |
| | | |
− | === WL === | + | ==== WL ==== |
| + | Low-level WLAN driver |
| + | |
| * [[:/dev/wl0]] | | * [[:/dev/wl0]] |
| * Opens [[:/dev/listen]] | | * Opens [[:/dev/listen]] |
| | | |
− | ===?=== | + | ==== ? ==== |
| [[:/dev/printserver]] | | [[:/dev/printserver]] |
| | | |