signal-handling tweaks for mips/mips64
Alexandre Oliva
aoliva@redhat.com
Sat Apr 12 09:28:00 GMT 2003
It was reported to me that ucontext is utterly broken, even in o32
with a stable 32-bit mips kernel. Indeed, it doesn't match the
ucontext structure defined by the kernel at all. This means that
programs taking real-time signals in o32 won't be able to extract
correct information from the mcontext_t, since the kernel puts data in
there that's in an entirely different format.
I've looked for any ways in which the current data structures could
possibly be useful, and didn't find any. gdb and rda thought they
were using the register arrays, but it turned out they were using the
arrays in procps instead. makecontext(), [sg]etcontext() et al aren't
implemented on mips, so any uses thereof will just return ENOSYS,
without messing with the given data structure. So, I believe it is
not too late for us to fix it such that it matches the kernel data
structures.
While at that, I fixed a number of incompatibilities introduced by
either differences between kernel headers that we used to include,
whose contents are different depending on whether asm points to
asm-mips or asm-mips64.
With this patch, after some pending kernel patches are checked in, one
will be able to obtain the correct information from signal handlers in
all mips ABIs. With n64, this is already true. With o32, it works
with the 32-bit mips kernel, but the mips64 kernel needs a patch to
implement the proper sigcontext ABI. n32 still a patch to be
developed for it to be possible for ucontext to be POSIX-compliant.
Currently, the kernel uses the same ucontext for n32 and n64, but this
doesn't work in n32 because uc_link must be a pointer and stack_t must
contain a pointer and a size_t, whose sizes differ between n32 and
n64. I believe Ralf is working on a patch for the kernel to generate
n32-compliant ucontext when invoking signal handlers in n32 processes.
The only uncertainty is whether uc_flags will be a 32- or 64-bit value
in n32; I left it as the latter, just because I already had that in
place; if it changes, a (simplifying) follow-up patch will be posted.
However, I wanted to circulate the idea of fixing ucontext_t for o32
as soon as possible, so I didn't wait for a decision on the exact n32
ABI.
Ok to install?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips-sigstuff.patch
Type: text/x-patch
Size: 14626 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20030412/fdaf661b/attachment.bin>
-------------- next part --------------
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
More information about the Libc-alpha
mailing list