Deleted Added
full compact
_setjmp.S (178580) _setjmp.S (209231)
1/* $NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $ */
1/* $NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $ */
2
3/*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *

--- 18 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#include <machine/asm.h>
2
3/*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *

--- 18 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#include <machine/asm.h>
36__FBSDID("$FreeBSD: head/lib/libc/mips/gen/_setjmp.S 178580 2008-04-26 12:08:02Z imp $");
36__FBSDID("$FreeBSD: head/lib/libc/mips/gen/_setjmp.S 209231 2010-06-16 12:55:14Z jchandra $");
37#include <machine/regnum.h>
38
37#include <machine/regnum.h>
38
39#include "SYS.h"
40
39#if defined(LIBC_SCCS) && !defined(lint)
41#if defined(LIBC_SCCS) && !defined(lint)
40 ASMSTR("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
41 ASMSTR("$NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $")
42#if 0
43 RCSID("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
44#else
45 RCSID("$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $")
46#endif
42#endif /* LIBC_SCCS and not lint */
43
47#endif /* LIBC_SCCS and not lint */
48
44#ifdef __ABICALLS__
45 .abicalls
46#endif
47
48/*
49 * C library -- _setjmp, _longjmp
50 *
51 * _longjmp(a,v)
52 * will generate a "return(v)" from
53 * the last call to
54 * _setjmp(a)
55 * by restoring registers from the stack,
56 * The previous signal state is NOT restored.
57 */
58
49/*
50 * C library -- _setjmp, _longjmp
51 *
52 * _longjmp(a,v)
53 * will generate a "return(v)" from
54 * the last call to
55 * _setjmp(a)
56 * by restoring registers from the stack,
57 * The previous signal state is NOT restored.
58 */
59
60 .set noreorder
59
60LEAF(_setjmp)
61
62LEAF(_setjmp)
61#ifdef __ABICALLS__
62 .set noreorder
63 .cpload t9
64 subu sp, sp, CALLFRAME_SIZ # allocate stack frame
65 .cprestore 16
63 REG_PROLOGUE
64 REG_LI v0, _JB_MAGIC__SETJMP
65 REG_S v0, (_JB_MAGIC * SZREG)(a0)
66 REG_S ra, (_JB_REG_RA * SZREG)(a0)
67 REG_S s0, (_JB_REG_S0 * SZREG)(a0)
68 REG_S s1, (_JB_REG_S1 * SZREG)(a0)
69 REG_S s2, (_JB_REG_S2 * SZREG)(a0)
70 REG_S s3, (_JB_REG_S3 * SZREG)(a0)
71 REG_S s4, (_JB_REG_S4 * SZREG)(a0)
72 REG_S s5, (_JB_REG_S5 * SZREG)(a0)
73 REG_S s6, (_JB_REG_S6 * SZREG)(a0)
74 REG_S s7, (_JB_REG_S7 * SZREG)(a0)
75 REG_S s8, (_JB_REG_S8 * SZREG)(a0)
76#if defined(__mips_n32) || defined(__mips_n64)
77 REG_S gp, (_JB_REG_GP * SZREG)(a0) # newabi gp is callee-saved
66#endif
78#endif
67 li v0, _JB_MAGIC__SETJMP
68 sw v0, (_JB_MAGIC * SZREG)(a0)
69 sw ra, (_JB_REG_RA * SZREG)(a0)
70 sw s0, (_JB_REG_S0 * SZREG)(a0)
71 sw s1, (_JB_REG_S1 * SZREG)(a0)
72 sw s2, (_JB_REG_S2 * SZREG)(a0)
73 sw s3, (_JB_REG_S3 * SZREG)(a0)
74 sw s4, (_JB_REG_S4 * SZREG)(a0)
75 sw s5, (_JB_REG_S5 * SZREG)(a0)
76 sw s6, (_JB_REG_S6 * SZREG)(a0)
77 sw s7, (_JB_REG_S7 * SZREG)(a0)
78 sw s8, (_JB_REG_S8 * SZREG)(a0)
79#ifdef __ABICALLS__
80 addu sp, sp, CALLFRAME_SIZ # un-allocate the stack frame
81#endif
82 sw sp, (_JB_REG_SP * SZREG)(a0)
79 REG_S sp, (_JB_REG_SP * SZREG)(a0)
80 REG_EPILOGUE
81
83 j ra
84 move v0, zero
85END(_setjmp)
86
87LEAF(_longjmp)
82 j ra
83 move v0, zero
84END(_setjmp)
85
86LEAF(_longjmp)
88#ifdef __ABICALLS__
89 .set noreorder
90 .cpload t9
91 subu sp, sp, CALLFRAME_SIZ # allocate stack frame
92 .cprestore 16
93#endif
94 lw v0, (_JB_MAGIC * SZREG)(a0)
95 lw ra, (_JB_REG_RA * SZREG)(a0)
96 li t0, _JB_MAGIC__SETJMP
97 bne v0, t0, botch # jump if error
98 lw s0, (_JB_REG_S0 * SZREG)(a0)
99 lw s1, (_JB_REG_S1 * SZREG)(a0)
100 lw s2, (_JB_REG_S2 * SZREG)(a0)
101 lw s3, (_JB_REG_S3 * SZREG)(a0)
102 lw s4, (_JB_REG_S4 * SZREG)(a0)
103 lw s5, (_JB_REG_S5 * SZREG)(a0)
104 lw s6, (_JB_REG_S6 * SZREG)(a0)
105 lw s7, (_JB_REG_S7 * SZREG)(a0)
106 lw sp, (_JB_REG_SP * SZREG)(a0)
107 lw s8, (_JB_REG_S8 * SZREG)(a0)
87 PIC_PROLOGUE(_longjmp)
88 PTR_SUBU sp, sp, CALLFRAME_SIZ
89 SAVE_GP(CALLFRAME_GP)
108
90
91 REG_PROLOGUE
92 REG_L v0, (_JB_MAGIC * SZREG)(a0) # get magic number
93 REG_L ra, (_JB_REG_RA * SZREG)(a0)
94 REG_LI t0, _JB_MAGIC__SETJMP
95 bne v0, t0, botch # jump if error
96 PTR_ADDU sp, sp, CALLFRAME_SIZ # does not matter, sanity
97 REG_L s0, (_JB_REG_S0 * SZREG)(a0)
98 REG_L s1, (_JB_REG_S1 * SZREG)(a0)
99 REG_L s2, (_JB_REG_S2 * SZREG)(a0)
100 REG_L s3, (_JB_REG_S3 * SZREG)(a0)
101 REG_L s4, (_JB_REG_S4 * SZREG)(a0)
102 REG_L s5, (_JB_REG_S5 * SZREG)(a0)
103 REG_L s6, (_JB_REG_S6 * SZREG)(a0)
104 REG_L s7, (_JB_REG_S7 * SZREG)(a0)
105#if defined(__mips_n32) || defined(__mips_n64)
106 REG_L gp, (_JB_REG_GP * SZREG)(a0)
107#endif
108 REG_L sp, (_JB_REG_SP * SZREG)(a0)
109 REG_L s8, (_JB_REG_S8 * SZREG)(a0)
110
111 REG_EPILOGUE
112 move v0, a1 # get return value in 1st arg
109 j ra
113 j ra
110 move v0, a1
114 nop
111
112botch:
115
116botch:
113 jal _C_LABEL(longjmperror)
117 /*
118 * We know we aren't returning so we don't care about restoring
119 * our caller's GP.
120 */
121 PTR_LA t9, _C_LABEL(longjmperror)
122 jalr t9
114 nop
123 nop
115 jal _C_LABEL(abort)
116 nop
124
125 PIC_TAILCALL(abort)
117END(_longjmp)
126END(_longjmp)