diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-11-15 13:46:14 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-11-15 13:46:14 +0000 |
commit | 4d3c7f75e644c67e3110fa7ded9eb6af696f8ef2 (patch) | |
tree | 11357382c5da640a8dcd1b90c09b8b19cfdae6a7 /libc/sysdeps/linux/sh/syscall_error.S | |
parent | 30c30b2c9990d4f620fed8292c0fbf28f8cbd16f (diff) |
Stefan Allius writes:
I attached a patch, which revise the clone.S and vfork.S:
- Use PIC code.
- include new file syscall.S, so we can simply make a branch to
__syscall_error instead of a PLT/GOT call
- call errno_location to store the syscall error (for pthreads)
- avoid to use the 'shad' statement on SH2 targets
- call fork if vfork isn't available
- some cleanups and optimization
Diffstat (limited to 'libc/sysdeps/linux/sh/syscall_error.S')
-rw-r--r-- | libc/sysdeps/linux/sh/syscall_error.S | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/sh/syscall_error.S b/libc/sysdeps/linux/sh/syscall_error.S new file mode 100644 index 000000000..7115120db --- /dev/null +++ b/libc/sysdeps/linux/sh/syscall_error.S @@ -0,0 +1,37 @@ + .align 4 +__syscall_error: + /* Call errno_location, store '-r4' in errno and return -1 */ + mov.l r12, @-r15 + sts.l pr, @-r15 +#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ + mova .LG, r0 + mov.l .LG, r12 + add r0, r12 + mov.l 1f, r0 + mov.l @(r0,r12),r0 + jsr @r0 + neg r4, r12 +#else + mov.l 1f, r0 + bsrf r0 + neg r4, r12 +.jmp_loc: +#endif + mov.l r12, @r0 + lds.l @r15+, pr + mov.l @r15+,r12 + + /* And just kick back a -1. */ + rts + mov #-1, r0 + + .align 4 + +#if defined __HAVE_ELF__ && defined __HAVE_SHARED__ +1: .long __errno_location@GOT +.LG: .long _GLOBAL_OFFSET_TABLE_ +#else +1: .long __errno_location - .jmp_loc +#endif + + |