Module Name: src
Committed By: jmcneill
Date: Sun Sep 4 21:08:18 UTC 2011
Modified Files:
src/sys/arch/usermode/conf: files.usermode
src/sys/arch/usermode/include: intr.h thunk.h
src/sys/arch/usermode/usermode: machdep.c thunk.c
Added Files:
src/sys/arch/usermode/usermode: intr.c
Log Message:
implement splraise/spllower
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/intr.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/usermode/intr.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/usermode/thunk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.9 src/sys/arch/usermode/conf/files.usermode:1.10
--- src/sys/arch/usermode/conf/files.usermode:1.9 Sat Sep 3 18:42:13 2011
+++ src/sys/arch/usermode/conf/files.usermode Sun Sep 4 21:08:18 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.9 2011/09/03 18:42:13 jmcneill Exp $
+# $NetBSD: files.usermode,v 1.10 2011/09/04 21:08:18 jmcneill Exp $
maxpartitions 8
maxusers 8 16 64
@@ -34,6 +34,7 @@
file arch/usermode/dev/genfb_thunkbus.c genfb_thunkbus
file arch/usermode/usermode/copy.c
+file arch/usermode/usermode/intr.c
file arch/usermode/usermode/machdep.c
file arch/usermode/usermode/pmap.c
file arch/usermode/usermode/process_machdep.c
Index: src/sys/arch/usermode/include/intr.h
diff -u src/sys/arch/usermode/include/intr.h:1.2 src/sys/arch/usermode/include/intr.h:1.3
--- src/sys/arch/usermode/include/intr.h:1.2 Wed Oct 21 16:06:59 2009
+++ src/sys/arch/usermode/include/intr.h Sun Sep 4 21:08:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.2 2009/10/21 16:06:59 snj Exp $ */
+/* $NetBSD: intr.h,v 1.3 2011/09/04 21:08:18 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -31,29 +31,13 @@
#include <machine/intrdefs.h>
-__inline static int
-splraise(int x)
-{
- extern int usermode_x;
- int oldx = usermode_x;
-
- usermode_x = x;
-
- return oldx;
-}
-
-__inline static void
-spllower(int x)
-{
- extern int usermode_x;
-
- usermode_x = x;
-}
+int splraise(int);
+void spllower(int);
#define spl0() spllower(IPL_NONE)
#define splx(x) spllower(x)
-typedef uint8_t ipl_t;
+typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;
Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.27 src/sys/arch/usermode/include/thunk.h:1.28
--- src/sys/arch/usermode/include/thunk.h:1.27 Sun Sep 4 20:46:58 2011
+++ src/sys/arch/usermode/include/thunk.h Sun Sep 4 21:08:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.27 2011/09/04 20:46:58 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.28 2011/09/04 21:08:18 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <[email protected]>
@@ -106,6 +106,8 @@
int thunk_sigaction(int, const struct sigaction *, struct sigaction *);
int thunk_sigaltstack(const stack_t *, stack_t *);
void thunk_signal(int, void (*)(int));
+int thunk_sigblock(int);
+int thunk_sigunblock(int);
int thunk_atexit(void (*function)(void));
int thunk_aio_read(struct aiocb *);
Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.22 src/sys/arch/usermode/usermode/machdep.c:1.23
--- src/sys/arch/usermode/usermode/machdep.c:1.22 Sat Sep 3 15:00:28 2011
+++ src/sys/arch/usermode/usermode/machdep.c Sun Sep 4 21:08:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.22 2011/09/03 15:00:28 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.23 2011/09/04 21:08:18 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -31,7 +31,7 @@
#include "opt_urkelvisor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.22 2011/09/03 15:00:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.23 2011/09/04 21:08:18 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -56,7 +56,6 @@
char machine[] = "usermode";
char machine_arch[] = "usermode";
-int usermode_x = IPL_NONE;
/* XXX */
int physmem = MEMSIZE * 1024 / PAGE_SIZE;
Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.31 src/sys/arch/usermode/usermode/thunk.c:1.32
--- src/sys/arch/usermode/usermode/thunk.c:1.31 Sun Sep 4 20:49:59 2011
+++ src/sys/arch/usermode/usermode/thunk.c Sun Sep 4 21:08:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.31 2011/09/04 20:49:59 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.32 2011/09/04 21:08:18 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <[email protected]>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.31 2011/09/04 20:49:59 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.32 2011/09/04 21:08:18 jmcneill Exp $");
#endif
#include <sys/types.h>
@@ -387,6 +387,26 @@
}
int
+thunk_sigblock(int sig)
+{
+ sigset_t set;
+
+ sigemptyset(&set);
+ sigaddset(&set, sig);
+ return sigprocmask(SIG_BLOCK, &set, NULL);
+}
+
+int
+thunk_sigunblock(int sig)
+{
+ sigset_t set;
+
+ sigemptyset(&set);
+ sigaddset(&set, sig);
+ return sigprocmask(SIG_UNBLOCK, &set, NULL);
+}
+
+int
thunk_atexit(void (*function)(void))
{
return atexit(function);
Added files:
Index: src/sys/arch/usermode/usermode/intr.c
diff -u /dev/null src/sys/arch/usermode/usermode/intr.c:1.1
--- /dev/null Sun Sep 4 21:08:18 2011
+++ src/sys/arch/usermode/usermode/intr.c Sun Sep 4 21:08:18 2011
@@ -0,0 +1,64 @@
+/* $NetBSD: intr.c,v 1.1 2011/09/04 21:08:18 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Jared D. McNeill <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.1 2011/09/04 21:08:18 jmcneill Exp $");
+
+#include <sys/types.h>
+
+#include <machine/intr.h>
+#include <machine/thunk.h>
+
+static int usermode_x = IPL_NONE;
+static bool usermode_sigalrm_blocked = false;
+
+int
+splraise(int x)
+{
+ int oldx = usermode_x;
+
+ if (x > IPL_VM && usermode_sigalrm_blocked == false) {
+ thunk_sigblock(SIGALRM);
+ usermode_sigalrm_blocked = true;
+ }
+
+ usermode_x = x;
+
+ return oldx;
+}
+
+void
+spllower(int x)
+{
+ if (x <= IPL_VM && usermode_sigalrm_blocked == true) {
+ thunk_sigunblock(SIGALRM);
+ usermode_sigalrm_blocked = false;
+ }
+
+ usermode_x = x;
+}