aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-01-21 03:09:10 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-01-21 03:19:12 +0000
commitfb7fdfa873f980d71b3acafea381af77e927cace (patch)
tree4f682f8988477dd24f1dd95ad5aa5d5dd97c966f
parentcc71445234fcd4f74b137cdebd10136e882cd289 (diff)
downloadklibc-fb7fdfa873f980d71b3acafea381af77e927cace.tar.gz
[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@decadent.org.uk>
-rw-r--r--usr/klibc/arch/alpha/sysdual.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr/klibc/arch/alpha/sysdual.S b/usr/klibc/arch/alpha/sysdual.S
index 1719e3746f47e..03e719d505a2e 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