Path: blob/main/stand/kboot/libkboot/arch/powerpc64/host_syscall.S
34889 views
#include <machine/asm.h>12/*3* Emulate the Linux system call interface. The system call number is set in4* %r0, and %r3 -> %r8 have the 6 system call arguments. errno is returned5* as a negative value, but we use it more as a flag something went wrong6* rather than using its value.7*8* Return value in %r3. If it is positive or < -4096, it's a successful9* system call. If it is between -1 and -4095 then it's an failed system10* call with -x as the errno. Errors from the kernel are signaled via the11* the 'so' bit, but we don't test that here at all. There are at most 612* arguments to system calls in Linux.13*14* We expose the raw system call result, rather than do the POSIX15* conversion to -1 and setting errno.16*17* Note: The code this replaced used bso to set %r3 to 0 for the read and18* open system calls for reasons that are still under investigation.19*/20ENTRY(host_syscall)21mr %r0, %r3 /* SYS_ number in $r0 */22mr %r3, %r4 /* arg2 -> 1 */23mr %r4, %r5 /* arg3 -> 2 */24mr %r5, %r6 /* arg4 -> 3 */25mr %r6, %r7 /* arg5 -> 4 */26mr %r7, %r8 /* arg6 -> 5 */27mr %r8, %r9 /* arg7 -> 6 */28sc29blr30/* Note: We're exposing the raw return value to the caller */31END(host_syscall)3233.section .note.GNU-stack,"",%progbits343536