Recycle unused _REG_EXPEVT slot in mcontext for _REG_GBR.

As the size of mcontext is not changed, we avoid the hassle of
versioning all the calls that use it.

_REG_EXPEVT was never used by any code in the tree.  Reporting EXPEVT
makes sense only for signals and in that case we pass it to userland
in ksi_trap already which is official MI way to get this (MD) information.

Old binaries running on new kernels will now have their GBR set from
new mcontext, but that's ok too, as GBR was not properly supported by
old kernels (not saved in trapframe), so old binaries couldn't have
possibly used it anyway.
This commit is contained in:
uwe 2008-06-01 23:07:20 +00:00
parent 3b06569557
commit c39ae7f5d7
4 changed files with 15 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: _context_u.S,v 1.5 2006/01/04 17:44:53 uwe Exp $ */
/* $NetBSD: _context_u.S,v 1.6 2008/06/01 23:07:20 uwe Exp $ */
/*
* Copyright (c) 2003 Christian P. Groessler
@ -58,6 +58,9 @@
mov.l r14, @((_REG_R14 * 4), r1) ; \
/* _REG_R15 is too far to use @(disp, Rn) */ \
\
stc gbr, r0 ; \
mov.l r0, @((_REG_GBR * 4), r1) ; \
\
/* in Hitachi calling convention mac regs are callee saved */ \
sts mach, r0 ; \
mov.l r0, @((_REG_MACH * 4), r1) ; \
@ -93,6 +96,9 @@
mov.l @((_REG_R14 * 4), r1), r14 ; \
/* _REG_R15 is too far to use @(disp, Rn) */ \
\
mov.l @((_REG_GBR * 4), r1), r0 ; \
ldc r0, gbr ; \
\
/* in Hitachi calling convention mac regs are callee saved */ \
mov.l @((_REG_MACH * 4), r1), r0 ; \
mov.l @((_REG_MACL * 4), r1), r2 ; \

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.7 2008/04/28 20:23:02 martin Exp $
# $NetBSD: genassym.cf,v 1.8 2008/06/01 23:07:20 uwe Exp $
# Copyright (c) 2001 The NetBSD Foundation, Inc.
# All rights reserved.
@ -49,7 +49,7 @@ define _UC_FPU _UC_FPU
define _UC_USER _UC_USER
define _UC_USER_BIT _UC_USER_BIT
define _REG_EXPEVT _REG_EXPEVT
define _REG_GBR _REG_GBR
define _REG_PC _REG_PC
define _REG_SR _REG_SR
define _REG_MACL _REG_MACL

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.6 2008/04/28 20:23:35 martin Exp $ */
/* $NetBSD: mcontext.h,v 1.7 2008/06/01 23:07:20 uwe Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
typedef int __greg_t;
typedef __greg_t __gregset_t[_NGREG];
#define _REG_EXPEVT 0
#define _REG_GBR 0
#define _REG_PC 1
#define _REG_SR 2
#define _REG_MACL 3

View File

@ -1,4 +1,4 @@
/* $NetBSD: sh3_machdep.c,v 1.73 2008/06/01 00:46:01 uwe Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.74 2008/06/01 23:07:20 uwe Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.73 2008/06/01 00:46:01 uwe Exp $");
__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.74 2008/06/01 23:07:20 uwe Exp $");
#include "opt_kgdb.h"
#include "opt_memsize.h"
@ -583,7 +583,7 @@ cpu_getmcontext(l, mcp, flags)
__greg_t ras_pc;
/* Save register context. */
gr[_REG_EXPEVT] = tf->tf_expevt;
gr[_REG_GBR] = tf->tf_gbr;
gr[_REG_PC] = tf->tf_spc;
gr[_REG_SR] = tf->tf_ssr;
gr[_REG_MACL] = tf->tf_macl;
@ -632,7 +632,7 @@ cpu_setmcontext(l, mcp, flags)
if (((tf->tf_ssr ^ gr[_REG_SR]) & PSL_USERSTATIC) != 0)
return (EINVAL);
/* _REG_EXPEVT not restored */
tf->tf_gbr = gr[_REG_GBR];
tf->tf_spc = gr[_REG_PC];
tf->tf_ssr = gr[_REG_SR];
tf->tf_macl = gr[_REG_MACL];