| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: intr.c,v 1.16 2009/04/26 20:41:24 pooka Exp $ */ | | 1 | /* $NetBSD: intr.c,v 1.17 2009/04/26 20:44:50 pooka Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | * SUCH DAMAGE. | | 25 | * SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.16 2009/04/26 20:41:24 pooka Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.17 2009/04/26 20:44:50 pooka Exp $"); |
30 | | | 30 | |
31 | #include <sys/param.h> | | 31 | #include <sys/param.h> |
32 | #include <sys/cpu.h> | | 32 | #include <sys/cpu.h> |
33 | #include <sys/kmem.h> | | 33 | #include <sys/kmem.h> |
34 | #include <sys/kthread.h> | | 34 | #include <sys/kthread.h> |
35 | #include <sys/intr.h> | | 35 | #include <sys/intr.h> |
36 | | | 36 | |
37 | #include <rump/rumpuser.h> | | 37 | #include <rump/rumpuser.h> |
38 | | | 38 | |
39 | #include "rump_private.h" | | 39 | #include "rump_private.h" |
40 | | | 40 | |
41 | /* | | 41 | /* |
42 | * Interrupt simulator. It executes hardclock() and softintrs. | | 42 | * Interrupt simulator. It executes hardclock() and softintrs. |
| @@ -85,27 +85,27 @@ makeworker(bool bootstrap) | | | @@ -85,27 +85,27 @@ makeworker(bool bootstrap) |
85 | wrktotal++; | | 85 | wrktotal++; |
86 | } | | 86 | } |
87 | } | | 87 | } |
88 | | | 88 | |
89 | /* rumpuser structures since we call rumpuser interfaces directly */ | | 89 | /* rumpuser structures since we call rumpuser interfaces directly */ |
90 | static struct rumpuser_cv *clockcv; | | 90 | static struct rumpuser_cv *clockcv; |
91 | static struct rumpuser_mtx *clockmtx; | | 91 | static struct rumpuser_mtx *clockmtx; |
92 | static struct timespec clockbase, clockup; | | 92 | static struct timespec clockbase, clockup; |
93 | static unsigned clkgen; | | 93 | static unsigned clkgen; |
94 | | | 94 | |
95 | void | | 95 | void |
96 | rump_getuptime(struct timespec *ts) | | 96 | rump_getuptime(struct timespec *ts) |
97 | { | | 97 | { |
98 | int startgen, i; | | 98 | int startgen, i = 0; |
99 | | | 99 | |
100 | do { | | 100 | do { |
101 | startgen = clkgen; | | 101 | startgen = clkgen; |
102 | if (__predict_false(i++ > 10)) { | | 102 | if (__predict_false(i++ > 10)) { |
103 | yield(); | | 103 | yield(); |
104 | i = 0; | | 104 | i = 0; |
105 | } | | 105 | } |
106 | *ts = clockup; | | 106 | *ts = clockup; |
107 | } while (startgen != clkgen || clkgen % 2 != 0); | | 107 | } while (startgen != clkgen || clkgen % 2 != 0); |
108 | } | | 108 | } |
109 | | | 109 | |
110 | void | | 110 | void |
111 | rump_gettime(struct timespec *ts) | | 111 | rump_gettime(struct timespec *ts) |