tech-kern archive

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

Re: Proposed change to makesyscalls.sh



I'm still not totally sure if this change is worthwhile.  However, it
does resolve the issue in kern/45781, and it removes the need for the
work-around as currently implemented in

	src/sys/arch/usermode/modules/syscallemu/syscallemu.c

I really would appreciate feedback from others on whether or not this
change should be committed.

Aside from some very constructive feedback and lots of awk-foo from
kre@ I've seen no further feedback.  So I'm planning to commit these
changes (latest version incorporating kre's feedback is attached) in
the next couple of days.

Since this changes struct emul, it will require a kernel version bump;
if anyone else wants to coordinate commits and ride-the-bump, please
let me know!



+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+
Index: kern/makesyscalls.sh
===================================================================
RCS file: /cvsroot/src/sys/kern/makesyscalls.sh,v
retrieving revision 1.169
diff -u -p -r1.169 makesyscalls.sh
--- kern/makesyscalls.sh	10 May 2017 06:08:56 -0000	1.169
+++ kern/makesyscalls.sh	7 Aug 2018 21:36:07 -0000
@@ -855,9 +855,12 @@ function putent(type, compatwrap) {
 	if (argc != 0) {
 		printf("\n\t\tns(struct %s%s_args),", compatwrap_, funcname) > sysent
 	}
-	if (modular) 
+	if (modular) {
 		wfn = "sys_nomodule";
-	else if (compatwrap == "")
+		idx = int(syscall / 32);
+		bit = 2 ^ (syscall % 32);
+		nomodbits[ idx ] += bit;
+	} else if (compatwrap == "")
 		wfn = funcname;
 	else
 		wfn = compatwrap "(" funcname ")";
@@ -1126,6 +1129,13 @@ END {
 	}
 
 	maxsyscall = syscall
+
+	# XXX
+	# XXX The following comparisons with nsysent will produce
+	# XXX unexpected results if (for example) syscall has a
+	# XXX value of 900 and nsysent has a value of "1024".  We
+	# XXX probably ought to use int(nsysent) here...
+	# XXX
 	if (nsysent) {
 		if (syscall > nsysent) {
 			printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)
@@ -1142,6 +1152,16 @@ END {
 		}
 	}
 	printf("};\n") > sysent
+	printf("\nconst uint32_t %s_nomodbits[] = {\n", switchname) > sysent
+	printf("};\n") > rumpsysent
+	printf("\nconst uint32_t rump_sysent_nomodbits[] = {\n") > rumpsysent
+	for (i = 0; i < syscall; i += 32) {
+		printf("\t0x%08x,\t /* syscalls %3d-%3d */\n",
+			nomodbits[i / 32], i, i + 31) > sysent
+		printf("\t0x%08x,\t /* syscalls %3d-%3d */\n",
+			nomodbits[i / 32], i, i + 31) > rumpsysent
+	}
+	printf("};\n") > sysent
 	printf("};\n") > rumpsysent
 	printf("CTASSERT(__arraycount(rump_sysent) == SYS_NSYSENT);\n") > rumpsysent
 	printf("__strong_alias(rumpns_sysent,rump_sysent);\n") > rumpsysent


Home | Main Index | Thread Index | Old Index