From: lars brinkhoff <[EMAIL PROTECTED]> Date: 18 Feb 2000 08:50:30 +0100
Mark Kettenis <[EMAIL PROTECTED]> writes: > From: Mariusz Woloszyn <[EMAIL PROTECTED]> > How can I determine the context of cr2 special register when the proces > caught SIGSEGV? The sigcontext structure defined in hurd in > /include/bits/sigcontext.h file does not contain the cr2 register. > The Hurd uses the same signal handler conventions as BSD, which means > that you can declare you signal handler as: > void handler (int sig, int code, struct sigcontext *scp) > For SIGSEGV, `code' is the faulting address. Also, how do you find out if it was a read or a write (or even exec) access? I don't know if there is an easy way. The `sc_error' member of the sigcontext is set to the error code that is generated by the Mach kernel in association with the fault. The KERN_WRITE_PROTECTION_FAILURE error code looks promising. The comment in <mach/kern_return.h> suggests that you can set VM_PROT_NOTIFY for the pages you're interested in such that this error code will be returned when you write to those pages. But I'm not sure this really works. Mark

