summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-04 12:34:00 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-04 12:34:00 +0000
commit330eb7bad0aeb0f95a12eb77791bdb4b828249d4 (patch)
tree527e12a369e03c73b20f5e68cd1798ad069c88f7 /libc
parent4971b11759683f19fca1b7df7c12b6d9a94828fe (diff)
Rework powerpc to be consistant with the other arches.
-Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile4
-rw-r--r--libc/sysdeps/linux/powerpc/__longjmp.S82
-rw-r--r--libc/sysdeps/linux/powerpc/__syscall_error.c29
-rw-r--r--libc/sysdeps/linux/powerpc/brk.S59
-rw-r--r--libc/sysdeps/linux/powerpc/bsd-_setjmp.S33
-rw-r--r--libc/sysdeps/linux/powerpc/bsd-setjmp.S36
-rw-r--r--libc/sysdeps/linux/powerpc/clone.S98
-rw-r--r--libc/sysdeps/linux/powerpc/crt0.c3
-rw-r--r--libc/sysdeps/linux/powerpc/longjmp.S84
-rw-r--r--libc/sysdeps/linux/powerpc/ppc_asm.h188
-rw-r--r--libc/sysdeps/linux/powerpc/setjmp.S82
11 files changed, 454 insertions, 244 deletions
diff --git a/libc/sysdeps/linux/powerpc/Makefile b/libc/sysdeps/linux/powerpc/Makefile
index 3b737f740..30176536d 100644
--- a/libc/sysdeps/linux/powerpc/Makefile
+++ b/libc/sysdeps/linux/powerpc/Makefile
@@ -37,10 +37,10 @@ CRT0=crt0.S
CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
endif
-SSRC=longjmp.S setjmp.S
+SSRC=__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S clone.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
-CSRC=_mmap.c vfork.c
+CSRC=_mmap.c vfork.c __syscall_error.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(SOBJS) $(MOBJ) $(COBJS)
diff --git a/libc/sysdeps/linux/powerpc/__longjmp.S b/libc/sysdeps/linux/powerpc/__longjmp.S
new file mode 100644
index 000000000..fbca904f0
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/__longjmp.S
@@ -0,0 +1,82 @@
+/* longjmp for PowerPC.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <features.h>
+#include "ppc_asm.h"
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+
+#ifdef __UCLIBC_HAS_FLOATS__
+#define FP(x...) x
+#else
+#define FP(x...)
+#endif
+
+.globl __longjmp;
+.type __longjmp, @function;
+.align 2;
+
+__longjmp:
+ lwz r1,(JB_GPR1*4)(r3)
+ lwz r2,(JB_GPR2*4)(r3)
+ lwz r0,(JB_LR*4)(r3)
+ lwz r14,((JB_GPRS+0)*4)(r3)
+FP( lfd fp14,((JB_FPRS+0*2)*4)(r3))
+ lwz r15,((JB_GPRS+1)*4)(r3)
+FP( lfd fp15,((JB_FPRS+1*2)*4)(r3))
+ lwz r16,((JB_GPRS+2)*4)(r3)
+FP( lfd fp16,((JB_FPRS+2*2)*4)(r3))
+ lwz r17,((JB_GPRS+3)*4)(r3)
+FP( lfd fp17,((JB_FPRS+3*2)*4)(r3))
+ lwz r18,((JB_GPRS+4)*4)(r3)
+FP( lfd fp18,((JB_FPRS+4*2)*4)(r3))
+ lwz r19,((JB_GPRS+5)*4)(r3)
+FP( lfd fp19,((JB_FPRS+5*2)*4)(r3))
+ lwz r20,((JB_GPRS+6)*4)(r3)
+FP( lfd fp20,((JB_FPRS+6*2)*4)(r3))
+ mtlr r0
+ lwz r21,((JB_GPRS+7)*4)(r3)
+FP( lfd fp21,((JB_FPRS+7*2)*4)(r3))
+ lwz r22,((JB_GPRS+8)*4)(r3)
+FP( lfd fp22,((JB_FPRS+8*2)*4)(r3))
+ lwz r0,(JB_CR*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+FP( lfd fp23,((JB_FPRS+9*2)*4)(r3))
+ lwz r24,((JB_GPRS+10)*4)(r3)
+FP( lfd fp24,((JB_FPRS+10*2)*4)(r3))
+ lwz r25,((JB_GPRS+11)*4)(r3)
+FP( lfd fp25,((JB_FPRS+11*2)*4)(r3))
+ mtcrf 0xFF,r0
+ lwz r26,((JB_GPRS+12)*4)(r3)
+FP( lfd fp26,((JB_FPRS+12*2)*4)(r3))
+ lwz r27,((JB_GPRS+13)*4)(r3)
+FP( lfd fp27,((JB_FPRS+13*2)*4)(r3))
+ lwz r28,((JB_GPRS+14)*4)(r3)
+FP( lfd fp28,((JB_FPRS+14*2)*4)(r3))
+ lwz r29,((JB_GPRS+15)*4)(r3)
+FP( lfd fp29,((JB_FPRS+15*2)*4)(r3))
+ lwz r30,((JB_GPRS+16)*4)(r3)
+FP( lfd fp30,((JB_FPRS+16*2)*4)(r3))
+ lwz r31,((JB_GPRS+17)*4)(r3)
+FP( lfd fp31,((JB_FPRS+17*2)*4)(r3))
+ mr r3,r4
+ blr
+.size __longjmp,.-__longjmp
diff --git a/libc/sysdeps/linux/powerpc/__syscall_error.c b/libc/sysdeps/linux/powerpc/__syscall_error.c
new file mode 100644
index 000000000..9ab65ed79
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/__syscall_error.c
@@ -0,0 +1,29 @@
+/* Wrapper around clone system call.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno. */
+int __syscall_error (int err_no)
+{
+ __set_errno (err_no);
+ return -1;
+}
+
diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S
new file mode 100644
index 000000000..57a8fb838
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/brk.S
@@ -0,0 +1,59 @@
+/* brk system call for Linux/ppc.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "ppc_asm.h"
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_brk
+ .comm ___brk_addr,4,4
+ .section ".text"
+.globl __brk;
+.type __brk, @function;
+.align 2;
+
+__brk:
+ stwu r1,-16(r1)
+ stw r3,8(r1)
+ li 0, __NR_brk;
+ sc
+ lwz r6,8(r1)
+#ifdef PIC
+ mflr r4
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r5
+ lwz r5,___brk_addr@got(r5)
+ mtlr r4
+ stw r3,0(r5)
+#else
+ lis r4,___brk_addr@ha
+ stw r3,___brk_addr@l(r4)
+#endif
+ cmplw r6,r3
+ addi r1,r1,16
+ li r3,0
+ blelr+
+ li r3,ENOMEM
+ b __syscall_error
+.size __brk,.-__brk
+
+.weak brk;
+brk=__brk
+#endif
diff --git a/libc/sysdeps/linux/powerpc/bsd-_setjmp.S b/libc/sysdeps/linux/powerpc/bsd-_setjmp.S
new file mode 100644
index 000000000..ef898a7e1
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/bsd-_setjmp.S
@@ -0,0 +1,33 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC version.
+ Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+ We cannot do it in C because it must be a tail-call, so frame-unwinding
+ in setjmp doesn't clobber the state restored by longjmp. */
+
+#include "ppc_asm.h"
+
+.globl _setjmp;
+.type _setjmp, @function;
+.align 2;
+
+_setjmp:
+ li r4,0 /* Set second argument to 0. */
+ b __sigsetjmp
+.size _setjmp,.-_setjmp
diff --git a/libc/sysdeps/linux/powerpc/bsd-setjmp.S b/libc/sysdeps/linux/powerpc/bsd-setjmp.S
new file mode 100644
index 000000000..1555bb2b3
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/bsd-setjmp.S
@@ -0,0 +1,36 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC version.
+ Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+ We cannot do it in C because it must be a tail-call, so frame-unwinding
+ in setjmp doesn't clobber the state restored by longjmp. */
+
+#include "ppc_asm.h"
+
+.globl __setjmp;
+.type __setjmp, @function;
+.align 2;
+
+__setjmp:
+ li r4,1 /* Set second argument to 1. */
+ b __sigsetjmp
+.size __setjmp,.-__setjmp
+
+.globl setjmp;
+.set setjmp,__setjmp
diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S
new file mode 100644
index 000000000..8aeb48262
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/clone.S
@@ -0,0 +1,98 @@
+/* Wrapper around clone system call.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "ppc_asm.h"
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <sys/syscall.h>
+
+/* This is the only really unusual system call in PPC linux, but not
+ because of any weirdness in the system call itself; because of
+ all the freaky stuff we have to do to make the call useful. */
+
+/* int [r3] clone(int (*fn)(void *arg) [r3], void *child_stack [r4],
+ int flags [r5], void *arg [r6]); */
+
+#ifdef __NR_clone
+.globl __clone;
+.type __clone, @function;
+.align 2;
+
+
+__clone:
+ /* Check for child_stack == NULL || fn == NULL. */
+ cmpwi cr0,r4,0
+ cmpwi cr1,r3,0
+ cror cr0*4+eq,cr1*4+eq,cr0*4+eq
+ beq- cr0,.Lbadargs
+
+ /* Set up stack frame for parent. */
+ stwu r1,-32(r1)
+ stmw r29,16(r1)
+
+ /* Set up stack frame for child. */
+ clrrwi r4,r4,4
+ li r0,0
+ stwu r0,-16(r4)
+
+ /* Save fn, args, stack across syscall. */
+ mr r29,r3 /* Function in r29. */
+ mr r30,r4 /* Stack pointer in r30. */
+ mr r31,r6 /* Argument in r31. */
+
+ /* 'flags' argument is first parameter to clone syscall. (The other
+ argument is the stack pointer, already in r4.) */
+ mr r3,r5
+
+ /* Do the call. */
+ li 0, __NR_clone
+ sc
+
+ /* Check for child process. */
+ cmpwi cr1,r3,0
+ crandc cr1*4+eq,cr1*4+eq,cr0*4+so
+ bne- cr1,.Lparent /* The '-' is to minimise the race. */
+
+ /* On at least mklinux DR3a5, clone() doesn't actually change
+ the stack pointer. I'm pretty sure this is a bug, because
+ it adds a race condition if a signal is sent to a thread
+ just after it is created (in the previous three instructions). */
+ mr r1,r30
+ /* Call procedure. */
+ mtctr r29
+ mr r3,r31
+ bctrl
+ /* Call _exit with result from procedure. */
+ b _exit
+
+.Lparent:
+ /* Parent. Restore registers & return. */
+ lmw r29,16(r1)
+ addi r1,r1,32
+ bnslr+
+ b __syscall_error
+
+.Lbadargs:
+ li r3,EINVAL
+ b __syscall_error
+
+.size __clone,.-__clone
+.weak clean;
+clone=__clone
+#endif
diff --git a/libc/sysdeps/linux/powerpc/crt0.c b/libc/sysdeps/linux/powerpc/crt0.c
index 4bb289128..cf1c94af4 100644
--- a/libc/sysdeps/linux/powerpc/crt0.c
+++ b/libc/sysdeps/linux/powerpc/crt0.c
@@ -21,6 +21,8 @@
*
*/
+#include <errno.h>
+
asm(
"\t.global _start\n"
"\t_start:\n"
@@ -67,4 +69,3 @@ void _start2(void)
__uClibc_main(argc,p+1,p+2+argc);
}
-
diff --git a/libc/sysdeps/linux/powerpc/longjmp.S b/libc/sysdeps/linux/powerpc/longjmp.S
deleted file mode 100644
index cc84cbe66..000000000
--- a/libc/sysdeps/linux/powerpc/longjmp.S
+++ /dev/null
@@ -1,84 +0,0 @@
-/* longjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* So we can use r3, r4, instead of 3, 4 */
-#include <ppc-asm.h>
-#define r1 1
-#define r2 2
-
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-
-#define USE_FP
-#ifdef USE_FP
-#define FP(x...) x
-#else
-#define FP(x...)
-#endif
-
-.global longjmp;
-.align 4;
-
-longjmp:
- lwz r1,(JB_GPR1*4)(r3)
- lwz r2,(JB_GPR2*4)(r3)
- lwz r0,(JB_LR*4)(r3)
- lwz r14,((JB_GPRS+0)*4)(r3)
-FP( lfd f14,((JB_FPRS+0*2)*4)(r3) )
- lwz r15,((JB_GPRS+1)*4)(r3)
-FP( lfd f15,((JB_FPRS+1*2)*4)(r3) )
- lwz r16,((JB_GPRS+2)*4)(r3)
-FP( lfd f16,((JB_FPRS+2*2)*4)(r3) )
- lwz r17,((JB_GPRS+3)*4)(r3)
-FP( lfd f17,((JB_FPRS+3*2)*4)(r3) )
- lwz r18,((JB_GPRS+4)*4)(r3)
-FP( lfd f18,((JB_FPRS+4*2)*4)(r3) )
- lwz r19,((JB_GPRS+5)*4)(r3)
-FP( lfd f19,((JB_FPRS+5*2)*4)(r3) )
- lwz r20,((JB_GPRS+6)*4)(r3)
-FP( lfd f20,((JB_FPRS+6*2)*4)(r3) )
- mtlr r0
- lwz r21,((JB_GPRS+7)*4)(r3)
-FP( lfd f21,((JB_FPRS+7*2)*4)(r3) )
- lwz r22,((JB_GPRS+8)*4)(r3)
-FP( lfd f22,((JB_FPRS+8*2)*4)(r3) )
- lwz r0,(JB_CR*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
-FP( lfd f23,((JB_FPRS+9*2)*4)(r3) )
- lwz r24,((JB_GPRS+10)*4)(r3)
-FP( lfd f24,((JB_FPRS+10*2)*4)(r3) )
- lwz r25,((JB_GPRS+11)*4)(r3)
-FP( lfd f25,((JB_FPRS+11*2)*4)(r3) )
- mtcrf 0xFF,r0
- lwz r26,((JB_GPRS+12)*4)(r3)
-FP( lfd f26,((JB_FPRS+12*2)*4)(r3) )
- lwz r27,((JB_GPRS+13)*4)(r3)
-FP( lfd f27,((JB_FPRS+13*2)*4)(r3) )
- lwz r28,((JB_GPRS+14)*4)(r3)
-FP( lfd f28,((JB_FPRS+14*2)*4)(r3) )
- lwz r29,((JB_GPRS+15)*4)(r3)
-FP( lfd f29,((JB_FPRS+15*2)*4)(r3) )
- lwz r30,((JB_GPRS+16)*4)(r3)
-FP( lfd f30,((JB_FPRS+16*2)*4)(r3) )
- lwz r31,((JB_GPRS+17)*4)(r3)
-FP( lfd f31,((JB_FPRS+17*2)*4)(r3) )
- mr r3,r4
- blr
-.size longjmp,.-longjmp;
diff --git a/libc/sysdeps/linux/powerpc/ppc_asm.h b/libc/sysdeps/linux/powerpc/ppc_asm.h
index c35192bb4..ad34e3e62 100644
--- a/libc/sysdeps/linux/powerpc/ppc_asm.h
+++ b/libc/sysdeps/linux/powerpc/ppc_asm.h
@@ -1,115 +1,83 @@
-/* Condition Register Bit Fields */
+/* Symbolic names for the registers. The only portable way to write asm
+ code is to use number but this produces really unreadable code.
+ Therefore these symbolic names. */
-#define cr0 0
-#define cr1 1
-#define cr2 2
-#define cr3 3
-#define cr4 4
-#define cr5 5
-#define cr6 6
-#define cr7 7
+/* Integer registers. */
+#define r0 0
+#define r1 1
+#define r2 2
+#define r3 3
+#define r4 4
+#define r5 5
+#define r6 6
+#define r7 7
+#define r8 8
+#define r9 9
+#define r10 10
+#define r11 11
+#define r12 12
+#define r13 13
+#define r14 14
+#define r15 15
+#define r16 16
+#define r17 17
+#define r18 18
+#define r19 19
+#define r20 20
+#define r21 21
+#define r22 22
+#define r23 23
+#define r24 24
+#define r25 25
+#define r26 26
+#define r27 27
+#define r28 28
+#define r29 29
+#define r30 30
+#define r31 31
+/* Floating-point registers. */
+#define fp0 0
+#define fp1 1
+#define fp2 2
+#define fp3 3
+#define fp4 4
+#define fp5 5
+#define fp6 6
+#define fp7 7
+#define fp8 8
+#define fp9 9
+#define fp10 10
+#define fp11 11
+#define fp12 12
+#define fp13 13
+#define fp14 14
+#define fp15 15
+#define fp16 16
+#define fp17 17
+#define fp18 18
+#define fp19 19
+#define fp20 20
+#define fp21 21
+#define fp22 22
+#define fp23 23
+#define fp24 24
+#define fp25 25
+#define fp26 26
+#define fp27 27
+#define fp28 28
+#define fp29 29
+#define fp30 30
+#define fp31 31
-/* General Purpose Registers (GPRs) */
+/* Condition code registers. */
+#define cr0 0
+#define cr1 1
+#define cr2 2
+#define cr3 3
+#define cr4 4
+#define cr5 5
+#define cr6 6
+#define cr7 7
-#define r0 0
-#define r1 1
-#define r2 2
-#define r3 3
-#define r4 4
-#define r5 5
-#define r6 6
-#define r7 7
-#define r8 8
-#define r9 9
-#define r10 10
-#define r11 11
-#define r12 12
-#define r13 13
-#define r14 14
-#define r15 15
-#define r16 16
-#define r17 17
-#define r18 18
-#define r19 19
-#define r20 20
-#define r21 21
-#define r22 22
-#define r23 23
-#define r24 24
-#define r25 25
-#define r26 26
-#define r27 27
-#define r28 28
-#define r29 29
-#define r30 30
-#define r31 31
-
-/* Floating Point Registers (FPRs) */
-
-#define fr0 0
-#define fr1 1
-#define fr2 2
-#define fr3 3
-#define fr4 4
-#define fr5 5
-#define fr6 6
-#define fr7 7
-#define fr8 8
-#define fr9 9
-#define fr10 10
-#define fr11 11
-#define fr12 12
-#define fr13 13
-#define fr14 14
-#define fr15 15
-#define fr16 16
-#define fr17 17
-#define fr18 18
-#define fr19 19
-#define fr20 20
-#define fr21 21
-#define fr22 22
-#define fr23 23
-#define fr24 24
-#define fr25 25
-#define fr26 26
-#define fr27 27
-#define fr28 28
-#define fr29 29
-#define fr30 30
-#define fr31 31
-
-#define vr0 0
-#define vr1 1
-#define vr2 2
-#define vr3 3
-#define vr4 4
-#define vr5 5
-#define vr6 6
-#define vr7 7
-#define vr8 8
-#define vr9 9
-#define vr10 10
-#define vr11 11
-#define vr12 12
-#define vr13 13
-#define vr14 14
-#define vr15 15
-#define vr16 16
-#define vr17 17
-#define vr18 18
-#define vr19 19
-#define vr20 20
-#define vr21 21
-#define vr22 22
-#define vr23 23
-#define vr24 24
-#define vr25 25
-#define vr26 26
-#define vr27 27
-#define vr28 28
-#define vr29 29
-#define vr30 30
-#define vr31 31
diff --git a/libc/sysdeps/linux/powerpc/setjmp.S b/libc/sysdeps/linux/powerpc/setjmp.S
index 4b3c48a8c..6cf48544b 100644
--- a/libc/sysdeps/linux/powerpc/setjmp.S
+++ b/libc/sysdeps/linux/powerpc/setjmp.S
@@ -3,90 +3,78 @@
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <ppc-asm.h>
-#define r1 1
-#define r2 2
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <features.h>
+#include "ppc_asm.h"
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
-#define USE_FP
-#ifdef USE_FP
+#ifdef __UCLIBC_HAS_FLOATS__
#define FP(x...) x
#else
#define FP(x...)
#endif
-.global _setjmp
-.type _setjmp,@function
-.align 4
-_setjmp:
- li r4,0
-.global __sigsetjmp
-.type __sigsetjmp,@function
-.align 4
-__sigsetjmp:
+.globl __sigsetjmp;
+.type __sigsetjmp, @function;
+.align 2;
+
+__sigsetjmp:
stw r1,(JB_GPR1*4)(3)
mflr r0
stw r2,(JB_GPR2*4)(3)
stw r14,((JB_GPRS+0)*4)(3)
-FP( stfd f14,((JB_FPRS+0*2)*4)(3) )
+FP( stfd fp14,((JB_FPRS+0*2)*4)(3))
stw r0,(JB_LR*4)(3)
stw r15,((JB_GPRS+1)*4)(3)
-FP( stfd f15,((JB_FPRS+1*2)*4)(3) )
+FP( stfd fp15,((JB_FPRS+1*2)*4)(3))
mfcr r0
stw r16,((JB_GPRS+2)*4)(3)
-FP( stfd f16,((JB_FPRS+2*2)*4)(3) )
+FP( stfd fp16,((JB_FPRS+2*2)*4)(3))
stw r0,(JB_CR*4)(3)
stw r17,((JB_GPRS+3)*4)(3)
-FP( stfd f7,((JB_FPRS+3*2)*4)(3) )
+FP( stfd fp17,((JB_FPRS+3*2)*4)(3))
stw r18,((JB_GPRS+4)*4)(3)
-FP( stfd f18,((JB_FPRS+4*2)*4)(3) )
+FP( stfd fp18,((JB_FPRS+4*2)*4)(3))
stw r19,((JB_GPRS+5)*4)(3)
-FP( stfd f19,((JB_FPRS+5*2)*4)(3) )
+FP( stfd fp19,((JB_FPRS+5*2)*4)(3))
stw r20,((JB_GPRS+6)*4)(3)
-FP( stfd f20,((JB_FPRS+6*2)*4)(3) )
+FP( stfd fp20,((JB_FPRS+6*2)*4)(3))
stw r21,((JB_GPRS+7)*4)(3)
-FP( stfd f21,((JB_FPRS+7*2)*4)(3) )
+FP( stfd fp21,((JB_FPRS+7*2)*4)(3))
stw r22,((JB_GPRS+8)*4)(3)
-FP( stfd f22,((JB_FPRS+8*2)*4)(3) )
+FP( stfd fp22,((JB_FPRS+8*2)*4)(3))
stw r23,((JB_GPRS+9)*4)(3)
-FP( stfd f23,((JB_FPRS+9*2)*4)(3) )
+FP( stfd fp23,((JB_FPRS+9*2)*4)(3))
stw r24,((JB_GPRS+10)*4)(3)
-FP( stfd f24,((JB_FPRS+10*2)*4)(3) )
+FP( stfd fp24,((JB_FPRS+10*2)*4)(3))
stw r25,((JB_GPRS+11)*4)(3)
-FP( stfd f25,((JB_FPRS+11*2)*4)(3) )
+FP( stfd fp25,((JB_FPRS+11*2)*4)(3))
stw r26,((JB_GPRS+12)*4)(3)
-FP( stfd f26,((JB_FPRS+12*2)*4)(3) )
+FP( stfd fp26,((JB_FPRS+12*2)*4)(3))
stw r27,((JB_GPRS+13)*4)(3)
-FP( stfd f27,((JB_FPRS+13*2)*4)(3) )
+FP( stfd fp27,((JB_FPRS+13*2)*4)(3))
stw r28,((JB_GPRS+14)*4)(3)
-FP( stfd f28,((JB_FPRS+14*2)*4)(3) )
+FP( stfd fp28,((JB_FPRS+14*2)*4)(3))
stw r29,((JB_GPRS+15)*4)(3)
-FP( stfd f29,((JB_FPRS+15*2)*4)(3) )
+FP( stfd fp29,((JB_FPRS+15*2)*4)(3))
stw r30,((JB_GPRS+16)*4)(3)
-FP( stfd f30,((JB_FPRS+16*2)*4)(3) )
+FP( stfd fp30,((JB_FPRS+16*2)*4)(3))
stw r31,((JB_GPRS+17)*4)(3)
-FP( stfd f31,((JB_FPRS+17*2)*4)(3) )
-#ifdef __PIC__
- b __sigjmp_save@PLT
-#else
+FP( stfd fp31,((JB_FPRS+17*2)*4)(3))
b __sigjmp_save
-#endif
-.size __sigsetjmp,.-__sigsetjmp
-
+.size __sigsetjmp,.-__sigsetjmp