summaryrefslogtreecommitdiffstats
path: root/libc/arch-mips64
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-12-08 17:01:11 -0800
committerElliott Hughes <enh@google.com>2014-12-08 17:07:53 -0800
commitd27ae2f8d75bca71ba5c043ded5d26675ffe532b (patch)
treea56104dc40c7cc7b2dab9f94afc1f50585dc5693 /libc/arch-mips64
parent0b7d9d6f37d33a155a22efbafa911a5de54f7b65 (diff)
downloadbionic-d27ae2f8d75bca71ba5c043ded5d26675ffe532b.zip
bionic-d27ae2f8d75bca71ba5c043ded5d26675ffe532b.tar.gz
bionic-d27ae2f8d75bca71ba5c043ded5d26675ffe532b.tar.bz2
Merge mips setjmp/longjmp family.
Bug: 16918359 Change-Id: I9033a7d178d431ddb09f1cfa6e4bf95ae02346e9
Diffstat (limited to 'libc/arch-mips64')
-rw-r--r--libc/arch-mips64/bionic/_setjmp.S172
l---------[-rw-r--r--]libc/arch-mips64/bionic/setjmp.S190
-rw-r--r--libc/arch-mips64/bionic/sigsetjmp.S76
-rw-r--r--libc/arch-mips64/mips64.mk2
4 files changed, 1 insertions, 439 deletions
diff --git a/libc/arch-mips64/bionic/_setjmp.S b/libc/arch-mips64/bionic/_setjmp.S
deleted file mode 100644
index 052dacb..0000000
--- a/libc/arch-mips64/bionic/_setjmp.S
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: _setjmp.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */
-
-/*
- * Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
- *
- * 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. Neither the name of Opsycon AB nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#include <private/bionic_asm.h>
-#include <machine/signal.h>
-
-/*
- * _setjmp, _longjmp (not restoring signal state)
- *
- * GPOFF and FRAMESIZE must be the same for both _setjmp and _longjmp!
- *
- */
-
-FRAMESZ= MKFSIZ(0,4)
-GPOFF= FRAMESZ-2*REGSZ
-
-LEAF(_setjmp, FRAMESZ)
- PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, _setjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-#ifndef __LP64__
- addiu a0, 7 # roundup jmpbuf addr to 8-byte boundary
- li t0, ~7
- and a0, t0
-#endif
-
- # SC_MASK is unused here
-
- li v0, 0xACEDBADE # sigcontext magic number
- sw v0, SC_MAGIC(a0)
- # callee-saved long-sized regs:
- REG_S ra, SC_REGS+0*REGSZ(a0)
- REG_S s0, SC_REGS+1*REGSZ(a0)
- REG_S s1, SC_REGS+2*REGSZ(a0)
- REG_S s2, SC_REGS+3*REGSZ(a0)
- REG_S s3, SC_REGS+4*REGSZ(a0)
- REG_S s4, SC_REGS+5*REGSZ(a0)
- REG_S s5, SC_REGS+6*REGSZ(a0)
- REG_S s6, SC_REGS+7*REGSZ(a0)
- REG_S s7, SC_REGS+8*REGSZ(a0)
- REG_S s8, SC_REGS+9*REGSZ(a0)
- REG_L v0, GPOFF(sp)
- REG_S v0, SC_REGS+10*REGSZ(a0)
- PTR_ADDU v0, sp, FRAMESZ
- REG_S v0, SC_REGS+11*REGSZ(a0)
-
- cfc1 v0, $31
-
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- s.d $f24, SC_FPREGS+0*REGSZ_FP(a0)
- s.d $f25, SC_FPREGS+1*REGSZ_FP(a0)
- s.d $f26, SC_FPREGS+2*REGSZ_FP(a0)
- s.d $f27, SC_FPREGS+3*REGSZ_FP(a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- s.d $f29, SC_FPREGS+5*REGSZ_FP(a0)
- s.d $f30, SC_FPREGS+6*REGSZ_FP(a0)
- s.d $f31, SC_FPREGS+7*REGSZ_FP(a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered fp regs $f20,$f22,...$f30
- s.d $f20, SC_FPREGS+0*REGSZ_FP(a0)
- s.d $f22, SC_FPREGS+1*REGSZ_FP(a0)
- s.d $f24, SC_FPREGS+2*REGSZ_FP(a0)
- s.d $f26, SC_FPREGS+3*REGSZ_FP(a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- s.d $f30, SC_FPREGS+5*REGSZ_FP(a0)
-#endif
- sw v0, SC_FPSR(a0)
- move v0, zero
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- j ra
-END(_setjmp)
-
-
-LEAF(_longjmp, FRAMESZ)
- PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, _longjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-#ifndef __LP64__
- addiu a0, 7 # roundup jmpbuf addr to 8-byte boundary
- li t0, ~7
- and a0, t0
-#endif
-
- # SC_MASK is unused here
-
- lw v0, SC_MAGIC(a0)
- li t0, 0xACEDBADE
- bne v0, t0, botch # jump if error
-
- # callee-saved long-sized regs:
- REG_L ra, SC_REGS+0*REGSZ(a0)
- REG_L s0, SC_REGS+1*REGSZ(a0)
- REG_L s1, SC_REGS+2*REGSZ(a0)
- REG_L s2, SC_REGS+3*REGSZ(a0)
- REG_L s3, SC_REGS+4*REGSZ(a0)
- REG_L s4, SC_REGS+5*REGSZ(a0)
- REG_L s5, SC_REGS+6*REGSZ(a0)
- REG_L s6, SC_REGS+7*REGSZ(a0)
- REG_L s7, SC_REGS+8*REGSZ(a0)
- REG_L s8, SC_REGS+9*REGSZ(a0)
- REG_L gp, SC_REGS+10*REGSZ(a0)
- REG_L sp, SC_REGS+11*REGSZ(a0)
-
- lw v0, SC_FPSR(a0)
- ctc1 v0, $31
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- l.d $f24, SC_FPREGS+0*REGSZ_FP(a0)
- l.d $f25, SC_FPREGS+1*REGSZ_FP(a0)
- l.d $f26, SC_FPREGS+2*REGSZ_FP(a0)
- l.d $f27, SC_FPREGS+3*REGSZ_FP(a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- l.d $f29, SC_FPREGS+5*REGSZ_FP(a0)
- l.d $f30, SC_FPREGS+6*REGSZ_FP(a0)
- l.d $f31, SC_FPREGS+7*REGSZ_FP(a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered fp regs $f20,$f22,...$f30
- l.d $f20, SC_FPREGS+0*REGSZ_FP(a0)
- l.d $f22, SC_FPREGS+1*REGSZ_FP(a0)
- l.d $f24, SC_FPREGS+2*REGSZ_FP(a0)
- l.d $f26, SC_FPREGS+3*REGSZ_FP(a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- l.d $f30, SC_FPREGS+5*REGSZ_FP(a0)
-#endif
- bne a1, zero, 1f
- li a1, 1 # never return 0!
-1:
- move v0, a1
- j ra
-
-botch:
- jal longjmperror
- jal abort
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
-END(_longjmp)
diff --git a/libc/arch-mips64/bionic/setjmp.S b/libc/arch-mips64/bionic/setjmp.S
index a1d4695..b117bb6 100644..120000
--- a/libc/arch-mips64/bionic/setjmp.S
+++ b/libc/arch-mips64/bionic/setjmp.S
@@ -1,189 +1 @@
-/* $OpenBSD: setjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
-
-/*
- * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
- *
- * 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. Neither the name of Opsycon AB nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#include <private/bionic_asm.h>
-#include <machine/signal.h>
-
-/*
- * _setjmp, _longjmp (restoring signal state)
- *
- * GPOFF and FRAMESIZE must be the same for both _setjmp and _longjmp!
- *
- */
-
-FRAMESZ= MKFSIZ(2,6)
-A1OFF= FRAMESZ-4*REGSZ
-A0OFF= FRAMESZ-3*REGSZ
-GPOFF= FRAMESZ-2*REGSZ
-RAOFF= FRAMESZ-1*REGSZ
-
-NON_LEAF(setjmp, FRAMESZ, ra)
- .mask 0x80000000, RAOFF
- PTR_SUBU sp, FRAMESZ # allocate stack frame
- SETUP_GP64(GPOFF, setjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-#ifndef __LP64__
- addiu a0, 7 # roundup jmpbuf addr to 8-byte boundary
- li t0, ~7
- and a0, t0
-#endif
-
- REG_S ra, RAOFF(sp) # save state
- REG_S a0, A0OFF(sp)
- move a0, zero # get current signal mask
- jal sigblock
- REG_L a0, A0OFF(sp)
- REG_L ra, RAOFF(sp)
-
- REG_S v0, SC_MASK(a0) # save sc_mask = sigblock(0)
-
- li v0, 0xACEDBADE # sigcontext magic number
- sw v0, SC_MAGIC(a0)
- # callee-saved long-sized regs:
- REG_S ra, SC_REGS+0*REGSZ(a0)
- REG_S s0, SC_REGS+1*REGSZ(a0)
- REG_S s1, SC_REGS+2*REGSZ(a0)
- REG_S s2, SC_REGS+3*REGSZ(a0)
- REG_S s3, SC_REGS+4*REGSZ(a0)
- REG_S s4, SC_REGS+5*REGSZ(a0)
- REG_S s5, SC_REGS+6*REGSZ(a0)
- REG_S s6, SC_REGS+7*REGSZ(a0)
- REG_S s7, SC_REGS+8*REGSZ(a0)
- REG_S s8, SC_REGS+9*REGSZ(a0)
- REG_L v0, GPOFF(sp)
- REG_S v0, SC_REGS+10*REGSZ(a0)
- PTR_ADDU v0, sp, FRAMESZ
- REG_S v0, SC_REGS+11*REGSZ(a0)
-
- cfc1 v0, $31
-
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- s.d $f24, SC_FPREGS+0*REGSZ_FP(a0)
- s.d $f25, SC_FPREGS+1*REGSZ_FP(a0)
- s.d $f26, SC_FPREGS+2*REGSZ_FP(a0)
- s.d $f27, SC_FPREGS+3*REGSZ_FP(a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- s.d $f29, SC_FPREGS+5*REGSZ_FP(a0)
- s.d $f30, SC_FPREGS+6*REGSZ_FP(a0)
- s.d $f31, SC_FPREGS+7*REGSZ_FP(a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered fp regs $f20,$f22,...$f30
- s.d $f20, SC_FPREGS+0*REGSZ_FP(a0)
- s.d $f22, SC_FPREGS+1*REGSZ_FP(a0)
- s.d $f24, SC_FPREGS+2*REGSZ_FP(a0)
- s.d $f26, SC_FPREGS+3*REGSZ_FP(a0)
- s.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- s.d $f30, SC_FPREGS+5*REGSZ_FP(a0)
-#endif
- sw v0, SC_FPSR(a0)
- move v0, zero
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- j ra
-END(setjmp)
-
-
-NON_LEAF(longjmp, FRAMESZ, ra)
- .mask 0x80000000, RAOFF
- PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, longjmp)
- SAVE_GP(GPOFF)
- .set reorder
-
-#ifndef __LP64__
- addiu a0, 7 # roundup jmpbuf addr to 8-byte boundary
- li t0, ~7
- and a0, t0
-#endif
-
- REG_S a1, A1OFF(sp)
- REG_S a0, A0OFF(sp)
- lw a0, SC_MASK(a0)
- jal sigsetmask
- REG_L a0, A0OFF(sp)
- REG_L a1, A1OFF(sp)
-
- lw v0, SC_MAGIC(a0)
- li t0, 0xACEDBADE
- bne v0, t0, botch # jump if error
-
- # callee-saved long-sized regs:
- REG_L ra, SC_REGS+0*REGSZ(a0)
- REG_L s0, SC_REGS+1*REGSZ(a0)
- REG_L s1, SC_REGS+2*REGSZ(a0)
- REG_L s2, SC_REGS+3*REGSZ(a0)
- REG_L s3, SC_REGS+4*REGSZ(a0)
- REG_L s4, SC_REGS+5*REGSZ(a0)
- REG_L s5, SC_REGS+6*REGSZ(a0)
- REG_L s6, SC_REGS+7*REGSZ(a0)
- REG_L s7, SC_REGS+8*REGSZ(a0)
- REG_L s8, SC_REGS+9*REGSZ(a0)
- REG_L gp, SC_REGS+10*REGSZ(a0)
- REG_L sp, SC_REGS+11*REGSZ(a0)
-
- lw v0, SC_FPSR(a0)
- ctc1 v0, $31
-#ifdef __LP64__
- # callee-saved fp regs on mips n64 ABI are $f24..$f31
- l.d $f24, SC_FPREGS+0*REGSZ_FP(a0)
- l.d $f25, SC_FPREGS+1*REGSZ_FP(a0)
- l.d $f26, SC_FPREGS+2*REGSZ_FP(a0)
- l.d $f27, SC_FPREGS+3*REGSZ_FP(a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- l.d $f29, SC_FPREGS+5*REGSZ_FP(a0)
- l.d $f30, SC_FPREGS+6*REGSZ_FP(a0)
- l.d $f31, SC_FPREGS+7*REGSZ_FP(a0)
-#else
- # callee-saved fp regs on mips o32 ABI are
- # the even-numbered fp regs $f20,$f22,...$f30
- l.d $f20, SC_FPREGS+0*REGSZ_FP(a0)
- l.d $f22, SC_FPREGS+1*REGSZ_FP(a0)
- l.d $f24, SC_FPREGS+2*REGSZ_FP(a0)
- l.d $f26, SC_FPREGS+3*REGSZ_FP(a0)
- l.d $f28, SC_FPREGS+4*REGSZ_FP(a0)
- l.d $f30, SC_FPREGS+5*REGSZ_FP(a0)
-#endif
- bne a1, zero, 1f
- li a1, 1 # never return 0!
-1:
- move v0, a1
- j ra
-
-botch:
- jal longjmperror
- jal abort
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
-END(longjmp)
+../../arch-mips/bionic/setjmp.S \ No newline at end of file
diff --git a/libc/arch-mips64/bionic/sigsetjmp.S b/libc/arch-mips64/bionic/sigsetjmp.S
deleted file mode 100644
index 3ef0a6f..0000000
--- a/libc/arch-mips64/bionic/sigsetjmp.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $OpenBSD: sigsetjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
-/*-
- * Copyright (c) 1991, 1993, 1995,
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Havard Eidnes.
- *
- * 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. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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.
- */
-
-#include <private/bionic_asm.h>
-#include <machine/setjmp.h>
-
-/*
- * trampolines for sigsetjmp and siglongjmp save and restore mask.
- *
- */
-FRAMESZ= MKFSIZ(1,1)
-GPOFF= FRAMESZ-2*REGSZ
-
-LEAF(sigsetjmp, FRAMESZ)
- PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, sigsetjmp)
- .set reorder
- sw a1, _JBLEN*REGSZ(a0) # save "savemask"
- bne a1, 0x0, 1f # do saving of signal mask?
- LA t9, _setjmp
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- jr t9
-
-1: LA t9, setjmp
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- jr t9
-END(sigsetjmp)
-
-LEAF(siglongjmp, FRAMESZ)
- PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, siglongjmp)
- .set reorder
- lw t0, _JBLEN*REGSZ(a0) # get "savemask"
- bne t0, 0x0, 1f # restore signal mask?
- LA t9, _longjmp
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- jr t9
-1:
- LA t9, longjmp
- RESTORE_GP64
- PTR_ADDU sp, FRAMESZ
- jr t9
-END(siglongjmp)
diff --git a/libc/arch-mips64/mips64.mk b/libc/arch-mips64/mips64.mk
index b962283..6fa7d33 100644
--- a/libc/arch-mips64/mips64.mk
+++ b/libc/arch-mips64/mips64.mk
@@ -49,9 +49,7 @@ libc_openbsd_src_files_mips64 += \
libc_bionic_src_files_mips64 += \
arch-mips64/bionic/__bionic_clone.S \
arch-mips64/bionic/_exit_with_stack_teardown.S \
- arch-mips64/bionic/_setjmp.S \
arch-mips64/bionic/setjmp.S \
- arch-mips64/bionic/sigsetjmp.S \
arch-mips64/bionic/syscall.S \
arch-mips64/bionic/vfork.S \