summaryrefslogtreecommitdiff
path: root/klibc/klibc/arch/i386/open.S
diff options
context:
space:
mode:
Diffstat (limited to 'klibc/klibc/arch/i386/open.S')
-rw-r--r--klibc/klibc/arch/i386/open.S29
1 files changed, 29 insertions, 0 deletions
diff --git a/klibc/klibc/arch/i386/open.S b/klibc/klibc/arch/i386/open.S
new file mode 100644
index 0000000000..4f492a1566
--- /dev/null
+++ b/klibc/klibc/arch/i386/open.S
@@ -0,0 +1,29 @@
+/*
+ * arch/i386/open.S
+ *
+ * Handle the open() system call - oddball due to the varadic
+ * prototype, which forces the use of the cdecl calling convention,
+ * and the need for O_LARGEFILE.
+ */
+
+#include <asm/unistd.h>
+
+/* <asm/fcntl.h>, despite the name, isn't assembly-safe */
+#define O_LARGEFILE 0100000
+
+ .globl open
+ .type open,@function
+
+open:
+#ifdef REGPARM
+ movl 4(%esp),%eax
+ movl 8(%esp),%edx
+ movl 12(%esp),%ecx
+ orl $O_LARGEFILE,%edx
+#else
+ orl $O_LARGEFILE,8(%esp)
+#endif
+ pushl $__NR_open
+ jmp __syscall_common
+
+ .size open,.-open