[klibc] [patch] alpha grab errno from right register after syscall

maximilian attems maks at sternwelten.at
Sat Dec 17 16:45:33 PST 2005

From: Steve Langasek <vorlon at debian.org> 

The next problem in line was that when trying to clear the initramfs to
free memory before overmounting, run-init was getting EPERM instead of
EISDIR when calling unlink() on directories.  After stepping through both
glibc and klibc linked binaries, I've concluded that the issue is simply
that klibc is trying to read the errno from the wrong register.

Initially, I was concerned this meant unlink was different from other
syscalls on alpha, which didn't make sense; then I realized that none of
the other syscalls I was looking at were *returning* a non-zero errno,
just a return value. 

verified by indepent test boots that both patches fixes alpha klibc.

Signed-off-by: maximilian attems <janitor at sternwelten.at>

--- libc-1.1.1.orig/klibc/arch/alpha/syscall.S      2005-09-06 13:49:34.000000000 -0700
+++ klibc-1.1.1/klibc/arch/alpha/syscall.S      2005-12-15 23:42:02.000000000 -0800
@@ -17,8 +17,8 @@
 	ldgp	gp, 0(pv)
 	lda	a1, errno
+	stl	v0, 0(a1)
 	lda	v0, -1(zero)
-	stl	a3, 0(a1)
 	ret	zero,(ra),1

More information about the klibc mailing list