1#include <machine/asm.h> 2 3/* 4 * Emulate the Linux system call interface. The system call number is set in 5 * %r0, and %r3 -> %r8 have the 6 system call arguments. errno is returned 6 * as a negative value, but we use it more as a flag something went wrong 7 * rather than using its value. 8 * 9 * Return value in %r3. If it is positive or < -4096, it's a successful 10 * system call. If it is between -1 and -4095 then it's an failed system 11 * call with -x as the errno. Errors from the kernel are signaled via the 12 * the 'so' bit, but we don't test that here at all. There are at most 6 13 * arguments to system calls in Linux. 14 * 15 * We expose the raw system call result, rather than do the POSIX 16 * conversion to -1 and setting errno. 17 * 18 * Note: The code this replaced used bso to set %r3 to 0 for the read and 19 * open system calls for reasons that are still under investigation. 20 */ 21ENTRY(host_syscall) 22 mr %r0, %r3 /* SYS_ number in $r0 */ 23 mr %r3, %r4 /* arg2 -> 1 */ 24 mr %r4, %r5 /* arg3 -> 2 */ 25 mr %r5, %r6 /* arg4 -> 3 */ 26 mr %r6, %r7 /* arg5 -> 4 */ 27 mr %r7, %r8 /* arg6 -> 5 */ 28 mr %r8, %r9 /* arg7 -> 6 */ 29 sc 30 blr 31/* Note: We're exposing the raw return value to the caller */ 32END(host_syscall) 33