Subject: add a register to i386 sigcontext
To: None <tech-kern@netbsd.org>
From: Yorick Hardy <yh@metroweb.co.za>
List: tech-kern
Date: 03/27/2003 20:56:48
What are the opinions on adding the i386 cr2 register to
struct sigcontext ?
It seems it could be useful for wine (www.winehq.com).
I include a simple patch (probably not entirely correct)
against revision 1.14 of signal.h and revision 1.471.4.2 of
machdep.c below.
Thank you.
--
Yorick Hardy
--- sys/arch/i386/include/signal.h.orig Thu Mar 27 06:52:17 2003
+++ sys/arch/i386/include/signal.h Thu Mar 27 06:54:04 2003
@@ -101,6 +101,8 @@
int sc_esp;
int sc_ss;
+ int sc_cr2;
+
int sc_onstack; /* sigstack state to restore */
int __sc_mask13; /* signal mask to restore (old style) */
--- sys/arch/i386/i386/machdep.c.orig Thu Mar 27 07:10:58 2003
+++ sys/arch/i386/i386/machdep.c Thu Mar 27 07:50:06 2003
@@ -2073,6 +2073,7 @@
frame.sf_sc.sc_ss = tf->tf_ss;
frame.sf_sc.sc_trapno = tf->tf_trapno;
frame.sf_sc.sc_err = tf->tf_err;
+ frame.sf_sc.sc_cr2 = (p->p_addr->u_pcb).pcb_cr2;
/* Save signal stack. */
frame.sf_sc.sc_onstack = p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK;