Subject: passing faulted-upon address, couldn't find -pr
To: None <port-i386@NetBSD.ORG>
From: VaX#n8 <vax@linkdead.paranoia.com>
List: port-i386
Date: 05/27/1996 01:53:25
I submitted a patch that supercedes Number 851, and I looked
for it a while back (or for that matter, any pr's made by user "vax")
and couldn't find -any-.  I have lost all records of this, and wonder if
it ever made it.

In case it didn't, here it is.  If you're worried about binary compatibility,
this may break things.  It may also be safer to put the sf_addr at the
end of the struct (I notice some things already have
/* XXX should be elsewhere */ or something like that, probably for this
reason).

I use this all the time, in fact I patch my tree with it every time I come
up to -current so I guess it's reasonably safe.

--- sys/arch/i386/i386/machdep.c.orig	Thu Feb  1 06:22:34 1996
+++ sys/arch/i386/i386/machdep.c	Sat Mar  9 19:08:27 1996
@@ -539,6 +539,7 @@
 
 	frame.sf_code = code;
 	frame.sf_scp = &fp->sf_sc;
+	frame.sf_addr = (char *)rcr2();
 	frame.sf_handler = catcher;
 
 	/*
@@ -577,6 +578,9 @@
 	frame.sf_sc.sc_cs = tf->tf_cs;
 	frame.sf_sc.sc_esp = tf->tf_esp;
 	frame.sf_sc.sc_ss = tf->tf_ss;
+
+	/* Exp. hack */
+	frame.sf_sc.sc_cr2    = rcr2();
 
 	if (copyout(&frame, fp, sizeof(frame)) != 0) {
 		/*
--- sys/arch/i386/include/frame.h.orig	Fri Oct 13 20:57:34 1995
+++ sys/arch/i386/include/frame.h	Sat Mar  9 19:03:25 1996
@@ -117,6 +117,7 @@
 	int	sf_signum;
 	int	sf_code;
 	struct	sigcontext *sf_scp;
+	char	*sf_addr;
 	sig_t	sf_handler;
 	struct	sigcontext sf_sc;
 };
--- sys/arch/i386/include/signal.h.orig	Tue Jan  9 06:23:06 1996
+++ sys/arch/i386/include/signal.h	Sat Mar  9 19:03:36 1996
@@ -72,6 +72,8 @@
 	int	sc_esp;
 	int	sc_ss;
 
+	int	sc_cr2;			/* page fault linear address */
+
 	int	sc_onstack;		/* sigstack state to restore */
 	int	sc_mask;		/* signal mask to restore */