klibc-bot for Ben Hutchings
2019-Jan-21 03:27 UTC
[klibc] [klibc:master] alpha: Fix dual1 system call wrapper
Commit-ID: fb7fdfa873f980d71b3acafea381af77e927cace Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=fb7fdfa873f980d71b3acafea381af77e927cace Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Mon, 21 Jan 2019 03:09:10 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Mon, 21 Jan 2019 03:19:12 +0000 [klibc] alpha: Fix dual1 system call wrapper Several get*id() system calls are paired up on alpha, returning one ID in v0 (usual return register) and another ID in a4. The "dual1" system call wrapper is used when we want the second ID from a4. This system call wrapper had a fatal bug: it moves v0 to a4, but it needs to do the opposite. Also, in case of error, it stored the error flag (a3) to errno rather than the error code (v0). Rearrange the code so we only change v0 at the bottom of the function, and store the original value of v0 to errno before that. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/klibc/arch/alpha/sysdual.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/klibc/arch/alpha/sysdual.S b/usr/klibc/arch/alpha/sysdual.S index 1719e37..03e719d 100644 --- a/usr/klibc/arch/alpha/sysdual.S +++ b/usr/klibc/arch/alpha/sysdual.S @@ -18,15 +18,15 @@ __syscall_dual1: .frame sp,0,ra,0 callsys - mov v0, a4 beq a3, 1f br pv, 2f # pv <- pc 2: ldgp gp, 0(pv) lda a1, errno - lda v0, -1(zero) - stl a3, 0(a1) + stl v0, 0(a1) + lda a4, -1(zero) 1: + mov a4, v0 ret zero,(ra),1 .size __syscall_dual1,.-__syscall_dual1
Reasonably Related Threads
- [klibc 21/43] alpha support for klibc
- [klibc:execstack-fixes] alpha: Set sa_restorer for signals and disable executable stack
- [klibc:execstack-fixes] alpha: Set sa_restorer for signals and disable executable stack
- [klibc:master] alpha: Pass restorer to rt_sigaction() and disable executable stack
- [patch] alpha grab errno from right register after syscall