Line 193:
Line 193:
| 2a || int IOS_ResourceReply( [[IOS/resource request|const IOSRequest]] *request, int retval) || return from a cmd on a [[IOS|resource]]
| 2a || int IOS_ResourceReply( [[IOS/resource request|const IOSRequest]] *request, int retval) || return from a cmd on a [[IOS|resource]]
|-
|-
−
| 2b || IOSError SetUid(u32 pid, u32 uid) || Set the UID for a process (PID <= 0x13). This can only be used from the kernel or ES. || IPC_SUCCESS on success, IPC_EACCES (permission denied if current PID > 0x1) or IPC_EINVAL (invalid PID)
+
| 2b || int SetUid(u32 pid, u32 uid) || Set the UID for a process (PID <= 0x13). This can only be used from the kernel or ES. || IPC_SUCCESS on success, IPC_EACCES (permission denied if current PID > 0x1) or IPC_EINVAL (invalid PID)
|-
|-
| 2c || IOSUid GetUid(void) || Get the UID for the active process (based on the thread PID). || UID (u32)
| 2c || IOSUid GetUid(void) || Get the UID for the active process (based on the thread PID). || UID (u32)
|-
|-
−
| 2d || IOSError SetGid(u32 pid, u16 gid) || Set the GID for a process (PID <= 0x13). This can only be used from the kernel or ES. || IPC_SUCCESS on success, IPC_EACCES (permission denied if current PID > 0x1) or IPC_EINVAL (invalid PID)
+
| 2d || int SetGid(u32 pid, u16 gid) || Set the GID for a process (PID <= 0x13). This can only be used from the kernel or ES. || IPC_SUCCESS on success, IPC_EACCES (permission denied if current PID > 0x1) or IPC_EINVAL (invalid PID)
|-
|-
| 2e || IOSGid GetGid(void) || Get the GID for the active process (based on the thread PID). || GID (u16)
| 2e || IOSGid GetGid(void) || Get the GID for the active process (based on the thread PID). || GID (u16)
Line 205:
Line 205:
| 30 || syscall_ahbMemFlush_wrapper
| 30 || syscall_ahbMemFlush_wrapper
|-
|-
−
| 31 || IOSError ClearAndEnableIPCIOPIntr(void) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 31 ([[Hardware/IPC|IPC (Starlet)]]) (can only be used from the kernel or ES) || 0 on success, -4 for no permission.
+
| 31 || int ClearAndEnableIPCIOPIntr(void) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 31 ([[Hardware/IPC|IPC (Starlet)]]) (can only be used from the kernel or ES) || 0 on success, -4 for no permission.
|-
|-
−
| 32 || IOSError ClearAndEnableDIIntr(void) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 18 ([[Hardware/Drive Interface|DI]]) (can only be used from DI) || 0 on success, -4 for no permission
+
| 32 || int ClearAndEnableDIIntr(void) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 18 ([[Hardware/Drive Interface|DI]]) (can only be used from DI) || 0 on success, -4 for no permission
|-
|-
−
| 33 || IOSError ClearAndEnableSDIntr(u8 hc) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 7 ([[Hardware/SD Host Controller|SDHC]] - must be SDI) if hc==0, else device 8 ([[Hardware/802.11 Wireless|802.11 Wireless]] - must be WL) || 0 on success, -4 for no permission
+
| 33 || int ClearAndEnableSDIntr(u8 hc) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for device 7 ([[Hardware/SD Host Controller|SDHC]] - must be SDI) if hc==0, else device 8 ([[Hardware/802.11 Wireless|802.11 Wireless]] - must be WL) || 0 on success, -4 for no permission
|-
|-
−
| 34 || IOSError ClearAndEnableEvent(IOSEvent event) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for the given device, with PID requirements (this is also used to syscalls 31 through 33):
+
| 34 || int ClearAndEnableEvent(IOSEvent event) || Enables [[Hardware/Hollywood IRQs|hardware interrupts]] for the given device, with PID requirements (this is also used to syscalls 31 through 33):
{| class="wikitable"
{| class="wikitable"
! event !! PID
! event !! PID
Line 235:
Line 235:
| 0 on success, -1 for unknown IRQ (not in that table), -4 for no permission
| 0 on success, -1 for unknown IRQ (not in that table), -4 for no permission
|-
|-
−
| 35 || IOSError AccessIobPool(u32 pool) || no-op in IOS-35, arg1=0 || returns always 0
+
| 35 || int AccessIobPool(u32 pool) || no-op in IOS-35, arg1=0 || returns always 0
|-
|-
| 36 || [[IOS/IoBuffer|struct iobuf]] *alloc_iobuf(arg1, sbuf) || allocate an iobuf, arg1=0 (unknown), sbuf = buffer size || return NULL on error
| 36 || [[IOS/IoBuffer|struct iobuf]] *alloc_iobuf(arg1, sbuf) || allocate an iobuf, arg1=0 (unknown), sbuf = buffer size || return NULL on error
Line 261:
Line 261:
| 41 || ppc_boot(const char *path) || Loads a .dol or .elf file into memory and bootstraps the PPC
| 41 || ppc_boot(const char *path) || Loads a .dol or .elf file into memory and bootstraps the PPC
|-
|-
−
| 42 || <nowiki>[[noreturn]]</nowiki> IOSError ios_boot(const char* path, bool suspendBroadway, u32 version) || Suspends the IPC thread, loads a new IOS kernel from the NAND to 0x10100000 in IOS59), then calls <code>boot_new_ios_kernel(0x10100000, version)</code>. This can only be called from UID 0. || Doesn't return if the boot succeeded; otherwise, an error code is returned.
+
| 42 || <nowiki>[[noreturn]]</nowiki> int ios_boot(const char* path, bool suspendBroadway, u32 version) || Suspends the IPC thread, loads a new IOS kernel from the NAND to 0x10100000 in IOS59), then calls <code>boot_new_ios_kernel(0x10100000, version)</code>. This can only be called from UID 0. || Doesn't return if the boot succeeded; otherwise, an error code is returned.
|-
|-
−
| 43 || <nowiki>[[noreturn]]</nowiki> IOSError boot_new_ios_kernel(void* ios_binary_address, u32 new_version) || Sets the version at 0x3140 to <code>new_version</code> and the IPC buffer range ("DDR settings") to the legacy range ("12M"), before branching to the new kernel. This can only be called from UID 0. || -
+
| 43 || <nowiki>[[noreturn]]</nowiki> int boot_new_ios_kernel(void* ios_binary_address, u32 new_version) || Sets the version at 0x3140 to <code>new_version</code> and the IPC buffer range ("DDR settings") to the legacy range ("12M"), before branching to the new kernel. This can only be called from UID 0. || -
|-
|-
| 44 || int assert_di_reset() || Clears bit 10 (DI) of [[Hardware/Hollywood_Registers#HW_RESETS|HW_RESETS]] (can only be called from DI) || Returns 0 on success, -1 on error
| 44 || int assert_di_reset() || Clears bit 10 (DI) of [[Hardware/Hollywood_Registers#HW_RESETS|HW_RESETS]] (can only be called from DI) || Returns 0 on success, -1 on error
Line 283:
Line 283:
| 4b || void kernel_debug_print(u32 flags) || Prints various debug info (depending on flags) from the kernel ||
| 4b || void kernel_debug_print(u32 flags) || Prints various debug info (depending on flags) from the kernel ||
|-
|-
−
| 4c || IOSError SetLoMemOSVersion(u32 version) || Stores version to 0x3140 (can only be called by ES) || 0 on success
+
| 4c || int SetLoMemOSVersion(u32 version) || Stores version to 0x3140 (can only be called by ES) || 0 on success
|-
|-
| 4d || u32 GetLoMemOSVersion(void) || Returns the current IOS version from 0x3140 (can only be called by ES) || IOS version or 0 on error
| 4d || u32 GetLoMemOSVersion(void) || Returns the current IOS version from 0x3140 (can only be called by ES) || IOS version or 0 on error
|-
|-
−
| 4e || IOSError SetDiSpinup(u32 s) || Sets or clears the DI_SPIN [[Hardware/Hollywood GPIOs|GPIO]]; if enable is 0 then the flag is set (disabling spinup); it is cleared otherwise. (Can only be called by DI) || 0 on success, -1 on error
+
| 4e || int SetDiSpinup(u32 s) || Sets or clears the DI_SPIN [[Hardware/Hollywood GPIOs|GPIO]]; if enable is 0 then the flag is set (disabling spinup); it is cleared otherwise. (Can only be called by DI) || 0 on success, -1 on error
|-
|-
| 4f || void *VirtualToPhysical(void *virt) || Converts a virtual pointer to its physical equivalent
| 4f || void *VirtualToPhysical(void *virt) || Converts a virtual pointer to its physical equivalent
|-
|-
−
| 50 || IOSError SetDvdReadDisable(u8 disable) || Enable/Disable DI DVD Video commands (can only be called from DI) || 0 on success, -1 on error
+
| 50 || int SetDvdReadDisable(u8 disable) || Enable/Disable DI DVD Video commands (can only be called from DI) || 0 on success, -1 on error
|-
|-
| 51 || u32 GetDvdReadDisable(void) || Return status of DI DVD Video commands (can only be called from DI) || 1 if disabled, 0 if enabled or error
| 51 || u32 GetDvdReadDisable(void) || Return status of DI DVD Video commands (can only be called from DI) || 1 if disabled, 0 if enabled or error
|-
|-
−
| 52 || IOSError SetEnableAHBPI2DI(u8 enable) || Sets bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]], clearing it if value is 0 and setting it otherwise. DI only seems to call it with false{{check}}. (Can only be called from DI)
+
| 52 || int SetEnableAHBPI2DI(u8 enable) || Sets bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]], clearing it if value is 0 and setting it otherwise. DI only seems to call it with false{{check}}. (Can only be called from DI)
| 0 on success, -1 on error
| 0 on success, -1 on error
|-
|-
| 53 || u8 GetEnableAHBPI2DI(void) || Checks bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]] (can only be called from DI) || 1 if bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]] is set, 0 if not set or error
| 53 || u8 GetEnableAHBPI2DI(void) || Checks bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]] (can only be called from DI) || 1 if bit 4 of [[Hardware/Hollywood_Registers#HW_AIPPROT|HW_AIPPROT]] is set, 0 if not set or error
|-
|-
−
| 54 || IOSError SetPPCACRPerms(u8 enable) || Enable/Disable PPC AHBPROT setting (can only be called from ES) || 0 on success, -1 on error
+
| 54 || int SetPPCACRPerms(u8 enable) || Enable/Disable PPC AHBPROT setting (can only be called from ES) || 0 on success, -1 on error
|-
|-
| 55 || u32 GetBusSpeed(void) || Returns the bus speed in megahertz: 162 in GC mode (if the bottom bit of [[Hardware/Hollywood_Registers#HW_CLOCKS|HW_CLOCKS]]), and 243 in Wii mode typically, though the Wii value can vary based on [[Hardware/Hollywood_Registers#HW_PLLSYS|HW_PLLSYS]] and [[Hardware/Hollywood_Registers#HW_PLLSYSEXT|HW_PLLSYSEXT]].
| 55 || u32 GetBusSpeed(void) || Returns the bus speed in megahertz: 162 in GC mode (if the bottom bit of [[Hardware/Hollywood_Registers#HW_CLOCKS|HW_CLOCKS]]), and 243 in Wii mode typically, though the Wii value can vary based on [[Hardware/Hollywood_Registers#HW_PLLSYS|HW_PLLSYS]] and [[Hardware/Hollywood_Registers#HW_PLLSYSEXT|HW_PLLSYSEXT]].
|-
|-
−
| 56 || IOSError ACRRegWrite(u32 offset, u32 value) || Set gpio reg to value (can only be called from STM) || 0 on success, -1 on error
+
| 56 || int ACRRegWrite(u32 offset, u32 value) || Set gpio reg to value (can only be called from STM) || 0 on success, -1 on error
|-
|-
−
| 57 || IOSError DDRRegWrite(u32 offset, u32 value) || Writes a 32-bit value to the specified Memory Controller register. Can only be called from the STM module. || Returns 0 on success, -1 on error.
+
| 57 || int DDRRegWrite(u32 offset, u32 value) || Writes a 32-bit value to the specified Memory Controller register. Can only be called from the STM module. || Returns 0 on success, -1 on error.
|-
|-
| 58 || void OutputDebugPort(u8 value) || Set [[Hardware/Hollywood GPIOs|GPIO]] lines 16-23 (DEBUG0-7, the [[debug port]]) to the provided value.
| 58 || void OutputDebugPort(u8 value) || Set [[Hardware/Hollywood GPIOs|GPIO]] lines 16-23 (DEBUG0-7, the [[debug port]]) to the provided value.
|-
|-
−
| 59 || IOSError SetIpcAccessRights(u8 *rights) || Related to PPC IPC. Can only be called from the ES module. Called when bootstrapping PPC. || 0 on success, negative for error.
+
| 59 || int SetIpcAccessRights(u8 *rights) || Related to PPC IPC. Can only be called from the ES module. Called when bootstrapping PPC. || 0 on success, negative for error.
|-
|-
−
| 5a || IOSError LaunchRM(const char *path) || Load an ARM ELF [IOS module] and start a new thread. || 0 on success, negative for error
+
| 5a || int LaunchRM(const char *path) || Load an ARM ELF [IOS module] and start a new thread. || 0 on success, negative for error
|-
|-
| 5b || IOSCError IOSC_CreateObject(u32* key_handle, IOSCObjectType type, IOSCObjectSubType subtype); || Create a new keyring entry. <code>key_handle</code> is updated with a key handle to use with other IOSC calls. || 0 on success, negative for error
| 5b || IOSCError IOSC_CreateObject(u32* key_handle, IOSCObjectType type, IOSCObjectSubType subtype); || Create a new keyring entry. <code>key_handle</code> is updated with a key handle to use with other IOSC calls. || 0 on success, negative for error