diff --git a/sys/arch/sparc64/include/netbsd32_machdep.h b/sys/arch/sparc64/include/netbsd32_machdep.h index b84d1a79c5a9..3e1ef8bc8b58 100644 --- a/sys/arch/sparc64/include/netbsd32_machdep.h +++ b/sys/arch/sparc64/include/netbsd32_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_machdep.h,v 1.16 2004/02/20 16:11:44 drochner Exp $ */ +/* $NetBSD: netbsd32_machdep.h,v 1.17 2005/07/12 15:06:17 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -79,4 +79,15 @@ int netbsd32_md_ioctl(struct file *, netbsd32_u_long, void *, struct proc *); #define NETBSD32_MID_MACHINE MID_SPARC +/* + * When returning an off_t to userland, we need to modify the syscall + * retval array. We return a 64 bit value in %o0 (high) and %o1 (low) + * for 32bit userland. + */ +#define NETBSD32_OFF_T_RETURN(RV) \ + do { \ + (RV)[1] = (RV)[0]; \ + (RV)[0] >>= 32; \ + } while (0) + #endif /* _MACHINE_NETBSD32_H_ */ diff --git a/sys/compat/netbsd32/netbsd32_netbsd.c b/sys/compat/netbsd32/netbsd32_netbsd.c index d4f2b3858f1a..381d2d7eaca9 100644 --- a/sys/compat/netbsd32/netbsd32_netbsd.c +++ b/sys/compat/netbsd32/netbsd32_netbsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_netbsd.c,v 1.96 2005/07/12 07:45:34 cube Exp $ */ +/* $NetBSD: netbsd32_netbsd.c,v 1.97 2005/07/12 15:06:17 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.96 2005/07/12 07:45:34 cube Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.97 2005/07/12 15:06:17 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_ddb.h" @@ -1762,12 +1762,18 @@ netbsd32_lseek(l, v, retval) syscallarg(int) whence; } */ *uap = v; struct sys_lseek_args ua; + int rv; NETBSD32TO64_UAP(fd); NETBSD32TO64_UAP(pad); NETBSD32TO64_UAP(offset); NETBSD32TO64_UAP(whence); - return (sys_lseek(l, &ua, retval)); + rv = sys_lseek(l, &ua, retval); +#ifdef NETBSD32_OFF_T_RETURN + if (rv == 0) + NETBSD32_OFF_T_RETURN(retval); +#endif + return rv; } int