summaryrefslogtreecommitdiff
path: root/lib/libpthread/arch/i386/syscall-template.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/arch/i386/syscall-template.S')
-rw-r--r--lib/libpthread/arch/i386/syscall-template.S48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/libpthread/arch/i386/syscall-template.S b/lib/libpthread/arch/i386/syscall-template.S
new file mode 100644
index 00000000000..34fb5caaa43
--- /dev/null
+++ b/lib/libpthread/arch/i386/syscall-template.S
@@ -0,0 +1,48 @@
+#include <sys/syscall.h>
+
+#ifdef __STDC__
+
+#define SYSCALL(x) \
+ .globl _machdep_sys_##x##; \
+ \
+_machdep_sys_##x:##; \
+ \
+ movl $(SYS_##x##), %eax; \
+ .byte 0x9a; .long 0; .word 7; \
+ jb 1b; \
+ ret;
+
+#else
+
+#define SYSCALL(x) \
+ .globl _machdep_sys_/**/x; \
+ \
+_machdep_sys_/**/x:; \
+ \
+ movl $(SYS_/**/x), %eax; \
+ .byte 0x9a; .long 0; .word 7; \
+ jb 1b; \
+ ret;
+
+#endif
+
+
+/*
+ * Initial asm stuff for all functions.
+ */
+ .text
+ .align 2
+
+
+/* ==========================================================================
+ * error code for all syscalls. The error value is returned as the negative
+ * of the errno value.
+ */
+
+1:
+ neg %eax
+ ret
+
+#define XSYSCALL(NAME) SYSCALL(NAME)
+
+XSYSCALL(SYSCALL_NAME)