| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vm_machdep.c,v 1.124 2009/08/17 18:56:10 matt Exp $ */ | | 1 | /* $NetBSD: vm_machdep.c,v 1.125 2009/08/20 01:33:04 cliff Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1992, 1993 | | 4 | * Copyright (c) 1992, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * the Systems Programming Group of the University of Utah Computer | | 8 | * the Systems Programming Group of the University of Utah Computer |
9 | * Science Department and Ralph Campbell. | | 9 | * Science Department and Ralph Campbell. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -67,27 +67,27 @@ | | | @@ -67,27 +67,27 @@ |
67 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 67 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
68 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 68 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
69 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 69 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
70 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 70 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
71 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 71 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
72 | * SUCH DAMAGE. | | 72 | * SUCH DAMAGE. |
73 | * | | 73 | * |
74 | * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 | | 74 | * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 |
75 | * | | 75 | * |
76 | * @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 | | 76 | * @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 |
77 | */ | | 77 | */ |
78 | | | 78 | |
79 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 79 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
80 | __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.124 2009/08/17 18:56:10 matt Exp $"); | | 80 | __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.125 2009/08/20 01:33:04 cliff Exp $"); |
81 | | | 81 | |
82 | #include "opt_ddb.h" | | 82 | #include "opt_ddb.h" |
83 | | | 83 | |
84 | #include <sys/param.h> | | 84 | #include <sys/param.h> |
85 | #include <sys/systm.h> | | 85 | #include <sys/systm.h> |
86 | #include <sys/proc.h> | | 86 | #include <sys/proc.h> |
87 | #include <sys/malloc.h> | | 87 | #include <sys/malloc.h> |
88 | #include <sys/buf.h> | | 88 | #include <sys/buf.h> |
89 | #include <sys/vnode.h> | | 89 | #include <sys/vnode.h> |
90 | #include <sys/user.h> | | 90 | #include <sys/user.h> |
91 | #include <sys/core.h> | | 91 | #include <sys/core.h> |
92 | #include <sys/exec.h> | | 92 | #include <sys/exec.h> |
93 | #include <sys/sa.h> | | 93 | #include <sys/sa.h> |
| @@ -205,40 +205,42 @@ cpu_setfunc(struct lwp *l, void (*func)( | | | @@ -205,40 +205,42 @@ cpu_setfunc(struct lwp *l, void (*func)( |
205 | #ifdef IPL_ICU_MASK | | 205 | #ifdef IPL_ICU_MASK |
206 | pcb->pcb_ppl = 0; /* machine depenedend interrupt mask */ | | 206 | pcb->pcb_ppl = 0; /* machine depenedend interrupt mask */ |
207 | #endif | | 207 | #endif |
208 | } | | 208 | } |
209 | | | 209 | |
210 | /* | | 210 | /* |
211 | * Finish a swapin operation. | | 211 | * Finish a swapin operation. |
212 | * We neded to update the cached PTEs for the user area in the | | 212 | * We neded to update the cached PTEs for the user area in the |
213 | * machine dependent part of the proc structure. | | 213 | * machine dependent part of the proc structure. |
214 | */ | | 214 | */ |
215 | void | | 215 | void |
216 | cpu_swapin(struct lwp *l) | | 216 | cpu_swapin(struct lwp *l) |
217 | { | | 217 | { |
| | | 218 | #if USPACE > PAGE_SIZE |
218 | pt_entry_t *pte; | | 219 | pt_entry_t *pte; |
219 | int i, x; | | 220 | int i, x; |
220 | | | 221 | |
221 | /* | | 222 | /* |
222 | * Cache the PTEs for the user area in the machine dependent | | 223 | * Cache the PTEs for the user area in the machine dependent |
223 | * part of the proc struct so cpu_switchto() can quickly map | | 224 | * part of the proc struct so cpu_switchto() can quickly map |
224 | * in the user struct and kernel stack. | | 225 | * in the user struct and kernel stack. |
225 | */ | | 226 | */ |
226 | x = (MIPS_HAS_R4K_MMU) ? | | 227 | x = (MIPS_HAS_R4K_MMU) ? |
227 | (MIPS3_PG_G | MIPS3_PG_RO | MIPS3_PG_WIRED) : | | 228 | (MIPS3_PG_G | MIPS3_PG_RO | MIPS3_PG_WIRED) : |
228 | MIPS1_PG_G; | | 229 | MIPS1_PG_G; |
229 | pte = kvtopte(l->l_addr); | | 230 | pte = kvtopte(l->l_addr); |
230 | for (i = 0; i < UPAGES; i++) | | 231 | for (i = 0; i < UPAGES; i++) |
231 | l->l_md.md_upte[i] = pte[i].pt_entry &~ x; | | 232 | l->l_md.md_upte[i] = pte[i].pt_entry &~ x; |
| | | 233 | #endif |
232 | } | | 234 | } |
233 | | | 235 | |
234 | void | | 236 | void |
235 | cpu_lwp_free(struct lwp *l, int proc) | | 237 | cpu_lwp_free(struct lwp *l, int proc) |
236 | { | | 238 | { |
237 | | | 239 | |
238 | if ((l->l_md.md_flags & MDP_FPUSED) && l == fpcurlwp) | | 240 | if ((l->l_md.md_flags & MDP_FPUSED) && l == fpcurlwp) |
239 | fpcurlwp = NULL; | | 241 | fpcurlwp = NULL; |
240 | } | | 242 | } |
241 | | | 243 | |
242 | void | | 244 | void |
243 | cpu_lwp_free2(struct lwp *l) | | 245 | cpu_lwp_free2(struct lwp *l) |
244 | { | | 246 | { |