set_mcontext()/grab_mcontext()

Konstantin Belousov kostikbel at gmail.com
Sun Mar 23 16:00:52 UTC 2014


On Wed, Mar 19, 2014 at 10:13:25PM -0700, Justin Hibbits wrote:
> Running into problems with X exiting during a sigreturn(2) on my G4
> PowerBooks, it seems sometimes bit 10 is set in the mc_srr1 field,
> which, from the documentation, can only be set by hardware on an
> external interrupt.
> 
> Looking at the references closer, bits 1-4, 10-15 (ppc32), also
> numbered as bits 33-36, 42-47 (ppc64) are for exception-specific
> information only.  I'm wondering if it makes sense to mask these off
> when setting and getting the context, as those bits are useless upon an
> rfi.
> 
> I know this is probably simply a band-aid for possible corruption in X,
> but to me it makes sense, as the context data is useful only when
> entering the interrupt context, not when context is restored (bits are
> localized, not restored to MSR).

Late reply, I saw that you already committed r263464.

Traditionally, the sigreturn(2)/setcontext(2) are strict, in particular,
on FreeBSD. E.g., on i386/amd64 any reserved bit in %{e.r}flags,
which is closest analog of PPC msr, or even a reserved flag in the
software-defined mc_flags field, cause EINVAL. Due to the construction
of the signal trampoline code, return from sigreturn(2) without applying
passed context causes trap.

I think it is useful to keep this behaviour consistent between architectures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ppc/attachments/20140323/1d0acaaf/attachment.sig>


More information about the freebsd-ppc mailing list