Source-Changes-HG archive

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

[src/trunk]: src/sys When returning 64bit values (from netbsd32_lseek) fix up...



details:   https://anonhg.NetBSD.org/src/rev/0967afd8f938
branches:  trunk
changeset: 582961:0967afd8f938
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jul 12 15:06:17 2005 +0000

description:
When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.

diffstat:

 sys/arch/sparc64/include/netbsd32_machdep.h |  13 ++++++++++++-
 sys/compat/netbsd32/netbsd32_netbsd.c       |  12 +++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r d360d41c7aa5 -r 0967afd8f938 sys/arch/sparc64/include/netbsd32_machdep.h
--- a/sys/arch/sparc64/include/netbsd32_machdep.h       Tue Jul 12 14:51:07 2005 +0000
+++ b/sys/arch/sparc64/include/netbsd32_machdep.h       Tue Jul 12 15:06:17 2005 +0000
@@ -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 @@
 
 #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 -r d360d41c7aa5 -r 0967afd8f938 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Tue Jul 12 14:51:07 2005 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Tue Jul 12 15:06:17 2005 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
                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



Home | Main Index | Thread Index | Old Index