[klibc] HUGE change soon coming to a klibc near you

Olaf Hering olh at suse.de
Mon Aug 23 16:38:50 PDT 2004

 On Mon, Aug 23, H. Peter Anvin wrote:

> Olaf Hering wrote:
> >
> >How does the new scheme deal with types? Some syscalls return int, some
> >void * or other things.
> >mmap on ppc64 would return a long int instead of a void *. errno is also
> >not handled correctly.
> >
> I'm a little confused by this statement -- is "long int" handled 
> differently than "void *" in the ppc64 calling convention?

Probably not. This patch fixes it for me, minips, sleep and printf works
now. ash does not work, some signal handling problems.

An error condition is flagged in the CR register, see
asm-ppc64/unistd.h how it was handled. I'm just checking that and return
gpr3 if its ok. Otherswise branch to the __syscall_error function, not
its descriptor :)

diff -purNx linux /tmp/klibc-0.167/klibc/arch/ppc64/sysstub.ph klibc-0.167/klibc/arch/ppc64/sysstub.ph
--- /tmp/klibc-0.167/klibc/arch/ppc64/sysstub.ph        2004-06-07 06:55:06.000000000 +0000
+++ klibc-0.167/klibc/arch/ppc64/sysstub.ph     2004-08-23 13:25:33.739727291 +0000
@@ -23,8 +23,10 @@ sub make_sysstub($$$$@) {
     print OUT ".${fname}:\n";
     print OUT "\tli 0,__NR_${sname}\n";
     print OUT "\tsc\n";
-    print OUT "\tbnslr\n";
-    print OUT "\tb __syscall_error\n";
+    print OUT "\tmfcr 0\n";
+    print OUT "\trldicl. 9,0,36,63\n";
+    print OUT "\tbeqlr- 0\n";
+    print OUT "\tb .__syscall_error\n";
     print OUT "\t.size .${fname},.-.${fname}\n";

USB is for mice, FireWire is for men!


More information about the klibc mailing list