Module Name:    src
Committed By:   matt
Date:           Sun Dec 13 04:47:46 UTC 2009

Modified Files:
        src/sys/kern: makesyscalls.sh
        src/sys/sys: systm.h

Log Message:
Pullup from matt-nb5-mips64.

For each syscall, add a flag for the return value or an argument indicating
that it is a 64-bit argument.  Also include the number of 64-bit arguments.
In theory this could get most of the code in compat/netbsd32/netbsd32_netbsd.c
but not at the moment due to multiply defined structures.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/kern/makesyscalls.sh
cvs rdiff -u -r1.237 -r1.238 src/sys/sys/systm.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.91 src/sys/kern/makesyscalls.sh:1.92
--- src/sys/kern/makesyscalls.sh:1.91	Thu Nov 26 17:23:48 2009
+++ src/sys/kern/makesyscalls.sh	Sun Dec 13 04:47:45 2009
@@ -1,5 +1,5 @@
 #! /bin/sh -
-#	$NetBSD: makesyscalls.sh,v 1.91 2009/11/26 17:23:48 pooka Exp $
+#	$NetBSD: makesyscalls.sh,v 1.92 2009/12/13 04:47:45 matt Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -440,6 +440,12 @@
 		funcname=funcstdname
 		wantrename=0
 	}
+	if (returntype == "quad_t" || returntype == "off_t") {
+		if (sycall_flags == "0")
+			sycall_flags = "SYCALL_RET_64";
+		else
+			sycall_flags = "SYCALL_RET_64 | " sycall_flags;
+	}
 
 	if (funcalias == "") {
 		funcalias=funcname
@@ -473,6 +479,7 @@
 	# and do not need argument structures built.
 
 	isvarargs = 0;
+	args64 = 0;
 	while (f <= end) {
 		if ($f == "...") {
 			f++;
@@ -501,9 +508,18 @@
 		} else {
 			argalign++;
 		}
+		if (argtype[argc] == "quad_t" || argtype[argc] == "off_t") {
+			if (sycall_flags == "0")
+				sycall_flags = "SYCALL_ARG"argc-1"_64";
+			else
+				sycall_flags = "SYCALL_ARG"argc-1"_64 | " sycall_flags;
+			args64++;
+		}
 		argname[argc]=$f;
 		f += 2;			# skip name, and any comma
 	}
+	if (args64 > 0)
+		sycall_flags = "SYCALL_NARGS64_VAL("args64") | " sycall_flags;
 	# must see another argument after varargs notice.
 	if (isvarargs) {
 		if (argc == varargc)

Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.237 src/sys/sys/systm.h:1.238
--- src/sys/sys/systm.h:1.237	Tue Nov  3 05:23:28 2009
+++ src/sys/sys/systm.h	Sun Dec 13 04:47:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.237 2009/11/03 05:23:28 dyoung Exp $	*/
+/*	$NetBSD: systm.h,v 1.238 2009/12/13 04:47:45 matt Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -128,7 +128,22 @@
 #error	"what byte order is this machine?"
 #endif
 
-#define	SYCALL_INDIRECT	0x0002	/* indirect (ie syscall() or __syscall()) */
+#define	SYCALL_INDIRECT	0x0000002 /* indirect (ie syscall() or __syscall()) */
+#define	SYCALL_NARGS64_MASK	0x000f000 /* count of 64bit args */
+#define SYCALL_RET_64	0x0010000 /* retval is a 64bit integer value */
+#define SYCALL_ARG0_64  0x0020000
+#define SYCALL_ARG1_64  0x0040000
+#define SYCALL_ARG2_64  0x0080000
+#define SYCALL_ARG3_64  0x0100000
+#define SYCALL_ARG4_64  0x0200000
+#define SYCALL_ARG5_64  0x0400000
+#define SYCALL_ARG6_64  0x0800000
+#define SYCALL_ARG7_64  0x1000000
+#define SYCALL_RET_64_P(sy)	((sy)->sy_flags & SYCALL_RET_64)
+#define SYCALL_ARG_64_P(sy, n)	((sy)->sy_flags & (SYCALL_ARG0_64 << (n)))
+#define	SYCALL_ARG_64_MASK(sy)	(((sy)->sy_flags >> 17) & 0xff)
+#define	SYCALL_NARGS64(sy)	(((sy)->sy_flags >> 12) & 0x0f)
+#define	SYCALL_NARGS64_VAL(n)	((n) << 12)
 
 extern int boothowto;		/* reboot flags, from console subsystem */
 #define	bootverbose	(boothowto & AB_VERBOSE)

Reply via email to