Sat Mar 26 11:57:32 2016 UTC ()
Do not store FP registers in softfloat userland


(martin)
diff -r1.2 -r1.3 src/lib/libc/compat/arch/mips/gen/compat_setjmp.S

cvs diff -r1.2 -r1.3 src/lib/libc/compat/arch/mips/gen/compat_setjmp.S (expand / switch to unified diff)

--- src/lib/libc/compat/arch/mips/gen/compat_setjmp.S 2009/12/14 03:04:33 1.2
+++ src/lib/libc/compat/arch/mips/gen/compat_setjmp.S 2016/03/26 11:57:32 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: compat_setjmp.S,v 1.2 2009/12/14 03:04:33 matt Exp $ */ 1/* $NetBSD: compat_setjmp.S,v 1.3 2016/03/26 11:57:32 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991, 1993 4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell. 8 * Ralph Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/syscall.h> 35#include <sys/syscall.h>
36#include <mips/asm.h> 36#include <mips/asm.h>
37 37
38#include "assym.h" 38#include "assym.h"
39 39
40#if defined(LIBC_SCCS) && !defined(lint) 40#if defined(LIBC_SCCS) && !defined(lint)
41#if 0 41#if 0
42 RCSID("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") 42 RCSID("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
43#else 43#else
44 RCSID("$NetBSD: compat_setjmp.S,v 1.2 2009/12/14 03:04:33 matt Exp $") 44 RCSID("$NetBSD: compat_setjmp.S,v 1.3 2016/03/26 11:57:32 martin Exp $")
45#endif 45#endif
46#endif /* LIBC_SCCS and not lint */ 46#endif /* LIBC_SCCS and not lint */
47 47
48/* 48/*
49 * C library -- setjmp, longjmp 49 * C library -- setjmp, longjmp
50 * 50 *
51 * longjmp(a,v) 51 * longjmp(a,v)
52 * will generate a "return(v)" from 52 * will generate a "return(v)" from
53 * the last call to 53 * the last call to
54 * setjmp(a) 54 * setjmp(a)
55 * by restoring registers from the stack, 55 * by restoring registers from the stack,
56 * and a struct sigcontext, see <signal.h> 56 * and a struct sigcontext, see <signal.h>
57 */ 57 */
@@ -101,50 +101,54 @@ NON_LEAF(setjmp, SETJMP_FRAME_SIZE, ra) @@ -101,50 +101,54 @@ NON_LEAF(setjmp, SETJMP_FRAME_SIZE, ra)
101 REG_LI v0, 0xACEDBADE # sigcontext magic number 101 REG_LI v0, 0xACEDBADE # sigcontext magic number
102 REG_S v0, _OFFSETOF_SC_REGS(a0) # saved in sc_regs[0] 102 REG_S v0, _OFFSETOF_SC_REGS(a0) # saved in sc_regs[0]
103 REG_S s0, _OFFSETOF_SC_REGS_S0(a0) 103 REG_S s0, _OFFSETOF_SC_REGS_S0(a0)
104 REG_S s1, _OFFSETOF_SC_REGS_S1(a0) 104 REG_S s1, _OFFSETOF_SC_REGS_S1(a0)
105 REG_S s2, _OFFSETOF_SC_REGS_S2(a0) 105 REG_S s2, _OFFSETOF_SC_REGS_S2(a0)
106 REG_S s3, _OFFSETOF_SC_REGS_S3(a0) 106 REG_S s3, _OFFSETOF_SC_REGS_S3(a0)
107 REG_S s4, _OFFSETOF_SC_REGS_S4(a0) 107 REG_S s4, _OFFSETOF_SC_REGS_S4(a0)
108 REG_S s5, _OFFSETOF_SC_REGS_S5(a0) 108 REG_S s5, _OFFSETOF_SC_REGS_S5(a0)
109 REG_S s6, _OFFSETOF_SC_REGS_S6(a0) 109 REG_S s6, _OFFSETOF_SC_REGS_S6(a0)
110 REG_S s7, _OFFSETOF_SC_REGS_S7(a0) 110 REG_S s7, _OFFSETOF_SC_REGS_S7(a0)
111 REG_S gp, _OFFSETOF_SC_REGS_GP(a0) 111 REG_S gp, _OFFSETOF_SC_REGS_GP(a0)
112 REG_S sp, _OFFSETOF_SC_REGS_SP(a0) 112 REG_S sp, _OFFSETOF_SC_REGS_SP(a0)
113 REG_S s8, _OFFSETOF_SC_REGS_S8(a0) 113 REG_S s8, _OFFSETOF_SC_REGS_S8(a0)
 114#ifdef SOFTFLOAT_FOR_GCC
 115 INT_S zero, _OFFSETOF_SC_FPUSED(a0) # sc_fpused = 0
 116#else
