diff options
author | Stefan Liebler <stli@linux.ibm.com> | 2023-12-15 09:26:40 +0100 |
---|---|---|
committer | Stefan Liebler <stli@linux.ibm.com> | 2023-12-19 11:00:19 +0100 |
commit | 664f565f9caa26bb128bad7d7050cf0f0b9c6322 (patch) | |
tree | b26446bc1d347bc0c858f28d17545b00df308cbf /sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S | |
parent | e957308723ac2e55dad360d602298632980bbd38 (diff) | |
download | glibc-664f565f9caa26bb128bad7d7050cf0f0b9c6322.tar.gz glibc-664f565f9caa26bb128bad7d7050cf0f0b9c6322.tar.xz glibc-664f565f9caa26bb128bad7d7050cf0f0b9c6322.zip |
s390: Set psw addr field in getcontext and friends.
So far if the ucontext structure was obtained by getcontext and co, the return address was stored in general purpose register 14 as it is defined as return address in the ABI. In contrast, the context passed to a signal handler contains the address in psw.addr field. If somebody e.g. wants to dump the address of the context, the origin needs to be known. Now this patch adjusts getcontext and friends and stores the return address also in psw.addr field. Note that setcontext isn't adjusted and it is not supported to pass a ucontext structure from signal-handler to setcontext. We are not able to restore all registers and branching to psw.addr without clobbering one register.
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S')
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S index eaa4f3ba19..4bf85c152c 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S @@ -66,6 +66,12 @@ ENTRY(__swapcontext) /* Store general purpose registers. */ stmg %r0,%r15,SC_GPRS(%r1) + /* Store psw mask to 0x0 and addr to return address. Then the address + can be retrieved from the ucontext structure in the same way as if it + is created by kernel and passed to a signal-handler. */ + stg %r2,SC_PSW+0(%r1) + stg %r14,SC_PSW+8(%r1) + /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask, sigsetsize). */ la %r2,SIG_SETMASK |