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.

Discussed with:	imp, jhb
Reviewed by:	imp, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21330
This commit is contained in:
Kyle Evans 2019-08-22 21:43:21 +00:00
parent 428925b5f2
commit e21f96a811
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351409
8 changed files with 10 additions and 8 deletions

View File

@ -34,7 +34,6 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include <machine/regnum.h>
#include "SYS.h"

View File

@ -39,6 +39,7 @@ __RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
#include <sys/param.h>
#include <machine/abi.h>
#define _WANT_MIPS_REGNUM
#include <machine/regnum.h>
#include <stdarg.h>

View File

@ -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")

View File

@ -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 $")

View File

@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#define _WANT_MIPS_REGNUM
#include <sys/ptrace.h>
#include <err.h>

View File

@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#define _WANT_MIPS_REGNUM
#include <sys/procfs.h>
#include <ucontext.h>
#include <string.h>

View File

@ -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_ */

View File

@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#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>