| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: threads.c,v 1.4 2009/12/01 09:50:51 pooka Exp $ */ | | 1 | /* $NetBSD: threads.c,v 1.5 2009/12/03 12:16:36 pooka Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2007-2009 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2007-2009 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Development of this software was supported by | | 6 | * Development of this software was supported by |
7 | * The Finnish Cultural Foundation. | | 7 | * The Finnish Cultural Foundation. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | __KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.4 2009/12/01 09:50:51 pooka Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.5 2009/12/03 12:16:36 pooka Exp $"); |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/kmem.h> | | 35 | #include <sys/kmem.h> |
36 | #include <sys/kthread.h> | | 36 | #include <sys/kthread.h> |
37 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
38 | | | 38 | |
39 | #include <machine/stdarg.h> | | 39 | #include <machine/stdarg.h> |
40 | | | 40 | |
41 | #include <rump/rumpuser.h> | | 41 | #include <rump/rumpuser.h> |
42 | | | 42 | |
43 | #include "rump_private.h" | | 43 | #include "rump_private.h" |
44 | | | 44 | |
45 | struct kthdesc { | | 45 | struct kthdesc { |
| @@ -109,26 +109,30 @@ kthread_create(pri_t pri, int flags, str | | | @@ -109,26 +109,30 @@ kthread_create(pri_t pri, int flags, str |
109 | return 0; | | 109 | return 0; |
110 | } else if (strcmp(thrstore, "cachegc") == 0) { | | 110 | } else if (strcmp(thrstore, "cachegc") == 0) { |
111 | printf("rump warning: threads not enabled, not starting" | | 111 | printf("rump warning: threads not enabled, not starting" |
112 | " namecache g/c thread\n"); | | 112 | " namecache g/c thread\n"); |
113 | return 0; | | 113 | return 0; |
114 | } else if (strcmp(thrstore, "nfssilly") == 0) { | | 114 | } else if (strcmp(thrstore, "nfssilly") == 0) { |
115 | printf("rump warning: threads not enabled, not enabling" | | 115 | printf("rump warning: threads not enabled, not enabling" |
116 | " nfs silly rename\n"); | | 116 | " nfs silly rename\n"); |
117 | return 0; | | 117 | return 0; |
118 | } else if (strcmp(thrstore, "unpgc") == 0) { | | 118 | } else if (strcmp(thrstore, "unpgc") == 0) { |
119 | printf("rump warning: threads not enabled, not enabling" | | 119 | printf("rump warning: threads not enabled, not enabling" |
120 | " UNP garbage collection\n"); | | 120 | " UNP garbage collection\n"); |
121 | return 0; | | 121 | return 0; |
| | | 122 | } else if (strncmp(thrstore, "xcall", sizeof("xcall")-1) == 0) { |
| | | 123 | printf("rump warning: threads not enabled, CPU xcall" |
| | | 124 | " not functional\n"); |
| | | 125 | return 0; |
122 | } else | | 126 | } else |
123 | panic("threads not available, setenv RUMP_THREADS 1"); | | 127 | panic("threads not available, setenv RUMP_THREADS 1"); |
124 | } | | 128 | } |
125 | KASSERT(fmt != NULL); | | 129 | KASSERT(fmt != NULL); |
126 | | | 130 | |
127 | k = rumpuser_malloc(sizeof(struct kthdesc), 0); | | 131 | k = rumpuser_malloc(sizeof(struct kthdesc), 0); |
128 | k->f = func; | | 132 | k->f = func; |
129 | k->arg = arg; | | 133 | k->arg = arg; |
130 | k->mylwp = l = rump_lwp_alloc(0, rump_nextlid()); | | 134 | k->mylwp = l = rump_lwp_alloc(0, rump_nextlid()); |
131 | if (flags & KTHREAD_MPSAFE) | | 135 | if (flags & KTHREAD_MPSAFE) |
132 | l->l_pflag |= LP_MPSAFE; | | 136 | l->l_pflag |= LP_MPSAFE; |
133 | if (flags & KTHREAD_INTR) | | 137 | if (flags & KTHREAD_INTR) |
134 | l->l_pflag |= LP_INTR; | | 138 | l->l_pflag |= LP_INTR; |