summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2010-02-25 13:27:46 +0000
committerAndrei Popescu <andreip@google.com>2010-03-02 11:43:24 +0000
commiteb9d5ed3477ef8cd9ccfa424ea585541ea3af84a (patch)
tree57860bc44d54d743b05f8a7680267170af3f3069 /libc
parent8f8b5310d2c3fe8782377bd66b65ed14dc6511a4 (diff)
downloadbionic-eb9d5ed3477ef8cd9ccfa424ea585541ea3af84a.zip
bionic-eb9d5ed3477ef8cd9ccfa424ea585541ea3af84a.tar.gz
bionic-eb9d5ed3477ef8cd9ccfa424ea585541ea3af84a.tar.bz2
add sigaltstack syscall
Diffstat (limited to 'libc')
-rw-r--r--libc/SYSCALLS.TXT1
-rw-r--r--libc/arch-arm/syscalls.mk1
-rw-r--r--libc/arch-arm/syscalls/sigaltstack.S19
-rw-r--r--libc/arch-sh/syscalls.mk1
-rw-r--r--libc/arch-sh/syscalls/sigaltstack.S32
-rw-r--r--libc/arch-x86/syscalls.mk1
-rw-r--r--libc/arch-x86/syscalls/sigaltstack.S26
-rw-r--r--libc/docs/CHANGES.TXT2
-rw-r--r--libc/include/sys/linux-syscalls.h1
-rw-r--r--libc/include/sys/linux-unistd.h1
10 files changed, 85 insertions, 0 deletions
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 423a24e..ca48cfb 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -79,6 +79,7 @@ int chroot(const char *) 61
int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 172
int capget(cap_user_header_t header, cap_user_data_t data) 184
int capset(cap_user_header_t header, const cap_user_data_t data) 185
+int sigaltstack(const stack_t*, stack_t*) 186
int acct(const char* filepath) 51
# file descriptors
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index 96471bf..3020930 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -37,6 +37,7 @@ syscall_src += arch-arm/syscalls/chroot.S
syscall_src += arch-arm/syscalls/prctl.S
syscall_src += arch-arm/syscalls/capget.S
syscall_src += arch-arm/syscalls/capset.S
+syscall_src += arch-arm/syscalls/sigaltstack.S
syscall_src += arch-arm/syscalls/acct.S
syscall_src += arch-arm/syscalls/read.S
syscall_src += arch-arm/syscalls/write.S
diff --git a/libc/arch-arm/syscalls/sigaltstack.S b/libc/arch-arm/syscalls/sigaltstack.S
new file mode 100644
index 0000000..3625d0b
--- /dev/null
+++ b/libc/arch-arm/syscalls/sigaltstack.S
@@ -0,0 +1,19 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type sigaltstack, #function
+ .globl sigaltstack
+ .align 4
+ .fnstart
+
+sigaltstack:
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_sigaltstack
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+ .fnend
diff --git a/libc/arch-sh/syscalls.mk b/libc/arch-sh/syscalls.mk
index ac12ae4..c848954 100644
--- a/libc/arch-sh/syscalls.mk
+++ b/libc/arch-sh/syscalls.mk
@@ -41,6 +41,7 @@ syscall_src += arch-sh/syscalls/chroot.S
syscall_src += arch-sh/syscalls/prctl.S
syscall_src += arch-sh/syscalls/capget.S
syscall_src += arch-sh/syscalls/capset.S
+syscall_src += arch-sh/syscalls/sigaltstack.S
syscall_src += arch-sh/syscalls/acct.S
syscall_src += arch-sh/syscalls/read.S
syscall_src += arch-sh/syscalls/write.S
diff --git a/libc/arch-sh/syscalls/sigaltstack.S b/libc/arch-sh/syscalls/sigaltstack.S
new file mode 100644
index 0000000..8b03e27
--- /dev/null
+++ b/libc/arch-sh/syscalls/sigaltstack.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type sigaltstack, @function
+ .globl sigaltstack
+ .align 4
+
+sigaltstack:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(2 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_sigaltstack_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_sigaltstack_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_sigaltstack
+1: .long __set_syscall_errno
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index dbc55e6..6a528e3 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -40,6 +40,7 @@ syscall_src += arch-x86/syscalls/chroot.S
syscall_src += arch-x86/syscalls/prctl.S
syscall_src += arch-x86/syscalls/capget.S
syscall_src += arch-x86/syscalls/capset.S
+syscall_src += arch-x86/syscalls/sigaltstack.S
syscall_src += arch-x86/syscalls/acct.S
syscall_src += arch-x86/syscalls/read.S
syscall_src += arch-x86/syscalls/write.S
diff --git a/libc/arch-x86/syscalls/sigaltstack.S b/libc/arch-x86/syscalls/sigaltstack.S
new file mode 100644
index 0000000..d39419d
--- /dev/null
+++ b/libc/arch-x86/syscalls/sigaltstack.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type sigaltstack, @function
+ .globl sigaltstack
+ .align 4
+
+sigaltstack:
+ pushl %ebx
+ pushl %ecx
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_sigaltstack, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/docs/CHANGES.TXT b/libc/docs/CHANGES.TXT
index 47289f6..d7f54ba 100644
--- a/libc/docs/CHANGES.TXT
+++ b/libc/docs/CHANGES.TXT
@@ -68,6 +68,8 @@ Differences between current and Android 2.1:
errno. Previous implementation returned -1 on error, setting errno, which
is not Posix compliant.
+- add sigaltstack() implementation for ARM.
+
-------------------------------------------------------------------------------
Differences between Android 2.1 and 2.0.1:
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index c4e6e45..30c58fd 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -42,6 +42,7 @@
#define __NR_prctl (__NR_SYSCALL_BASE + 172)
#define __NR_capget (__NR_SYSCALL_BASE + 184)
#define __NR_capset (__NR_SYSCALL_BASE + 185)
+#define __NR_sigaltstack (__NR_SYSCALL_BASE + 186)
#define __NR_acct (__NR_SYSCALL_BASE + 51)
#define __NR_read (__NR_SYSCALL_BASE + 3)
#define __NR_write (__NR_SYSCALL_BASE + 4)
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index f48dbcd..d6f706b 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -48,6 +48,7 @@ int chroot (const char *);
int prctl (int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5);
int capget (cap_user_header_t header, cap_user_data_t data);
int capset (cap_user_header_t header, const cap_user_data_t data);
+int sigaltstack (const stack_t*, stack_t*);
int acct (const char* filepath);
ssize_t read (int, void*, size_t);
ssize_t write (int, const void*, size_t);