RE: pread() and pwrite() system calls
From: David Laight <hidden>
Date: 2012-05-29 08:29:51
quoted
A special pread/pwrite asm stub that just copies r7 to r0 could be used. =20 Would it be enough to do: syscall_pread_pwrite: mov 0,7 sc blr and handle the -ve -> errno in C?=20 Huh? Won't fly, r0 is used for the system call number!
I was copying that from r7! Actually I have a much better stub by copying the one used for mmap(). The system call itself is fine. Using the system call almost halved the time taken for a 4-byte read.
On the other hand, I believed PPC had no problems passing up to 8 32 bit arguments in registers (r3 to r10), but I may be confusing with the standard ABI for function calls. =20 Hmm, a quick look at kernel/entry_32.s shows that it should=20 be able to use at least r3 to r8, which should be sufficient. =20 I think that it is an uClibc problem.
True, in that it isn't a kernel bug. OTOH the kernel is likely to get blamed for non-atomic pread. I've found the same user-space code in newlib as well. glibc may be ok, some code I've found implies it only uses the 'emulation' when the system call returns ENOSYS. David