2007-08-26  Daniel Jacobowitz  <dan@codesourcery.com>

	* defs.h [MIPS]: Include <sgidefs.h>.
	(MAX_QUALS): Update for MIPS.
	(LINUX_MIPSO32, LINUX_MIPSN32, LINUX_MIPSN64, LINUX_MIPS64): Define.
	(struct tcb): Add ext_arg for MIPS N32.
	(TCB_WAITEXECVE): Define for MIPS.
	(ALIGN64): Use LINUX_MIPSO32.
	* file.c (sys_lseek): Use ext_arg for MIPS N32.
	(sys_readahead, sys_fadvise64_64): Likewise.
	* io.c (sys_pread64, sys_pwrite64): Likewise.
	* mem.c (print_mmap): Take OFFSET argument.
	(sys_old_mmap): Update call to print_mmap.
	(sys_mmap): Use ext_arg for MIPS N32.
	* process.c (struct_user_offsets): Add MIPS registers.
	* signal.c (sys_sigreturn): Handle MIPS N32 and MIPS N64.  Correct
	MIPS O32 call to sprintsigmask.
	* syscall.c (internal_syscall): Handle MIPS N32.  Check for
	TCB_WAITEXECVE on MIPS.
	(force_result): Add a comment about MIPS N32.
	(syscall_enter): Handle MIPS N32 and MIPS N64.
	* linux/syscall.h (sys_pread64, sys_pwrite64): Declare.
	* linux/mips/syscallent.h: Include "dummy.h".  Handle alternate
	MIPS ABIs.
diff --git a/io.c b/io.c
index 5896634..add3fb6 100644
--- a/io.c
+++ b/io.c
@@ -360,8 +360,12 @@
 			tprintf("%#lx", tcp->u_arg[1]);
 		else
 			printstr(tcp, tcp->u_arg[1], tcp->u_rval);
+#ifdef MIPS_LINUXN32
+		tprintf(", %lu, %#llx", tcp->u_arg[2], tcp->ext_arg[3]);
+#else
 		tprintf(", %lu, %#llx", tcp->u_arg[2],
 			LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
+#endif
 	}
 	return 0;
 }
@@ -374,8 +378,12 @@
 		ALIGN64 (tcp, 3);
 		tprintf("%ld, ", tcp->u_arg[0]);
 		printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+#ifdef MIPS_LINUXN32
+		tprintf(", %lu, %#llx", tcp->u_arg[2], tcp->ext_arg[3]);
+#else
 		tprintf(", %lu, %#llx", tcp->u_arg[2],
 			LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
+#endif
 	}
 	return 0;
 }