diff options
| author | Benno Rice <benno@FreeBSD.org> | 2002-07-10 12:26:17 +0000 |
|---|---|---|
| committer | Benno Rice <benno@FreeBSD.org> | 2002-07-10 12:26:17 +0000 |
| commit | 99bc8c72f7b02a286a15ee918020a9bee23b1568 (patch) | |
| tree | efc50b2799be82853efc8ea087768ecfed7e8bd6 | |
| parent | 45b4eca56d9f3f330b0669411e4b6a4915c6f13d (diff) | |
Notes
| -rw-r--r-- | sys/conf/files.powerpc | 1 | ||||
| -rw-r--r-- | sys/powerpc/include/setjmp.h | 48 | ||||
| -rw-r--r-- | sys/powerpc/powerpc/setjmp.S | 103 |
3 files changed, 115 insertions, 37 deletions
diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 1cb888ae717e..45a83be4177e 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -32,6 +32,7 @@ powerpc/powerpc/ofw_machdep.c standard powerpc/powerpc/openpic.c standard powerpc/powerpc/pic_if.m standard powerpc/powerpc/pmap.c standard +powerpc/powerpc/setjmp.S standard powerpc/powerpc/sigcode.S standard powerpc/powerpc/suswintr.c standard powerpc/powerpc/syncicache.c standard diff --git a/sys/powerpc/include/setjmp.h b/sys/powerpc/include/setjmp.h index a893227d3f0c..9394b0462b45 100644 --- a/sys/powerpc/include/setjmp.h +++ b/sys/powerpc/include/setjmp.h @@ -1,38 +1,10 @@ -/* - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ +/* $FreeBSD$ */ +/* $NetBSD: setjmp.h,v 1.3 1998/09/16 23:51:27 thorpej Exp $ */ -#define _JBLEN 100 /* Size of the jmp_buf on PowerPC. */ +#ifndef _MACHINE_SETJMP_H_ +#define _MACHINE_SETJMP_H_ + +#define _JBLEN 100 /* * jmp_buf and sigjmp_buf are encapsulated in different structs to force @@ -40,7 +12,9 @@ * internally to avoid some run-time errors for mismatches. */ #ifndef _ANSI_SOURCE -typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; -#endif /* not ANSI */ +typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; +#endif + +typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; -typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1]; +#endif /* _MACHINE_SETJMP_H_ */ diff --git a/sys/powerpc/powerpc/setjmp.S b/sys/powerpc/powerpc/setjmp.S new file mode 100644 index 000000000000..b372e40e3ff0 --- /dev/null +++ b/sys/powerpc/powerpc/setjmp.S @@ -0,0 +1,103 @@ +/* $FreeBSD$ */ +/* from: NetBSD: setjmp.S,v 1.1 1998/01/27 15:13:12 sakamoto Exp $ */ +/* from: OpenBSD: setjmp.S,v 1.2 1996/12/28 06:22:18 rahnds Exp */ +/* kernel version of this file, does not have signal goop */ +/* int setjmp(jmp_buf env) */ + +#define JMP_r1 0x04 +#define JMP_r14 0x08 +#define JMP_r15 0x0c +#define JMP_r16 0x10 +#define JMP_r17 0x14 +#define JMP_r18 0x18 +#define JMP_r19 0x1c +#define JMP_r20 0x20 +#define JMP_r21 0x24 +#define JMP_r22 0x28 +#define JMP_r23 0x2c +#define JMP_r24 0x30 +#define JMP_r25 0x34 +#define JMP_r26 0x38 +#define JMP_r27 0x3c +#define JMP_r28 0x40 +#define JMP_r29 0x44 +#define JMP_r30 0x48 +#define JMP_r31 0x4c +#define JMP_lr 0x50 +#define JMP_cr 0x54 +#define JMP_ctr 0x58 +#define JMP_xer 0x5c +#define JMP_sig 0x60 + + +.globl setjmp +setjmp: + stw 31, JMP_r31(3) + /* r1, r14-r30 */ + stw 1, JMP_r1 (3) + stw 14, JMP_r14(3) + stw 15, JMP_r15(3) + stw 16, JMP_r16(3) + stw 17, JMP_r17(3) + stw 18, JMP_r18(3) + stw 19, JMP_r19(3) + stw 20, JMP_r20(3) + stw 21, JMP_r21(3) + stw 22, JMP_r22(3) + stw 23, JMP_r23(3) + stw 24, JMP_r24(3) + stw 25, JMP_r25(3) + stw 26, JMP_r26(3) + stw 27, JMP_r27(3) + stw 28, JMP_r28(3) + stw 29, JMP_r29(3) + stw 30, JMP_r30(3) + /* cr, lr, ctr, xer */ + mfcr 0 + stw 0, JMP_cr(3) + mflr 0 + stw 0, JMP_lr(3) + mfctr 0 + stw 0, JMP_ctr(3) + mfxer 0 + stw 0, JMP_xer(3) + /* f14-f31, fpscr */ + li 3, 0 + blr + + +.extern sigsetmask +.globl longjmp +longjmp: + lwz 31, JMP_r31(3) + /* r1, r14-r30 */ + lwz 1, JMP_r1 (3) + lwz 14, JMP_r14(3) + lwz 15, JMP_r15(3) + lwz 16, JMP_r16(3) + lwz 17, JMP_r17(3) + lwz 18, JMP_r18(3) + lwz 19, JMP_r19(3) + lwz 20, JMP_r20(3) + lwz 21, JMP_r21(3) + lwz 22, JMP_r22(3) + lwz 23, JMP_r23(3) + lwz 24, JMP_r24(3) + lwz 25, JMP_r25(3) + lwz 26, JMP_r26(3) + lwz 27, JMP_r27(3) + lwz 28, JMP_r28(3) + lwz 29, JMP_r29(3) + lwz 30, JMP_r30(3) + /* cr, lr, ctr, xer */ + lwz 0, JMP_cr(3) + mtcr 0 + lwz 0, JMP_lr(3) + mtlr 0 + lwz 0, JMP_ctr(3) + mtctr 0 + lwz 0, JMP_xer(3) + mtxer 0 + /* f14-f31, fpscr */ + mr 3, 4 + blr |
