Fix parameters of signal handlers for linuxppc.
authorGeorge Koehler <xkernigh@netscape.net>
Sun, 22 Jan 2017 05:52:32 +0000 (00:52 -0500)
committerGeorge Koehler <xkernigh@netscape.net>
Sun, 22 Jan 2017 05:52:32 +0000 (00:52 -0500)
commita585ddf578479853c73b4948fbf143306ff4b142
treea89243ced290dea4ebaa212659715c195fe51fef
parent5aa2ac2246e23eac95f66447cfc6c532a4173717
Fix parameters of signal handlers for linuxppc.

Linux passes the arguments in registers, but our compiler expects
arguments on the stack.  Signal handlers got garbage instead of the
signal number.  Some handlers, like the one in lang/m2/libm2/sigtrp.c,
need the correct signal number.

I write a "bridge" in PowerPC assembly that moves the arguments to the
stack.  I put the bridge in sigaction(), so I provide a signal() that
calls sigaction().  I remove the *.c glob or wildcard from build.lua,
so linuxppc only compiles its own signal.c, not the other signal.c for
linux386 and linux68k.

My bridge uses sigprocmask(), so I also add sigprocmask().  Because
linux386 and linux68k use globs, they also get sigprocmask().  I sync
the header files so all three Linux platforms declare execve(),
sigprocmask(), and unlink(), but not remove(), because we have
remove() in <stdio.h>.

I am using sigaction.s to test some features that we recently added to
our PowerPC assembler.  These are the "hi16[...]" and "lo16[...]"
syntax, and also the extended names like "beq", "cmpwi", "li", "subi".
plat/linux/libsys/sigprocmask.c [new file with mode: 0644]
plat/linux386/include/unistd.h
plat/linux68k/include/unistd.h
plat/linuxppc/include/unistd.h
plat/linuxppc/libsys/build.lua
plat/linuxppc/libsys/sigaction.s [new file with mode: 0644]
plat/linuxppc/libsys/signal.c [new file with mode: 0644]