114 li v0, 1 # be nice if we could tell 117 li v0, 1 # be nice if we could tell
115 INT_S v0, _OFFSETOF_SC_FPUSED(a0) # sc_fpused = 1 118 INT_S v0, _OFFSETOF_SC_FPUSED(a0) # sc_fpused = 1
116 cfc1 v0, $31 119 cfc1 v0, $31
117 INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0) 120 INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
118#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32) 121#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32)
119 FP_S $f20, _OFFSETOF_SC_FPREGS_F20(a0) 122 FP_S $f20, _OFFSETOF_SC_FPREGS_F20(a0)
120 FP_S $f22, _OFFSETOF_SC_FPREGS_F22(a0) 123 FP_S $f22, _OFFSETOF_SC_FPREGS_F22(a0)
121#endif 124#endif
122#if defined(__mips_o32) || defined(__mips_o64) 125#if defined(__mips_o32) || defined(__mips_o64)
123 FP_S $f21, _OFFSETOF_SC_FPREGS_F21(a0) 126 FP_S $f21, _OFFSETOF_SC_FPREGS_F21(a0)
124 FP_S $f23, _OFFSETOF_SC_FPREGS_F23(a0) 127 FP_S $f23, _OFFSETOF_SC_FPREGS_F23(a0)
125#endif 128#endif
126#if defined(__mips_n32) || defined(__mips_n64) 129#if defined(__mips_n32) || defined(__mips_n64)
127 FP_S $f24, _OFFSETOF_SC_FPREGS_F24(a0) 130 FP_S $f24, _OFFSETOF_SC_FPREGS_F24(a0)
128 FP_S $f26, _OFFSETOF_SC_FPREGS_F26(a0) 131 FP_S $f26, _OFFSETOF_SC_FPREGS_F26(a0)
129 FP_S $f28, _OFFSETOF_SC_FPREGS_F28(a0) 132 FP_S $f28, _OFFSETOF_SC_FPREGS_F28(a0)
130 FP_S $f30, _OFFSETOF_SC_FPREGS_F30(a0) 133 FP_S $f30, _OFFSETOF_SC_FPREGS_F30(a0)
131#endif 134#endif
132#if defined(__mips_n64) 135#if defined(__mips_n64)
133 FP_S $f25, _OFFSETOF_SC_FPREGS_F25(a0) 136 FP_S $f25, _OFFSETOF_SC_FPREGS_F25(a0)
134 FP_S $f27, _OFFSETOF_SC_FPREGS_F27(a0) 137 FP_S $f27, _OFFSETOF_SC_FPREGS_F27(a0)
135 FP_S $f29, _OFFSETOF_SC_FPREGS_F29(a0) 138 FP_S $f29, _OFFSETOF_SC_FPREGS_F29(a0)
136 FP_S $f31, _OFFSETOF_SC_FPREGS_F31(a0) 139 FP_S $f31, _OFFSETOF_SC_FPREGS_F31(a0)
137#endif 140#endif
 141#endif /* SOFTFLOAT_FOR_GCC */
138 REG_EPILOGUE 142 REG_EPILOGUE
139 j ra 143 j ra
140 move v0, zero 144 move v0, zero
141 145
142botch: 146botch:
143 jal _C_LABEL(abort) 147 jal _C_LABEL(abort)
144END(setjmp) 148END(setjmp)
145 149
146LEAF(longjmp) 150LEAF(longjmp)
147 SETUP_GP 151 SETUP_GP
148 PTR_SUBU sp, sp, CALLFRAME_SIZ 152 PTR_SUBU sp, sp, CALLFRAME_SIZ
149 SAVE_GP(CALLFRAME_S0) 153 SAVE_GP(CALLFRAME_S0)
150 SETUP_GP64(s0, longjmp) 154 SETUP_GP64(s0, longjmp)