| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uvm_emap.c,v 1.3 2009/07/19 15:17:29 rmind Exp $ */ | | 1 | /* $NetBSD: uvm_emap.c,v 1.4 2009/07/20 03:51:42 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Mindaugas Rasiukevicius and Andrew Doran. | | 8 | * by Mindaugas Rasiukevicius and Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -36,52 +36,52 @@ | | | @@ -36,52 +36,52 @@ |
36 | * do not support pmap. | | 36 | * do not support pmap. |
37 | * | | 37 | * |
38 | * Note that uvm_emap_update() is called from lower pmap(9) layer, while | | 38 | * Note that uvm_emap_update() is called from lower pmap(9) layer, while |
39 | * other functions call to pmap(9). Typical pattern of update in pmap: | | 39 | * other functions call to pmap(9). Typical pattern of update in pmap: |
40 | * | | 40 | * |
41 | * u_int gen = uvm_emap_gen_return(); | | 41 | * u_int gen = uvm_emap_gen_return(); |
42 | * tlbflush(); | | 42 | * tlbflush(); |
43 | * uvm_emap_update(); | | 43 | * uvm_emap_update(); |
44 | * | | 44 | * |
45 | * It is also used from IPI context, therefore functions must safe. | | 45 | * It is also used from IPI context, therefore functions must safe. |
46 | */ | | 46 | */ |
47 | | | 47 | |
48 | #include <sys/cdefs.h> | | 48 | #include <sys/cdefs.h> |
49 | __KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.3 2009/07/19 15:17:29 rmind Exp $"); | | 49 | __KERNEL_RCSID(0, "$NetBSD: uvm_emap.c,v 1.4 2009/07/20 03:51:42 kiyohara Exp $"); |
50 | | | 50 | |
51 | #include <sys/param.h> | | 51 | #include <sys/param.h> |
52 | #include <sys/kernel.h> | | 52 | #include <sys/kernel.h> |
53 | | | 53 | |
54 | #include <sys/atomic.h> | | 54 | #include <sys/atomic.h> |
55 | #include <sys/lwp.h> | | 55 | #include <sys/lwp.h> |
56 | #include <sys/vmem.h> | | 56 | #include <sys/vmem.h> |
57 | #include <sys/types.h> | | 57 | #include <sys/types.h> |
58 | | | 58 | |
59 | #include <uvm/uvm.h> | | 59 | #include <uvm/uvm.h> |
60 | #include <uvm/uvm_extern.h> | | 60 | #include <uvm/uvm_extern.h> |
61 | | | 61 | |
62 | /* XXX: Arbitrary. */ | | 62 | /* XXX: Arbitrary. */ |
63 | #ifdef _LP64 | | 63 | #ifdef _LP64 |
64 | #define UVM_EMAP_SIZE (128 * 1024 * 1024) /* 128 MB */ | | 64 | #define UVM_EMAP_SIZE (128 * 1024 * 1024) /* 128 MB */ |
65 | #else | | 65 | #else |
66 | #define UVM_EMAP_SIZE (32 * 1024 * 1024) /* 32 MB */ | | 66 | #define UVM_EMAP_SIZE (32 * 1024 * 1024) /* 32 MB */ |
67 | #endif | | 67 | #endif |
68 | | | 68 | |
69 | static u_int _uvm_emap_gen[COHERENCY_UNIT - sizeof(u_int)] | | 69 | static u_int _uvm_emap_gen[COHERENCY_UNIT - sizeof(u_int)] |
70 | __aligned(COHERENCY_UNIT); | | 70 | __aligned(COHERENCY_UNIT); |
71 | | | 71 | |
72 | #define uvm_emap_gen (_uvm_emap_gen[0]) | | 72 | #define uvm_emap_gen (_uvm_emap_gen[0]) |
73 | | | 73 | |
74 | static u_int uvm_emap_size = UVM_EMAP_SIZE; | | 74 | u_int uvm_emap_size = UVM_EMAP_SIZE; |
75 | static vaddr_t uvm_emap_va; | | 75 | static vaddr_t uvm_emap_va; |
76 | static vmem_t * uvm_emap_vmem; | | 76 | static vmem_t * uvm_emap_vmem; |
77 | | | 77 | |
78 | /* | | 78 | /* |
79 | * uvm_emap_init: initialize subsystem. | | 79 | * uvm_emap_init: initialize subsystem. |
80 | */ | | 80 | */ |
81 | void | | 81 | void |
82 | uvm_emap_sysinit(void) | | 82 | uvm_emap_sysinit(void) |
83 | { | | 83 | { |
84 | struct uvm_cpu *ucpu; | | 84 | struct uvm_cpu *ucpu; |
85 | size_t qmax; | | 85 | size_t qmax; |
86 | u_int i; | | 86 | u_int i; |
87 | | | 87 | |