This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sigaltstack setting and RT signal handlers


Geoff Keating writes:

> > Likewise, is it reasonable to expect that a signal handler can change
> > the register values of the interrupted context by altering
> > ucp->uc_mcontext?
> 
> Yes, in fact glibc uses this to set bits in the MSR.  I can think of
> other applications for it involving virtual machines.

Hmmm, I knew about glibc using this to set FE0 and FE1 in the MSR,
which was always bogus since the change wouldn't stick if you lost the
FPU and then got it back (in which case the kernel would set both FE0
and FE1 in the MSR).

These days glibc should be using prctl() with the PR_SET_FPEXC option.
This option has been in 2.5 for a while and recently also went into
2.4.21-pre4.  Current kernels ignore the MSR value in the signal frame
completely.  The MSR isn't part of the user-visible process context
anyway.

The reason I asked (about signal handlers changing the saved register
image) is that I am about to add code to save and restore the altivec
registers on signal delivery.  Since most processes don't use altivec
instructions, and there are 512 bytes of altivec registers, I want to
avoid saving and restoring the altivec registers for those processes
that have never used altivec instructions.

> I'm not sure about the 'likewise' part.  There should be _a_ way for a
> signal handler to change the sigaltstack setting, but since this is
> not portable it doesn't have to be particularly clean.

How about the sys_sigaltstack system call? :)

Why would a signal handler need to change the sigaltstack setting?
Can you give me an example?

Paul.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]