aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2004-06-07 08:18:45 +0000
committerH. Peter Anvin <hpa@zytor.com>2004-06-07 08:18:45 +0000
commit64ebf2bd0f6393d271312af8aa264dd2297285ec (patch)
treecd326b84334b20c9da1447d8f6f0695c0055d89f
parentdfa23844ad5a19f4f9e542b52f5f5428f6afaa33 (diff)
downloadklibc-64ebf2bd0f6393d271312af8aa264dd2297285ec.tar.gz
Actually handle the gp correctly (needed to find errno, sigh; if pcklibc-0.120
was accessible we wouldn't have to do this in the fast path and replicate among each function. Oh well. It's a dead architecture anyway.)
-rw-r--r--klibc/arch/alpha/syscall.S4
-rw-r--r--klibc/arch/alpha/sysdual.S4
-rw-r--r--klibc/arch/alpha/sysstub.ph5
3 files changed, 9 insertions, 4 deletions
diff --git a/klibc/arch/alpha/syscall.S b/klibc/arch/alpha/syscall.S
index 99ecbe3ffa2b2..95dcbed49f210 100644
--- a/klibc/arch/alpha/syscall.S
+++ b/klibc/arch/alpha/syscall.S
@@ -10,12 +10,12 @@
.ent __syscall_common, 0
.globl __syscall_common
__syscall_common:
+ .frame sp,0,ra,0
callsys
- ldgp gp, 0(pv)
beq a3, 1f
lda a1, errno
lda v0, -1(zero)
- std a3, 0(a1)
+ stl a3, 0(a1)
1:
ret zero,(ra),1
diff --git a/klibc/arch/alpha/sysdual.S b/klibc/arch/alpha/sysdual.S
index a5933c1e50520..4ffbf7601ab43 100644
--- a/klibc/arch/alpha/sysdual.S
+++ b/klibc/arch/alpha/sysdual.S
@@ -16,13 +16,13 @@
.ent __syscall_dual1, 0
.globl __syscall_dual1
__syscall_dual1:
+ .frame sp,0,ra,0
callsys
mov v0, a4
- ldgp gp, 0(pv)
beq a3, 1f
lda a1, errno
lda v0, -1(zero)
- std a3, 0(a1)
+ stl a3, 0(a1)
1:
ret zero,(ra),1
diff --git a/klibc/arch/alpha/sysstub.ph b/klibc/arch/alpha/sysstub.ph
index a24b6c07dc81b..d1dc8275f2154 100644
--- a/klibc/arch/alpha/sysstub.ph
+++ b/klibc/arch/alpha/sysstub.ph
@@ -12,6 +12,10 @@
# A few system calls are dual-return with the second return value in
# r20 (a4).
+# In order to find errno, we need the gp, which is computed from the
+# pv register. This is two instructions, so the total length of the
+# stub is 4x4 = 16 bytes.
+
sub make_sysstub($$$$@) {
my($fname, $type, $sname, $stype, @args) = @_;
@@ -27,6 +31,7 @@ sub make_sysstub($$$$@) {
print OUT "\t.ent\t${fname}, 0\n"; # What is this?
print OUT "\t.globl ${fname}\n";
print OUT "${fname}:\n";
+ print OUT "\tldgp\tgp,0(pv)\n";
print OUT "\tlda\tv0, __NR_${sname}(zero)\n";
print OUT "\tbr __syscall_${stype}\n";
print OUT "\t.size\t${fname},.-${fname}\n";