]> sourceware.org Git - glibc.git/commit
hppa: Fix swapcontext
authorJohn David Anglin <danglin@gcc.gnu.org>
Fri, 18 Feb 2022 20:38:25 +0000 (20:38 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Thu, 3 Mar 2022 21:18:21 +0000 (21:18 +0000)
commit2631d3b3a68108661deca311c3fc159a4ce62983
treee177b4ce88bb3d2686e7571f97130dfbbcb55beb
parent1f770811785e6c79db995b0390d1ef4e67e87d44
hppa: Fix swapcontext

This change fixes the failure of stdlib/tst-setcontext2 and
stdlib/tst-setcontext7 on hppa.  The implementation of swapcontext
in C is broken.  C saves the return pointer (rp) and any non
call-clobbered registers (in this case r3, r4 and r5) on the
stack.  However, the setcontext call in swapcontext pops the
stack and subsequent calls clobber the saved registers.  When
the context in oucp is restored, both tests fault.

Here we rewrite swapcontext in assembly code to avoid using
the stack for register values that need to be used after
restoration.  The getcontext and setcontext routines are
revised to save and restore register ret1 for normal returns.
We copy the oucp pointer to ret1.  This allows access to
the old context after calling getcontext and setcontext.

(cherry picked from commit 71b108d7eb33b2bf3e61d5e92d2a47f74c1f7d96)
sysdeps/unix/sysv/linux/hppa/getcontext.S
sysdeps/unix/sysv/linux/hppa/setcontext.S
sysdeps/unix/sysv/linux/hppa/swapcontext.c
This page took 0.037679 seconds and 5 git commands to generate.