aboutsummaryrefslogtreecommitdiff
path: root/system/x86_64/unified.S
diff options
context:
space:
mode:
Diffstat (limited to 'system/x86_64/unified.S')
-rw-r--r--system/x86_64/unified.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/system/x86_64/unified.S b/system/x86_64/unified.S
new file mode 100644
index 0000000..c4dff7d
--- /dev/null
+++ b/system/x86_64/unified.S
@@ -0,0 +1,27 @@
+#define SYS_exit 0x3c
+
+.text
+.weak exit
+exit:
+.global _exit
+_exit:
+ mov $SYS_exit,%al
+
+.global __unified_syscall
+__unified_syscall:
+ movzbl %al, %eax
+ mov %rcx, %r10
+ syscall
+ cmpq $-128, %rax
+ jbe .Lnoerror
+ negl %eax
+ pushq %rax
+ call __errno_location
+ popq %rcx
+ movl %ecx,(%rax)
+ orq $-1, %rax
+.Lnoerror:
+
+ ret
+.Lhere:
+ .size __unified_syscall,.Lhere-__unified_syscall