Subject: Re: [Q] How to get faulted-upon address, hacks wanted
To: None <tech-kern@NetBSD.ORG,>
From: Mike Hibler <>
List: tech-kern
Date: 08/24/1995 15:11:39
> From: VaX#n8 <>
> Subject: [Q] How to get faulted-upon address, hacks wanted
> To: tech-kern@NetBSD.ORG
> Date: Thu, 24 Aug 1995 14:05:29 -0500 (CDT)
> I -really- need to get the faulted-upon address in a signal handler.
> Linux has a field in it's sigcontext called cr2, which is evidently an
> obscure name for some kind of effective-address field.
I don't know if there is any "standard" way to do it, but it has been done
in the past by various people by recording the address in the "code" argument
for SIGSEGV and SIGBUS.  The hp300 code does this in 4.4bsd and may still
in netbsd.

If you are thinking about fixing up the fault yourself and then returning
to re-execute, here is something else to check.  Make sure that the faulting
instruction gets re-executed on return from the handler.  In old 68k kernels,
it would often return to the next instruction which was easier as it didn't
require saving/restoring all the exception state required to restart/continue
the faulting instruction.

BTW: you once asked about the VM system, I was recently told that the
original Mach paper on the VM system is now online at CMU: