Line 111:
Line 111:
| 3 || int IOS_GetThreadId() || Get the current thread's ID || Current threadid
| 3 || int IOS_GetThreadId() || Get the current thread's ID || Current threadid
|-
|-
β
| 4 || int GetPid() || Get the current process's ID || Current processid
+
| 4 || int GetProcessId() || Get the current process's ID || Current processid
|-
|-
| 5 || int IOS_StartThread(int threadid) || Resume the specified thread || 0 on success
| 5 || int IOS_StartThread(int threadid) || Resume the specified thread || 0 on success
Line 129:
Line 129:
| c || int IOS_SendMessage(int queueid, u32 message, u32 flags) || Add a message to the end queue || 0 on success
| c || int IOS_SendMessage(int queueid, u32 message, u32 flags) || Add a message to the end queue || 0 on success
|-
|-
β
| d || int SendMessageNow(int queueid, u32 message, u32 flags) || Add a message to the front of a queue || 0 on success
+
| d || int IOS_JamMessage(int queueid, u32 message, u32 flags) || Add a message to the front of a queue || 0 on success
|-
|-
| e || int IOS_ReceiveMessage(int queueid, u32 *message, u32 flags) || Fetch a message from the front of a queue || 0 on success
| e || int IOS_ReceiveMessage(int queueid, u32 *message, u32 flags) || Fetch a message from the front of a queue || 0 on success
Line 149:
Line 149:
| 16 || int IOS_CreateHeap(void *ptr, int size) || Create a new heap at ptr of size bytes || heapid or error (negative value)
| 16 || int IOS_CreateHeap(void *ptr, int size) || Create a new heap at ptr of size bytes || heapid or error (negative value)
|-
|-
β
| 17 || int heap_destroy(int heapid) || Destroy the specified heap || 0 on success
+
| 17 || int IOS_DestroyHeap(int heapid) || Destroy the specified heap || 0 on success
|-
|-
| 18 || void* IOS_Alloc(int heapid, u32 size) || Allocate size bytes from the specified heap || pointer to memory
| 18 || void* IOS_Alloc(int heapid, u32 size) || Allocate size bytes from the specified heap || pointer to memory
Line 173:
Line 173:
| 22 || int IOS_Ioctlv(int fd, u32 request, u32 vector_count_in, u32 vector_count_out, [[IOS/struct iovec|struct iovec]] *vector) || Perform the requested IOCTL || Return value from IOCTL
| 22 || int IOS_Ioctlv(int fd, u32 request, u32 vector_count_in, u32 vector_count_out, [[IOS/struct iovec|struct iovec]] *vector) || Perform the requested IOCTL || Return value from IOCTL
|-
|-
β
| 23 || int IOS_OpenAsync(const char* device, int mode, int queueid, ipcmessage *message) || Async implementation of IOS_Open || 0 on success, ipcmessage is sent to the queue with the command's return value
+
| 23 || int IOS_OpenAsync(const char* device, int mode, int queueid, IOSRequest *message) || Async implementation of IOS_Open || 0 on success, ipcmessage is sent to the queue with the command's return value
|-
|-
β
| 24 || int IOS_CloseAsync(int fd, int queueid, ipcmessage *message) || Async implementation of IOS_Close || 0 on success
+
| 24 || int IOS_CloseAsync(int fd, int queueid, IOSRequest *message) || Async implementation of IOS_Close || 0 on success
|-
|-
β
| 25 || int IOS_ReadAsync(int fd, void *buf, u32 len, int queueid, ipcmessage *message) || Async implementation of IOS_Read
+
| 25 || int IOS_ReadAsync(int fd, void *buf, u32 len, int queueid, IOSRequest *message) || Async implementation of IOS_Read
|-
|-
β
| 26 || int IOS_WriteAsync(int fd, const void *buf, u32 len, int queueid, ipcmessage *message) || Async implementation of IOS_Write
+
| 26 || int IOS_WriteAsync(int fd, const void *buf, u32 len, int queueid, IOSRequest *message) || Async implementation of IOS_Write
|-
|-
β
| 27 || int IOS_SeekAsync(int fd, int offset int origin, int queueid, ipcmessage *message) || Async implementation of IOS_Seek
+
| 27 || int IOS_SeekAsync(int fd, int offset int origin, int queueid, IOSRequest *message) || Async implementation of IOS_Seek
|-
|-
β
| 28 || int IOS_IoctlAsync(int fd, u32 request, void *input_buffer, u32 input_buffer_len, void *output_buffer, u32 output_buffer_len, int queueid, ipcmessage *message) || Async implementation of IOS_Ioctl
+
| 28 || int IOS_IoctlAsync(int fd, u32 request, void *input_buffer, u32 input_buffer_len, void *output_buffer, u32 output_buffer_len, int queueid, IOSRequest *message) || Async implementation of IOS_Ioctl
|-
|-
β
| 29 || int IOS_IoctlvAsync(int fd, u32 request, u32 vector_count_in, u32 vector_count_out, [[IOS/struct iovec|struct iovec]] *vector, int queueid, ipcmessage *message) || Async implementation of IOS_Ioctlv
+
| 29 || int IOS_IoctlvAsync(int fd, u32 request, u32 vector_count_in, u32 vector_count_out, [[IOS/struct iovec|struct iovec]] *vector, int queueid, IOSRequest *message) || Async implementation of IOS_Ioctlv
|-
|-
β
| 2a || void IOS_ResourceReply( [[IOS/resource request|const struct ios_resource_request]] *request, int retval) || return from a cmd on a [[IOS|resource]]
+
| 2a || void 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 || 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)
Line 197:
Line 197:
| 2e || u16 GetGid() || Get the GID for the active process (based on the thread PID). || GID (u16)
| 2e || u16 GetGid() || Get the GID for the active process (based on the thread PID). || GID (u16)
|-
|-
β
| 2f || cc_ahbMemFlush
+
| 2f || int ahbMemFlush(int ahb_dev)
|-
|-
| 30 || syscall_ahbMemFlush_wrapper
| 30 || syscall_ahbMemFlush_wrapper
Line 229:
Line 229:
| 3e || syscall_3e
| 3e || syscall_3e
|-
|-
β
| 3f || void sync_before_read(void *address, u32 size) || Invalidates dcache, and something (probably related to flushing memory)
+
| 3f || void IOS_InvalidateDCache(void *address, u32 size) || "sync_before_read" - Invalidates dcache, and something (probably related to flushing memory)
|-
|-
β
| 40 || void sync_after_write(const void *address, u32 size) || Flushes dcache and does magic bullshit (aka magic AHB operations)
+
| 40 || void IOS_FlushDCache(const void *address, u32 size) || "sync_after_write" - Flushes dcache and does magic bullshit (aka magic AHB operations)
|-
|-
| 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
Line 237:
Line 237:
| 42 || <nowiki>[[noreturn]]</nowiki> IOSError ios_boot(const char* path, u32 flag, 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> IOSError ios_boot(const char* path, u32 flag, 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> void 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 jumping to the new kernel. This can only be called from UID 0. || -
+
| 43 || <nowiki>[[noreturn]]</nowiki> void 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 syscall_assert_di_reset || Clears bit 10 of 0xD800194 || Returns 0 on success, -1 on error
| 44 || int syscall_assert_di_reset || Clears bit 10 of 0xD800194 || Returns 0 on success, -1 on error
Line 318:
Line 318:
| 5d || IOSCError IOSC_ImportSecretKey(IOSCSecretKeyHandle importedHandle, IOSCSecretKeyHandle verifyHandle, IOSCSecretKeyHandle decryptHandle, IOSCSecretKeySecurity flag, u8 * signbuffer, u8 * ivData, u8 * keybuffer); || Sets the contents of a key || 0 on success, negative for error
| 5d || IOSCError IOSC_ImportSecretKey(IOSCSecretKeyHandle importedHandle, IOSCSecretKeyHandle verifyHandle, IOSCSecretKeyHandle decryptHandle, IOSCSecretKeySecurity flag, u8 * signbuffer, u8 * ivData, u8 * keybuffer); || Sets the contents of a key || 0 on success, negative for error
|-
|-
β
| 5e || keyring_deallocate_entry(int index) || || 0 on success, negative for error
+
| 5e || IOSCError IOSC_ExportSecretKey(IOSCSecretKeyHandle exportedHandle, IOSCSecretKeyHandle signHandle, IOSCSecretKeyHandle encryptHandle, IOSCSecretKeySecurity security_flag, u8 * signbuffer, u8 * ivData, u8 * keybuffer); || || 0 on success, negative for error
|-
|-
| 5f || IOSCError IOSC_ImportPublicKey(u8 * publicKeyData, u8 * exponent, IOSCPublicKeyHandle publicKeyHandle); || Sets the contents of a signature. data length should match the signature type, user_data is optional 4 bytes that can be attached || 0 on success, negative for error
| 5f || IOSCError IOSC_ImportPublicKey(u8 * publicKeyData, u8 * exponent, IOSCPublicKeyHandle publicKeyHandle); || Sets the contents of a signature. data length should match the signature type, user_data is optional 4 bytes that can be attached || 0 on success, negative for error
Line 332:
Line 332:
| 64 || IOSCError IOSC_GetKeySize(u32 * keySize, IOSCKeyHandle handle);|| Return the key's size in size[0] || 0 on success, negative for error
| 64 || IOSCError IOSC_GetKeySize(u32 * keySize, IOSCKeyHandle handle);|| Return the key's size in size[0] || 0 on success, negative for error
|-
|-
β
| 65 || int get_key_userdata_size(int keyid, u32 *size) || Return the key's userdata size in size[0] || 0 on success, negative for error
+
| 65 || IOSCError IOSC_GetSignatureSize(u32 * signSize, int handle); || Return the key's userdata size in size[0] || 0 on success, negative for error
|-
|-
β
| 66 || int IOSC_GenerateHashAsync(void *SHACarry, const void *data, u32 length, u32 SHAMode, void *hash, int queueid, ipcmessage *message) || Calculate SHA1 hash of data, send message to queueid with result || 0 on success
+
| 66 || int IOSC_GenerateHashAsync(u8 * context, u8 * inputData, u32 inputSize, u32 chainingFlag, u8 * hashData, int message_queue_id, IOSRequest* reply); || Calculate SHA1 hash of data, send message to queueid with result || 0 on success
|-
|-
| 67 || IOSCError IOSC_GenerateHash(u8 * context, u8 * inputData, u32 inputSize, u32 chainingFlag, u8 * hashData); || Synchronous implementation of IOSC_GenerateHashAsync || 0 on success
| 67 || IOSCError IOSC_GenerateHash(u8 * context, u8 * inputData, u32 inputSize, u32 chainingFlag, u8 * hashData); || Synchronous implementation of IOSC_GenerateHashAsync || 0 on success
|-
|-
β
| 68 || int IOSC_EncryptAsync(int keyid, void *iv, const void *in, int len, void *out, int queueid, ipcmessage *message) || AES-encrypt len bytes from in using keyid and iv (which gets updated) and write to out. Send message to queueid with result || 0 on success
+
| 68 || int IOSC_EncryptAsync(IOSCSecretKeyHandle encryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData, int message_queue_id, IOSRequest* reply) || AES-encrypt len bytes from in using keyid and iv (which gets updated) and write to out. Send message to queueid with result || 0 on success
|-
|-
| 69 || IOSCError IOSC_Encrypt(IOSCSecretKeyHandle encryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData); || Synchronous implementation of IOSC_EncryptAsync || 0 on success
| 69 || IOSCError IOSC_Encrypt(IOSCSecretKeyHandle encryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData); || Synchronous implementation of IOSC_EncryptAsync || 0 on success
|-
|-
β
| 6a || int IOSC_DecryptAsync(int keyid, void *iv, const void *in, int len, void *out, int queueid, ipcmessage *message) || AES-decrypt len bytes from in using keyid and iv (which gets updated) and write to out. Send message to queueid with result || 0 on success
+
| 6a || int IOSC_DecryptAsync((IOSCSecretKeyHandle decryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData, int message_queue_id, IOSRequest* request); || AES-decrypt len bytes from in using keyid and iv (which gets updated) and write to out. Send message to queueid with result || 0 on success
|-
|-
| 6b || IOSCError IOSC_Decrypt(IOSCSecretKeyHandle decryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData); || Synchronous implementation of IOSC_DecryptAsync || 0 on success
| 6b || IOSCError IOSC_Decrypt(IOSCSecretKeyHandle decryptHandle, u8 * ivData, u8 * inputData, u32 inputSize, u8 * outputData); || Synchronous implementation of IOSC_DecryptAsync || 0 on success
Line 350:
Line 350:
| 6d || IOSCError IOSC_GenerateBlockMAC(u8 * context, u8 * inputData, u32 inputSize, u8 * customData, u32 customDataSize, IOSCSecretKeyHandle signerHandle, u32 chainingFlag, u8 * signData); || || 0 on success
| 6d || IOSCError IOSC_GenerateBlockMAC(u8 * context, u8 * inputData, u32 inputSize, u8 * customData, u32 customDataSize, IOSCSecretKeyHandle signerHandle, u32 chainingFlag, u8 * signData); || || 0 on success
|-
|-
β
| 6e || int hmac_async || Async version of IOSC_GenerateBlockMAC || 0 on success
+
| 6e || IOSCError IOSC_GenerateBlockMACAsync(u8 * context, u8 * inputData, u32 inputSize, u8 * customData, u32 customDataSize, IOSCSecretKeyHandle signerHandle, u32 chainingFlag, u8 * signData, int message_queue_id, IOSRequest* reply); || Async version of IOSC_GenerateBlockMAC || 0 on success
|-
|-
| 6f || IOSCError IOSC_ImportCertificate(u8 * certData, IOSCPublicKeyHandle signerHandle, IOSCPublicKeyHandle publicKeyHandle); || || 0 on success
| 6f || IOSCError IOSC_ImportCertificate(u8 * certData, IOSCPublicKeyHandle signerHandle, IOSCPublicKeyHandle publicKeyHandle); || || 0 on success
Line 368:
Line 368:
| 76 || IOSCError IOSC_GenerateCertificate(IOSCSecretKeyHandle privateHandle, IOSCCertName certname, IOSCEccSignedCert * certificate); || || 0 on success
| 76 || IOSCError IOSC_GenerateCertificate(IOSCSecretKeyHandle privateHandle, IOSCCertName certname, IOSCEccSignedCert * certificate); || || 0 on success
|-
|-
β
| 77 || syscall_77 || can only be called from DI || 0 on success, negative on error
+
| 77 || IOSCError IOSC_CheckDiHashes(u8 * destAddr, u8 * diskRdBuf, u32 h1Index, u32 h2Index, u8 * h3Ptr); || can only be called from DI || 0 on success, negative on error
|-
|-
| 78 || syscall_78 || can only be called from ES || 0 on success, negative on error
| 78 || syscall_78 || can only be called from ES || 0 on success, negative on error