Module rustix::backend::reg

source Β·
Expand description

Encapsulation for system call arguments and return values.

The inline-asm code paths do some amount of reordering of arguments; to ensure that we don’t accidentally misroute an argument or return value, we use distinct types for each argument index and return value.

Β§Safety

The ToAsm and FromAsm traits are unsafe to use; they should only be used by the syscall code which executes actual syscall machine instructions.

Modules§

  • private πŸ”’
    Seal our various traits using the technique documented here.

Structs§

  • A0 πŸ”’
  • A1 πŸ”’
  • A2 πŸ”’
  • A3 πŸ”’
  • A4 πŸ”’
  • A5 πŸ”’
  • ArgReg πŸ”’
    Syscall arguments use register-sized types. We use a newtype to discourage accidental misuse of the raw integer values.
  • Opaque πŸ”’
    To preserve provenance, syscall arguments and return values are passed as pointer types. They need a type to point to, so we define a custom private type, to prevent it from being used for anything else.
  • R0 πŸ”’
  • RetReg πŸ”’
    Syscall return values use register-sized types. We use a newtype to discourage accidental misuse of the raw integer values.
  • SyscallNumber πŸ”’

Traits§

Functions§

  • nr πŸ”’
    Encode a system call number (a __NR_* constant) as a SyscallNumber.
  • raw_arg πŸ”’
    Encode a system call argument as an ArgReg.