summaryrefslogtreecommitdiffstats
path: root/libc/arch-x86/bionic
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-03-22 15:55:09 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2010-03-22 15:55:09 -0700
commit377d4c979dee3dcb5929e8f7a68a53c2407259ab (patch)
tree1783fe0272f1437faabfe8365e615696eb8d374c /libc/arch-x86/bionic
parent709a898de82128c065381e258e8e71f0a55df976 (diff)
parent1825fb5d5f214849e39d95660795a0d3633f8eeb (diff)
downloadbionic-377d4c979dee3dcb5929e8f7a68a53c2407259ab.zip
bionic-377d4c979dee3dcb5929e8f7a68a53c2407259ab.tar.gz
bionic-377d4c979dee3dcb5929e8f7a68a53c2407259ab.tar.bz2
merge from open-source master
Change-Id: I70266ee8c520b216773f267e46c8273d2334c31d
Diffstat (limited to 'libc/arch-x86/bionic')
-rw-r--r--libc/arch-x86/bionic/syscall.S52
1 files changed, 52 insertions, 0 deletions
diff --git a/libc/arch-x86/bionic/syscall.S b/libc/arch-x86/bionic/syscall.S
new file mode 100644
index 0000000..71abe6b
--- /dev/null
+++ b/libc/arch-x86/bionic/syscall.S
@@ -0,0 +1,52 @@
+/*
+ * Generic syscall call.
+ * Upon entry
+ * %eax: system call number
+ * %ebx: arg0 to system call
+ * %ecx: arg..
+ * %edx: arg..
+ * %esi: arg..
+ * %edi: arg..
+ * We push these (to save them) load them up with the
+ * values from the calling frame (not all will actually be valid)
+ * and make the syscall.
+ */
+
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type syscall, @function
+ .globl syscall
+ .align 4
+
+syscall:
+ push %eax
+ push %ebx
+ push %ecx
+ push %edx
+ push %esi
+ push %edi
+ mov 28(%esp),%eax
+ mov 32(%esp),%ebx
+ mov 36(%esp),%ecx
+ mov 40(%esp),%edx
+ mov 44(%esp),%esi
+ mov 48(%esp),%edi
+
+ int $0x80
+
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ pop %edi
+ pop %esi
+ pop %edx
+ pop %ecx
+ pop %ebx
+ pop %eax
+ ret