Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

netbsd32 syscalls sy_flags



Hi,
I've been trying to run code meant for MIPS o32 ABI on MIPS n32.

Background:
Both of them run under netbsd32 compat (when running mips64).
MIPS o32 ABI calling convention says there are 4 registers meant for
passing arguments, the rest go onto the stack.
Also, o32 has 32bit registers.

So a syscall with 64bit parameters has to be split up to using two
arguments/stack slots.

The code within sys/arch/mips/mips/syscall.c expects to know which
arguments are 64bit through callp->sy_flags for its own logic.

However, when making an lseek call, it seems to have sy_flags=0, so it
treats all the arguments as being 32bit, and grabs the upper half of the
offset as "whence" (usually zero), which is broken.

(The relevant code is in lines 205 onwards...

It tells a given argument is 64bit using:

    213 		unsigned int arg64mask = SYCALL_ARG_64_MASK(callp);

Where:

    154 #define	SYCALL_ARG_64_MASK(sy)	(((sy)->sy_flags >> 17) & 0xff)

(From sys/sys/systm.h)

From trying to put dummy code in lib/libc/sys/lseek.c, GCC seems to
think that the call does have a 64bit argument in it, and splits it up.

But the flags are still zero, and most calls in
sys/compat/netbsd32/netbsd32_syscalls.c doesn't seem to have flags
specified for it.

Is this a case of the flags being wrong, or GCC being misled somehow?


Home | Main Index | Thread Index | Old Index