svn commit: r351792 - in stable: 11/lib/libc/mips/gen 11/lib/libproc 11/lib/libthread_db/arch/mips 11/stand/libsa/mips 11/sys/mips/include 11/tests/sys/kern 12/lib/libc/mips/gen 12/lib/libproc 12/l...
Kyle Evans
kevans at FreeBSD.org
Tue Sep 3 20:19:45 UTC 2019
Author: kevans
Date: Tue Sep 3 20:19:43 2019
New Revision: 351792
URL: https://svnweb.freebsd.org/changeset/base/351792
Log:
MFC r351408-r351410: reduce pollution from mips machine/regnum.h
r351408:
libsa: mips: use _JB_* from machine/asm.h, remove regnum dep
This brings the libsa/mips _setjmp implementation closer to parity with the
libc version.
r351409:
mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM
machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via
machine/reg.h. Many of the regnum definitions are too short and too generic
to be exposing to any userland application including one of these two
headers. Moreover, these actively cause build failures in googletest
(template <typename T1 ...> expanding to template <typename 9 ...>).
Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of
the userland consumers to define as needed.
r351410:
libsa: mips: fix typo that had slipped into the diff on local machine
Modified:
stable/11/lib/libc/mips/gen/_setjmp.S
stable/11/lib/libc/mips/gen/makecontext.c
stable/11/lib/libc/mips/gen/setjmp.S
stable/11/lib/libc/mips/gen/sigsetjmp.S
stable/11/lib/libproc/proc_regs.c
stable/11/lib/libthread_db/arch/mips/libpthread_md.c
stable/11/stand/libsa/mips/_setjmp.S
stable/11/sys/mips/include/regnum.h
stable/11/tests/sys/kern/ptrace_test.c
Directory Properties:
stable/11/ (props changed)
Changes in other areas also in this revision:
Modified:
stable/12/lib/libc/mips/gen/_setjmp.S
stable/12/lib/libc/mips/gen/makecontext.c
stable/12/lib/libc/mips/gen/setjmp.S
stable/12/lib/libc/mips/gen/sigsetjmp.S
stable/12/lib/libproc/proc_regs.c
stable/12/lib/libthread_db/arch/mips/libpthread_md.c
stable/12/stand/libsa/mips/_setjmp.S
stable/12/sys/mips/include/regnum.h
stable/12/tests/sys/kern/ptrace_test.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/11/lib/libc/mips/gen/_setjmp.S
==============================================================================
--- stable/11/lib/libc/mips/gen/_setjmp.S Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libc/mips/gen/_setjmp.S Tue Sep 3 20:19:43 2019 (r351792)
@@ -34,7 +34,6 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
-#include <machine/regnum.h>
#include "SYS.h"
Modified: stable/11/lib/libc/mips/gen/makecontext.c
==============================================================================
--- stable/11/lib/libc/mips/gen/makecontext.c Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libc/mips/gen/makecontext.c Tue Sep 3 20:19:43 2019 (r351792)
@@ -36,6 +36,7 @@ __RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07
#endif
#include <sys/param.h>
+#define _WANT_MIPS_REGNUM
#include <machine/regnum.h>
#include <stdarg.h>
Modified: stable/11/lib/libc/mips/gen/setjmp.S
==============================================================================
--- stable/11/lib/libc/mips/gen/setjmp.S Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libc/mips/gen/setjmp.S Tue Sep 3 20:19:43 2019 (r351792)
@@ -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")
Modified: stable/11/lib/libc/mips/gen/sigsetjmp.S
==============================================================================
--- stable/11/lib/libc/mips/gen/sigsetjmp.S Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libc/mips/gen/sigsetjmp.S Tue Sep 3 20:19:43 2019 (r351792)
@@ -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 $")
Modified: stable/11/lib/libproc/proc_regs.c
==============================================================================
--- stable/11/lib/libproc/proc_regs.c Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libproc/proc_regs.c Tue Sep 3 20:19:43 2019 (r351792)
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#define _WANT_MIPS_REGNUM
#include <sys/ptrace.h>
#include <err.h>
Modified: stable/11/lib/libthread_db/arch/mips/libpthread_md.c
==============================================================================
--- stable/11/lib/libthread_db/arch/mips/libpthread_md.c Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/lib/libthread_db/arch/mips/libpthread_md.c Tue Sep 3 20:19:43 2019 (r351792)
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#define _WANT_MIPS_REGNUM
#include <sys/procfs.h>
#include <ucontext.h>
#include <string.h>
Modified: stable/11/stand/libsa/mips/_setjmp.S
==============================================================================
--- stable/11/stand/libsa/mips/_setjmp.S Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/stand/libsa/mips/_setjmp.S Tue Sep 3 20:19:43 2019 (r351792)
@@ -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, (_JB_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 @@ LEAF(_longjmp)
.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
Modified: stable/11/sys/mips/include/regnum.h
==============================================================================
--- stable/11/sys/mips/include/regnum.h Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/sys/mips/include/regnum.h Tue Sep 3 20:19:43 2019 (r351792)
@@ -42,11 +42,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
@@ -103,7 +107,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
@@ -162,10 +165,6 @@
#define FSR (FPBASE+32)
#define FSR_DUMMY (FPBASE+33) /* For 8 byte alignment */
-#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
@@ -204,5 +203,7 @@
#define F30_NUM (30)
#define F31_NUM (31)
#define FSR_NUM (32)
+
+#endif /* _KERNEL || _WANT_MIPS_REGNUM */
#endif /* !_MACHINE_REGNUM_H_ */
Modified: stable/11/tests/sys/kern/ptrace_test.c
==============================================================================
--- stable/11/tests/sys/kern/ptrace_test.c Tue Sep 3 20:15:06 2019 (r351791)
+++ stable/11/tests/sys/kern/ptrace_test.c Tue Sep 3 20:19:43 2019 (r351792)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/time.h>
#include <sys/procctl.h>
+#define _WANT_MIPS_REGNUM
#include <sys/ptrace.h>
#include <sys/queue.h>
#include <sys/runq.h>
More information about the svn-src-all
mailing list