kernel::utilities::arch_helpers

Function encode_syscall_return_with_variant

Source
pub fn encode_syscall_return_with_variant<SyscallVariant: Variant>(
    syscall_return: &SyscallReturn,
    a0: &mut MachineRegister,
    a1: &mut MachineRegister,
    a2: &mut MachineRegister,
    a3: &mut MachineRegister,
)
Expand description

An extension of TRD104 that works for 32-bit and 64-bit platforms, and can remap variants.

On 32-bit platforms using. Using TRD104SyscallReturnVariant on a 32-bit platform, this is exactly TRD104. Using TRD105SyscallReturnVariant on any platform should be TRD1105. Archtiectures not following either of these are free to provide their own mappings. On 64-bit platforms, both 64-bit and usize values are passed as a single register, shifting down register number if that means fewer registers are needed. For usize, there is no change in number of registers between platforms. For explicitly 64-bit arguments, this would require rewriting prototypes for userspace functions between 32 and 64 bit platforms. No usize other than 4 and 8 bytes is supported. CHERI notes: the high part of any capability register is zeroed if any non CapabilityPtr arguments are passed. SuccessPtr is as passed the full CapabilityPtr register. Pointers from allow’d buffers have minimal bounds reattached that cover their length, and the same permissions that were checked at the syscall boundary.