RE: X86 fpu registers in a signal handler's ucontext

2013-05-02 Thread Warlich, Christof
richard -rw- weinberger writes: > Are you telling us that Ubuntu shipped the wrong header file? Hmm - at least I still don't know how to get the right definition of uc_mcontext (with eglibc-2.13 on Ubuntu 11.10) ... If I include both signal.h and asm-generic/ucontext.h, gcc reports this error:

RE: X86 fpu registers in a signal handler's ucontext

2013-05-02 Thread Warlich, Christof
richard -rw- weinberger writes: > Are you telling us that Ubuntu shipped the wrong header file? Grmpf ... no. :-* Here again, I obviously started looking at the wrong file (i386-linux-gnu/sys/ucontext.h), which defines uc_mcontext to be of type mcontext_t. So the right header to be used seems t

RE: X86 fpu registers in a signal handler's ucontext

2013-05-01 Thread Warlich, Christof
Mikael Pettersson writes: > You're looking at the wrong header: glibc-2.17/sysdeps/i386/sys/ucontext.h is > legacy SVR4. > Instead look at glibc-2.17/sysdeps/unix/sysv/linux/x86/sys/ucontext.h. > > (If the old one got installed on your system then something there is > seriously wrong.) Oh-oh:

RE: X86 fpu registers in a signal handler's ucontext

2013-04-30 Thread Warlich, Christof
Mikael Pettersson writes: > Write to the fpstate ->mxcsr and ->swd fields in the sigaction handler's > uc_mcontext. To me, "sigaction handler's uc_mcontext" sounds like userspace, which really confuses me: Even in most recent glibc-2.17, uc_mcontext is of type mcontext_t, which us defined as:

RE: X86 fpu registers in a signal handler's ucontext

2013-04-29 Thread Warlich, Christof
Andi Kleen writes: > The FP registers are restored lazily, but the state for this is kept in > the kernel. I'm not sure if I understand "lazily" in this context: Do you mean that FP registers _are_ restored within the kernel, but _not_ from a (possibly modified) ucontext of a userspace signal han

X86 fpu registers in a signal handler's ucontext

2013-04-29 Thread Warlich, Christof
Hi, I want my signal handler to return from a SIGFPE and continue normal execution right _after_ the instruction that caused the signal. My first attempt workes quite well: I just modify the EIP register though the ucontext pointer being passed to the signal handler: void fpeHandler(int, siginfo