[PATCH] Fix MIPS N64 build.

Steve Ellcey sellcey at mips.com
Fri Feb 28 00:12:47 UTC 2014


On Sat, 2014-02-15 at 11:14 +0100, Bernhard Reutner-Fischer wrote:
> On Fri, Feb 14, 2014 at 03:21:32PM +0100, Waldemar Brodkorb wrote:

> > Works for me, too.
> > Did you start any real machine or emulator with this? I get bus
> > errors after executing any application.
> 
> I suspect this needs a different register passing handling
> (__LONG_LONG_PAIR) then.

Waldemar,  I did run a pread/pwrite test case compiled with "-mips64r2
-mabi=n32" on both big-endian and a little-endian systems.  I did not
get a bus error in either case when calling pread or pwrite.  I also
tried calling pread64 and pwrite64 instead but those worked as well.  Do
you have a small test case that fails for you that you could send me?

I think the Bernhard's comment about __LONG_LONG_PAIR is correct and
my best guess as to the fix would be to change all of the

		__syscall_pwrite(fd, buf, count, offset)

lines in libc/sysdeps/linux/mips/pread_write.c to be:

		__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR ((long) (offset >> 31), (long) offset))

but I was hoping to reproduce the error first, then try this fix. Since
the current code works for me I am not sure how to test this change.

Note that when testing this I did use my current patch of changing
__NR_pread and __NR_write to __NR_pread64 and __NR_write64.

Steve Ellcey
sellcey at mips.com



More information about the uClibc mailing list