summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-11-27 18:04:02 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-11-27 18:04:02 +0000
commita38b2fbb3705b793598a6e2cf7ce27746f398676 (patch)
treea417e6e13a8331dca2b2e34d65d8cc8da6d28574 /sys/kern
parent922d37fc9056808e0aba874018477acff6582bda (diff)
Add possibility to add flags to syscalls in syscalls.master to mark
syscalls as NOLOCK and MPSAFE. The flags have slightly different semantics: NOLOCK - the syscall doesn't grab any locks whatsoever. MPSAFE - the syscall deals with its own locking. What this means in practice is that NOLOCK syscalls can always be done without the biglock. The MPSAFE syscalls can be done without the biglock on CPUs that don't handle interrupts that require biglock (to preserve lock ordering). deraadt@ ok
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/makesyscalls.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh
index e641fe5df65..1f162b3fda3 100644
--- a/sys/kern/makesyscalls.sh
+++ b/sys/kern/makesyscalls.sh
@@ -1,5 +1,5 @@
#! /bin/sh -
-# $OpenBSD: makesyscalls.sh,v 1.10 2002/03/14 23:44:37 millert Exp $
+# $OpenBSD: makesyscalls.sh,v 1.11 2007/11/27 18:04:01 art Exp $
# $NetBSD: makesyscalls.sh,v 1.26 1998/01/09 06:17:51 thorpej Exp $
#
# Copyright (c) 1994,1996 Christopher G. Demetriou
@@ -247,6 +247,7 @@ function parserr(was, wanted) {
}
function parseline() {
f=3 # toss number and type
+ sycall_flags="0"
if ($NF != "}") {
funcalias=$NF
end=NF-1
@@ -254,6 +255,14 @@ function parseline() {
funcalias=""
end=NF
}
+ if ($f == "MPSAFE") { # allow MP-safe syscalls
+ sycall_flags = sprintf("SY_MPSAFE | %s", sycall_flags)
+ f++
+ }
+ if ($f == "NOLOCK") { # syscall does not need locks
+ sycall_flags = sprintf("SY_NOLOCK | %s", sycall_flags)
+ f++
+ }
if ($f ~ /^[a-z0-9_]*$/) { # allow syscall alias
funcalias=$f
f++
@@ -359,8 +368,8 @@ function putent(nodefs, compatwrap) {
# output syscall switch entry
if (nodefs == "INDIR") {
- printf("\t{ 0, 0,\n\t sys_nosys },\t\t\t/* %d = %s (indir) */\n", \
- syscall, funcalias) > sysent
+ printf("\t{ 0, 0, %s,\n\t sys_nosys },\t\t\t/* %d = %s (indir) */\n", \
+ sycall_flags, syscall, funcalias) > sysent
} else {
# printf("\t{ { %d", argc) > sysent
# for (i = 1; i <= argc; i++) {
@@ -382,7 +391,7 @@ function putent(nodefs, compatwrap) {
wfn = sprintf("%s", funcname);
else
wfn = sprintf("%s(%s)", compatwrap, funcname);
- printf(",\n\t %s },", wfn) > sysent
+ printf(", %s,\n\t %s },", sycall_flags, wfn) > sysent
for (i = 0; i < (33 - length(wfn)) / 8; i++)
printf("\t") > sysent
if (compatwrap == "")
@@ -451,7 +460,7 @@ $2 == "OBSOL" || $2 == "UNIMPL" {
for (i = 3; i <= NF; i++)
comment=comment " " $i
- printf("\t{ 0, 0,\n\t sys_nosys },\t\t\t/* %d = %s */\n", \
+ printf("\t{ 0, 0, 0,\n\t sys_nosys },\t\t\t/* %d = %s */\n", \
syscall, comment) > sysent
printf("\t\"#%d (%s)\",\t\t/* %d = %s */\n", \
syscall, comment, syscall, comment) > sysnames