Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137949512
D21330.id61126.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D21330.id61126.diff
View Options
Index: lib/libc/mips/gen/_setjmp.S
===================================================================
--- lib/libc/mips/gen/_setjmp.S
+++ lib/libc/mips/gen/_setjmp.S
@@ -34,7 +34,6 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-#include <machine/regnum.h>
#include "SYS.h"
Index: lib/libc/mips/gen/longjmp.c
===================================================================
--- lib/libc/mips/gen/longjmp.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $NetBSD: longjmp.c,v 1.1 2005/09/17 11:49:39 tsutsui Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christian Limpach and Matt Thomas.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#include "namespace.h"
-#include <sys/types.h>
-#include <ucontext.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <machine/regnum.h>
-
-void
-__longjmp14(jmp_buf env, int val)
-{
- struct sigcontext *sc = (void *)env;
- ucontext_t uc;
-
- /* Ensure non-zero SP and sigcontext magic number is present */
- if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != 0xACEDBADE)
- goto err;
-
- /* Ensure non-zero return value */
- if (val == 0)
- val = 1;
-
- /*
- * Set _UC_{SET,CLR}STACK according to SS_ONSTACK.
- *
- * Restore the signal mask with sigprocmask() instead of _UC_SIGMASK,
- * since libpthread may want to interpose on signal handling.
- */
- uc.uc_flags = _UC_CPU | (sc->sc_onstack ? _UC_SETSTACK : _UC_CLRSTACK);
-
- sigprocmask(SIG_SETMASK, &sc->sc_mask, NULL);
-
- /* Clear uc_link */
- uc.uc_link = 0;
-
- /* Save return value in context */
- uc.uc_mcontext.__gregs[_R_V0] = val;
-
- /* Copy saved registers */
- uc.uc_mcontext.__gregs[_REG_S0] = sc->sc_regs[_R_S0];
- uc.uc_mcontext.__gregs[_REG_S1] = sc->sc_regs[_R_S1];
- uc.uc_mcontext.__gregs[_REG_S2] = sc->sc_regs[_R_S2];
- uc.uc_mcontext.__gregs[_REG_S3] = sc->sc_regs[_R_S3];
- uc.uc_mcontext.__gregs[_REG_S4] = sc->sc_regs[_R_S4];
- uc.uc_mcontext.__gregs[_REG_S5] = sc->sc_regs[_R_S5];
- uc.uc_mcontext.__gregs[_REG_S6] = sc->sc_regs[_R_S6];
- uc.uc_mcontext.__gregs[_REG_S7] = sc->sc_regs[_R_S7];
- uc.uc_mcontext.__gregs[_REG_S8] = sc->sc_regs[_R_S8];
- uc.uc_mcontext.__gregs[_REG_SP] = sc->sc_regs[_R_SP];
- uc.uc_mcontext.__gregs[_REG_RA] = sc->sc_regs[_R_RA];
- uc.uc_mcontext.__gregs[_REG_EPC] = sc->sc_pc;
-
- /* Copy FP state */
- if (sc->sc_fpused) {
- /* FP saved regs are $f20 .. $f31 */
- memcpy(&uc.uc_mcontext.__fpregs.__fp_r.__fp_regs[20],
- &sc->sc_fpregs[20], 32 - 20);
- uc.uc_mcontext.__fpregs.__fp_csr =
- sc->sc_fpregs[_R_FSR - _FPBASE];
- /* XXX sc_fp_control */
- uc.uc_flags |= _UC_FPU;
- }
-
- setcontext(&uc);
- err:
- longjmperror();
- abort();
- /* NOTREACHED */
-}
Index: lib/libc/mips/gen/makecontext.c
===================================================================
--- lib/libc/mips/gen/makecontext.c
+++ lib/libc/mips/gen/makecontext.c
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <machine/abi.h>
+#define _WANT_MIPS_REGNUM
#include <machine/regnum.h>
#include <stdarg.h>
Index: lib/libc/mips/gen/setjmp.S
===================================================================
--- lib/libc/mips/gen/setjmp.S
+++ lib/libc/mips/gen/setjmp.S
@@ -34,7 +34,6 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-#include <machine/regnum.h>
#if defined(LIBC_SCCS) && !defined(lint)
ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
Index: lib/libc/mips/gen/sigsetjmp.S
===================================================================
--- lib/libc/mips/gen/sigsetjmp.S
+++ lib/libc/mips/gen/sigsetjmp.S
@@ -34,7 +34,6 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-#include <machine/regnum.h>
#if defined(LIBC_SCCS) && !defined(lint)
ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $")
Index: lib/libproc/proc_regs.c
===================================================================
--- lib/libproc/proc_regs.c
+++ lib/libproc/proc_regs.c
@@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#define _WANT_MIPS_REGNUM
#include <sys/ptrace.h>
#include <err.h>
Index: lib/libthread_db/arch/mips/libpthread_md.c
===================================================================
--- lib/libthread_db/arch/mips/libpthread_md.c
+++ lib/libthread_db/arch/mips/libpthread_md.c
@@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#define _WANT_MIPS_REGNUM
#include <sys/procfs.h>
#include <ucontext.h>
#include <string.h>
Index: stand/libsa/mips/_setjmp.S
===================================================================
--- stand/libsa/mips/_setjmp.S
+++ stand/libsa/mips/_setjmp.S
@@ -36,7 +36,6 @@
* $FreeBSD$
*/
-#include <machine/regnum.h>
#include <machine/asm.h>
#if 0
@@ -59,19 +58,19 @@
LEAF(_setjmp)
.set noreorder
- REG_LI v0, 0xACEDBADE # sigcontext magic number
- REG_S ra, (2 * SZREG)(a0) # sc_pc = return address
- REG_S v0, (3 * SZREG)(a0) # saved in sc_regs[0]
- REG_S s0, ((S0 + 3) * SZREG)(a0)
- REG_S s1, ((S1 + 3) * SZREG)(a0)
- REG_S s2, ((S2 + 3) * SZREG)(a0)
- REG_S s3, ((S3 + 3) * SZREG)(a0)
- REG_S s4, ((S4 + 3) * SZREG)(a0)
- REG_S s5, ((S5 + 3) * SZREG)(a0)
- REG_S s6, ((S6 + 3) * SZREG)(a0)
- REG_S s7, ((S7 + 3) * SZREG)(a0)
- REG_S sp, ((SP + 3) * SZREG)(a0)
- REG_S s8, ((S8 + 3) * SZREG)(a0)
+ REG_LI v0, _JB_MAGIC__SETJMP # sigcontext magic number
+ REG_S v0, (_JB_MAGIC * SZREG)(a0) # saved in sc_regs[0]
+ REG_S ra, (_JB_REG_RA * SZREG)(a0) # sc_pc = return address
+ REG_S s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_S s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_S s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_S s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_S s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_S s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_S s6, (_JG_REG_S6 * SZREG)(a0)
+ REG_S s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_S sp, (_JB_REG_SP * SZREG)(a0)
+ REG_S s8, (_JB_REG_S8 * SZREG)(a0)
j ra
move v0, zero
END(_setjmp)
@@ -82,21 +81,21 @@
.cprestore 16
#endif
.set noreorder
- REG_L v0, (3 * SZREG)(a0) # get magic number
- REG_L ra, (2 * SZREG)(a0)
- bne v0, 0xACEDBADE, botch # jump if error
+ REG_L v0, (_JB_MAGIC * SZREG)(a0) # get magic number
+ REG_L ra, (_JB_REG_RA * SZREG)(a0)
+ bne v0, _JB_MAGIC__SETJMP, botch # jump if error
addu sp, sp, 32 # does not matter, sanity
- REG_L s0, ((S0 + 3) * SZREG)(a0)
- REG_L s1, ((S1 + 3) * SZREG)(a0)
- REG_L s2, ((S2 + 3) * SZREG)(a0)
- REG_L s3, ((S3 + 3) * SZREG)(a0)
- REG_L s4, ((S4 + 3) * SZREG)(a0)
- REG_L s5, ((S5 + 3) * SZREG)(a0)
- REG_L s6, ((S6 + 3) * SZREG)(a0)
- REG_L s7, ((S7 + 3) * SZREG)(a0)
- REG_L sp, ((SP + 3) * SZREG)(a0)
- REG_L s8, ((S8 + 3) * SZREG)(a0)
+ REG_L s0, (_JB_REG_S0 * SZREG)(a0)
+ REG_L s1, (_JB_REG_S1 * SZREG)(a0)
+ REG_L s2, (_JB_REG_S2 * SZREG)(a0)
+ REG_L s3, (_JB_REG_S3 * SZREG)(a0)
+ REG_L s4, (_JB_REG_S4 * SZREG)(a0)
+ REG_L s5, (_JB_REG_S5 * SZREG)(a0)
+ REG_L s6, (_JB_REG_S6 * SZREG)(a0)
+ REG_L s7, (_JB_REG_S7 * SZREG)(a0)
+ REG_L sp, (_JB_REG_SP * SZREG)(a0)
+ REG_L s8, (_JB_REG_S8 * SZREG)(a0)
j ra
move v0, a1
Index: sys/mips/include/regnum.h
===================================================================
--- sys/mips/include/regnum.h
+++ sys/mips/include/regnum.h
@@ -44,11 +44,15 @@
#ifndef _MACHINE_REGNUM_H_
#define _MACHINE_REGNUM_H_
+#define NUMSAVEREGS 40
+#define NUMFPREGS 34
+
/*
* Location of the saved registers relative to ZERO.
* This must match struct trapframe defined in frame.h exactly.
* This must also match regdef.h.
*/
+#if defined(_KERNEL) || defined(_WANT_MIPS_REGNUM)
#define ZERO 0
#define AST 1
#define V0 2
@@ -105,7 +109,6 @@
*/
#define IC 38
#define DUMMY 39 /* for 8 byte alignment */
-#define NUMSAVEREGS 40
/*
* Pseudo registers so we save a complete set of registers regardless of
@@ -164,10 +167,6 @@
#define FSR (FPBASE+32)
#define FIR (FPBASE+33)
-#define NUMFPREGS 34
-
-#define NREGS (NUMSAVEREGS + NUMFPREGS)
-
/*
* Index of FP registers in 'struct frame', relative to the base
* of the FP registers in frame (i.e., *not* including the general
@@ -208,4 +207,6 @@
#define FSR_NUM (32)
#define FIR_NUM (33)
+#endif /* _KERNEL || _WANT_MIPS_REGNUM */
+
#endif /* !_MACHINE_REGNUM_H_ */
Index: tests/sys/kern/ptrace_test.c
===================================================================
--- tests/sys/kern/ptrace_test.c
+++ tests/sys/kern/ptrace_test.c
@@ -33,6 +33,7 @@
#include <sys/time.h>
#include <sys/procctl.h>
#include <sys/procdesc.h>
+#define _WANT_MIPS_REGNUM
#include <sys/ptrace.h>
#include <sys/queue.h>
#include <sys/runq.h>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 28, 2:36 PM (13 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26286106
Default Alt Text
D21330.id61126.diff (9 KB)
Attached To
Mode
D21330: mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM
Attached
Detach File
Event Timeline
Log In to Comment