summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/i386/varsyscall.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/i386/varsyscall.S')
-rw-r--r--usr/klibc/arch/i386/varsyscall.S37
1 files changed, 37 insertions, 0 deletions
diff --git a/usr/klibc/arch/i386/varsyscall.S b/usr/klibc/arch/i386/varsyscall.S
new file mode 100644
index 0000000..e796a93
--- /dev/null
+++ b/usr/klibc/arch/i386/varsyscall.S
@@ -0,0 +1,37 @@
+/*
+ * arch/i386/varsyscall.S
+ *
+ * Common tail-handling code for varadic system calls (which always
+ * use the cdecl convention.)
+ *
+ * The arguments are on the stack; the system call number in %eax.
+ */
+
+#ifdef _REGPARM
+
+#define ARG(n) (4*n+24)(%esp)
+#define SYSNO ARG(-2)
+
+ .text
+ .align 4
+ .globl __syscall_varadic
+ .type __syscall_varadic,@function
+__syscall_varadic:
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ pushl %ebp
+
+ movl SYSNO,%eax
+ movl ARG(0),%ebx # Syscall arguments
+ movl ARG(1),%ecx
+ movl ARG(2),%edx
+ movl ARG(3),%esi
+ movl ARG(4),%edi
+ movl ARG(5),%ebp
+
+ jmp __syscall_common_tail
+
+ .size __syscall_varadic,.-__syscall_varadic
+
+#endif