| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.77 2011/12/13 15:43:55 reinoud Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.78 2011/12/14 12:29:59 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Reinoud Zandijk <reinoud@NetBSD.org> | | 4 | * Copyright (c) 2011 Reinoud Zandijk <reinoud@NetBSD.org> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,38 +17,39 @@ | | | @@ -17,38 +17,39 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2011/12/13 15:43:55 reinoud Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2011/12/14 12:29:59 jmcneill Exp $"); |
31 | | | 31 | |
32 | #include "opt_memsize.h" | | 32 | #include "opt_memsize.h" |
33 | #include "opt_kmempages.h" | | 33 | #include "opt_kmempages.h" |
34 | | | 34 | |
35 | #include <sys/types.h> | | 35 | #include <sys/types.h> |
36 | #include <sys/param.h> | | 36 | #include <sys/param.h> |
37 | #include <sys/mutex.h> | | 37 | #include <sys/mutex.h> |
38 | #include <sys/buf.h> | | 38 | #include <sys/buf.h> |
39 | #include <sys/malloc.h> | | 39 | #include <sys/malloc.h> |
40 | #include <sys/pool.h> | | 40 | #include <sys/pool.h> |
41 | #include <machine/thunk.h> | | 41 | #include <machine/thunk.h> |
| | | 42 | #include <machine/machdep.h> |
42 | | | 43 | |
43 | #include <uvm/uvm.h> | | 44 | #include <uvm/uvm.h> |
44 | | | 45 | |
45 | struct pv_entry { | | 46 | struct pv_entry { |
46 | struct pv_entry *pv_next; | | 47 | struct pv_entry *pv_next; |
47 | pmap_t pv_pmap; | | 48 | pmap_t pv_pmap; |
48 | uintptr_t pv_ppn; /* physical page number */ | | 49 | uintptr_t pv_ppn; /* physical page number */ |
49 | uintptr_t pv_lpn; /* logical page number */ | | 50 | uintptr_t pv_lpn; /* logical page number */ |
50 | vm_prot_t pv_prot; /* logical protection */ | | 51 | vm_prot_t pv_prot; /* logical protection */ |
51 | int pv_mmap_ppl; /* programmed protection */ | | 52 | int pv_mmap_ppl; /* programmed protection */ |
52 | uint8_t pv_vflags; /* per mapping flags */ | | 53 | uint8_t pv_vflags; /* per mapping flags */ |
53 | #define PV_WIRED 0x01 /* wired mapping */ | | 54 | #define PV_WIRED 0x01 /* wired mapping */ |
54 | #define PV_UNMANAGED 0x02 /* entered by pmap_kenter_ */ | | 55 | #define PV_UNMANAGED 0x02 /* entered by pmap_kenter_ */ |
| @@ -359,27 +360,28 @@ pmap_bootstrap(void) | | | @@ -359,27 +360,28 @@ pmap_bootstrap(void) |
359 | | | 360 | |
360 | aprint_verbose("leaving pmap_bootstrap:\n"); | | 361 | aprint_verbose("leaving pmap_bootstrap:\n"); |
361 | aprint_verbose("\t%"PRIu64" MB of physical pages left\n", | | 362 | aprint_verbose("\t%"PRIu64" MB of physical pages left\n", |
362 | (uint64_t) (free_end - (free_start + fpos))/1024/1024); | | 363 | (uint64_t) (free_end - (free_start + fpos))/1024/1024); |
363 | aprint_verbose("\t%"PRIu64" MB of kmem left\n", | | 364 | aprint_verbose("\t%"PRIu64" MB of kmem left\n", |
364 | (uint64_t) (kmem_ext_end - kmem_ext_cur_end)/1024/1024); | | 365 | (uint64_t) (kmem_ext_end - kmem_ext_cur_end)/1024/1024); |
365 | | | 366 | |
366 | setup_signal_handlers(); | | 367 | setup_signal_handlers(); |
367 | } | | 368 | } |
368 | | | 369 | |
369 | void | | 370 | void |
370 | pmap_init(void) | | 371 | pmap_init(void) |
371 | { | | 372 | { |
372 | /* All deferred to pmap_create, because malloc() is nice. */ | | 373 | /* ensure signal stack is setup after urkelvisor fork */ |
| | | 374 | thunk_sigaltstack(usermode_signal_stack(), NULL); |
373 | } | | 375 | } |
374 | | | 376 | |
375 | /* return kernel space start and end (including growth) */ | | 377 | /* return kernel space start and end (including growth) */ |
376 | void | | 378 | void |
377 | pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) | | 379 | pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) |
378 | { | | 380 | { |
379 | *vstartp = kmem_ext_cur_start; /* min to map in */ | | 381 | *vstartp = kmem_ext_cur_start; /* min to map in */ |
380 | *vendp = kmem_ext_end; /* max available */ | | 382 | *vendp = kmem_ext_end; /* max available */ |
381 | } | | 383 | } |
382 | | | 384 | |
383 | static void | | 385 | static void |
384 | pmap_deferred_init(void) | | 386 | pmap_deferred_init(void) |
385 | { | | 387 | { |