On Tue, Jan 17, 2006 at 06:00:09AM +0100, Herbert Poetzl wrote:
> stumbled over a strange issue (no patches available yet)
> dietlibc has on hppa (or parisc), and it seems to me
> that other archs could (should?) be affected too ...
> 
> syscalls.s/_llseek.S  defines the llseek function as
> direct branch/call to the unified syscall wrapper
> (which I think is wrong too, but to that later)
> 
> now, on hppa/parisc the calling convention uses r26-r23
> for the first four arguments, the rest is spilled onto
> the stack. however the Linux kernel passes the first 
> six arguments in the registers r26-r21.
> 
> as the llseek syscall takes five arguments, this leads
> to random arguments for the r22 (whence argument) and
> strange failures like this:
> 
> _llseek(3, 0, 0xc00202d0, 0x4047f444 /* SEEK_??? */) = 
>       -1 EINVAL (Invalid argument)

Hi, I had a similar problem with recvfrom() and sendto() syscalls, and
applied the patch below to the dietlibc Debian package.  I can't provide
a real solution though, I'm afraid.

Regards, Gerrit.


Index: parisc/recvfrom.S
===================================================================
RCS file: /cvs/dietlibc/parisc/recvfrom.S,v
retrieving revision 1.1
diff -u -r1.1 recvfrom.S
--- parisc/recvfrom.S   20 Jul 2002 13:29:27 -0000      1.1
+++ parisc/recvfrom.S   20 Dec 2005 12:29:14 -0000
@@ -1,3 +1,12 @@
 #include "syscalls.h"
 
-syscall(recvfrom, recvfrom);
+.level 1.1
+.globl recvfrom
+.type recvfrom,@function
+recvfrom:
+       /* Just load the arguments from the
+          stack into %r21 and %r22  */
+       ldw -56(%sr0, %sp), %r21 ; 0x78
+       ldw -52(%sr0, %sp), %r22 ; 0x74
+       b __unified_syscall
+       ldi __NR_recvfrom, %r20
Index: parisc/sendto.S
===================================================================
RCS file: /cvs/dietlibc/parisc/sendto.S,v
retrieving revision 1.1
diff -u -r1.1 sendto.S
--- parisc/sendto.S     20 Jul 2002 13:29:27 -0000      1.1
+++ parisc/sendto.S     20 Dec 2005 12:29:15 -0000
@@ -1,3 +1,12 @@
 #include "syscalls.h"
 
-syscall(sendto, sendto);
+.level 1.1
+.globl sendto
+.type sendto,@function
+sendto:
+       /* Just load the arguments from the
+          stack into %r21 and %r22  */
+       ldw -56(%sr0, %sp), %r21 ; 0x78
+       ldw -52(%sr0, %sp), %r22 ; 0x74
+       b __unified_syscall
+       ldi __NR_sendto, %r20


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to