diff options
Diffstat (limited to 'usr/klibc/arch/arm64/syscall.S')
-rw-r--r-- | usr/klibc/arch/arm64/syscall.S | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/klibc/arch/arm64/syscall.S b/usr/klibc/arch/arm64/syscall.S new file mode 100644 index 0000000..e100412 --- /dev/null +++ b/usr/klibc/arch/arm64/syscall.S @@ -0,0 +1,25 @@ +/* + * arch/arm64/syscall.S + * + * System call common handling - if the return + * value from the system call is negative, then + * extract the magnitude and return it as errno and + * return -1, if the return value is 0 that is + * success case. + */ + + .type __syscall_common,#function + .globl __syscall_common + .balign 8 + +__syscall_common: + cmp x0, #0x0 + b.ge 2f + neg x0, x0 + ldr x8, 1f + str w0, [x8] + mov x0, #-1 +2: + ret +1: + .dword errno |