Skip to content

Instantly share code, notes, and snippets.

@devbug
Created July 3, 2015 18:00
Show Gist options
  • Save devbug/77f57a46c714aa456299 to your computer and use it in GitHub Desktop.
Save devbug/77f57a46c714aa456299 to your computer and use it in GitHub Desktop.
iOS sysent structures
typedef int32_t sy_call_t(struct extern_proc *, void *, int *);
typedef void sy_munge_t(const void *, void *);
//https://github.com/de7ec7ed/vertigo_applications/blob/493e4c6472fea33432d8f8c3a6819119e26c16f8/ios/krnldr/inc/kern.h
struct sysent50 { // system call table
int16_t sy_narg; // number of args
int8_t sy_resv; // reserved
int8_t sy_flags; // flags
sy_call_t *sy_call; // implementing function
sy_munge_t *sy_arg_munge32; // system call arguments munger for 32-bit process
sy_munge_t *sy_arg_munge64; // system call arguments munger for 64-bit process
int32_t sy_return_type; // system call return types
uint16_t sy_arg_bytes; // total size of arguments in bytes for 32-bit system calls
};
struct sysent60 { /* system call table */
sy_call_t *sy_call; /* implementing function */
sy_munge_t *sy_arg_munge32; /* system call arguments munger for 32-bit process */
sy_munge_t *sy_arg_munge64; /* system call arguments munger for 64-bit process */
int32_t sy_return_type; /* system call return types */
uint16_t sy_arg_bytes; /* Total size of arguments in bytes for
* 32-bit system calls
*/
uint16_t unknown;
int16_t sy_narg; /* number of args */
int8_t sy_resv; /* reserved */
int8_t sy_flags; /* flags */
};
//https://github.com/opensource-apple/xnu/blob/10.9/bsd/sys/sysent.h#L41
struct sysent70 { /* system call table */
sy_call_t *sy_call; /* implementing function */
sy_munge_t *sy_arg_munge32; /* system call arguments munger for 32-bit process */
sy_munge_t *sy_arg_munge64; /* system call arguments munger for 64-bit process */
int32_t sy_return_type; /* system call return types */
int16_t sy_narg; /* number of args */
uint16_t sy_arg_bytes; /* Total size of arguments in bytes for
* 32-bit system calls
*/
};
//https://github.com/opensource-apple/xnu/blob/10.10/bsd/sys/sysent.h#L43
struct sysent80 { /* system call table */
sy_call_t *sy_call; /* implementing function */
#if CONFIG_REQUIRES_U32_MUNGING // default is off.
sy_munge_t *sy_arg_munge32; /* system call arguments munger for 32-bit process */
#endif
int32_t sy_return_type; /* system call return types */
int16_t sy_narg; /* number of args */
uint16_t sy_arg_bytes; /* Total size of arguments in bytes for
* 32-bit system calls
*/
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment