Rev 754 | Rev 756 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 754 | Rev 755 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2001-2006 Jakub Jermar |
2 | * Copyright (C) 2001-2006 Jakub Jermar |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - 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 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - 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 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /* |
29 | /* |
30 | * This file contains address space manipulation functions. |
30 | * This file contains address space manipulation functions. |
31 | * Roughly speaking, this is a higher-level client of |
31 | * Roughly speaking, this is a higher-level client of |
32 | * Virtual Address Translation (VAT) subsystem. |
32 | * Virtual Address Translation (VAT) subsystem. |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <mm/as.h> |
35 | #include <mm/as.h> |
36 | #include <mm/asid.h> |
36 | #include <mm/asid.h> |
37 | #include <mm/page.h> |
37 | #include <mm/page.h> |
38 | #include <mm/frame.h> |
38 | #include <mm/frame.h> |
39 | #include <mm/tlb.h> |
39 | #include <mm/tlb.h> |
40 | #include <mm/heap.h> |
40 | #include <mm/heap.h> |
41 | #include <arch/mm/page.h> |
41 | #include <arch/mm/page.h> |
42 | #include <genarch/mm/page_pt.h> |
42 | #include <genarch/mm/page_pt.h> |
43 | #include <mm/asid.h> |
43 | #include <mm/asid.h> |
44 | #include <arch/mm/asid.h> |
44 | #include <arch/mm/asid.h> |
45 | #include <arch/mm/as.h> |
45 | #include <arch/mm/as.h> |
46 | #include <arch/types.h> |
46 | #include <arch/types.h> |
47 | #include <typedefs.h> |
47 | #include <typedefs.h> |
48 | #include <synch/spinlock.h> |
48 | #include <synch/spinlock.h> |
49 | #include <config.h> |
49 | #include <config.h> |
50 | #include <list.h> |
50 | #include <list.h> |
51 | #include <panic.h> |
51 | #include <panic.h> |
52 | #include <arch/asm.h> |
52 | #include <arch/asm.h> |
53 | #include <debug.h> |
53 | #include <debug.h> |
54 | #include <memstr.h> |
54 | #include <memstr.h> |
55 | #include <arch.h> |
55 | #include <arch.h> |
56 | #include <print.h> |
56 | #include <print.h> |
57 | 57 | ||
58 | #define KAS_START_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_START) |
58 | #define KAS_START_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_START) |
59 | #define KAS_END_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_END) |
59 | #define KAS_END_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_END) |
60 | #define KAS_INDICES (1+(KAS_END_INDEX-KAS_START_INDEX)) |
60 | #define KAS_INDICES (1+(KAS_END_INDEX-KAS_START_INDEX)) |
61 | 61 | ||
62 | static int get_area_flags(as_area_t *a); |
62 | static int get_area_flags(as_area_t *a); |
63 | 63 | ||
64 | /** Create address space. */ |
64 | /** Create address space. */ |
65 | /* |
65 | /* |
66 | * FIXME: this interface must be meaningful for all possible VAT |
66 | * FIXME: this interface must be meaningful for all possible VAT |
67 | * (Virtual Address Translation) mechanisms. |
67 | * (Virtual Address Translation) mechanisms. |
68 | */ |
68 | */ |
69 | as_t *as_create(pte_t *ptl0, int flags) |
69 | as_t *as_create(pte_t *ptl0, int flags) |
70 | { |
70 | { |
71 | as_t *as; |
71 | as_t *as; |
72 | 72 | ||
73 | as = (as_t *) malloc(sizeof(as_t)); |
73 | as = (as_t *) malloc(sizeof(as_t)); |
74 | if (as) { |
74 | if (as) { |
75 | list_initialize(&as->as_with_asid_link); |
75 | list_initialize(&as->as_with_asid_link); |
76 | spinlock_initialize(&as->lock, "as_lock"); |
76 | spinlock_initialize(&as->lock, "as_lock"); |
77 | list_initialize(&as->as_area_head); |
77 | list_initialize(&as->as_area_head); |
78 | 78 | ||
79 | if (flags & AS_KERNEL) |
79 | if (flags & FLAG_AS_KERNEL) |
80 | as->asid = ASID_KERNEL; |
80 | as->asid = ASID_KERNEL; |
81 | else |
81 | else |
82 | as->asid = ASID_INVALID; |
82 | as->asid = ASID_INVALID; |
83 | 83 | ||
84 | as->ptl0 = ptl0; |
84 | as->ptl0 = ptl0; |
85 | if (!as->ptl0) { |
85 | if (!as->ptl0) { |
86 | pte_t *src_ptl0, *dst_ptl0; |
86 | pte_t *src_ptl0, *dst_ptl0; |
87 | 87 | ||
88 | src_ptl0 = (pte_t *) PA2KA((__address) GET_PTL0_ADDRESS()); |
88 | src_ptl0 = (pte_t *) PA2KA((__address) GET_PTL0_ADDRESS()); |
89 | dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); |
89 | dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); |
90 | 90 | ||
91 | // memsetb((__address) dst_ptl0, PAGE_SIZE, 0); |
91 | // memsetb((__address) dst_ptl0, PAGE_SIZE, 0); |
92 | // memcpy((void *) &dst_ptl0[KAS_START_INDEX], (void *) &src_ptl0[KAS_START_INDEX], KAS_INDICES); |
92 | // memcpy((void *) &dst_ptl0[KAS_START_INDEX], (void *) &src_ptl0[KAS_START_INDEX], KAS_INDICES); |
93 | 93 | ||
94 | memcpy((void *) dst_ptl0,(void *) src_ptl0, PAGE_SIZE); |
94 | memcpy((void *) dst_ptl0,(void *) src_ptl0, PAGE_SIZE); |
95 | 95 | ||
96 | as->ptl0 = (pte_t *) KA2PA((__address) dst_ptl0); |
96 | as->ptl0 = (pte_t *) KA2PA((__address) dst_ptl0); |
97 | } |
97 | } |
98 | } |
98 | } |
99 | 99 | ||
100 | return as; |
100 | return as; |
101 | } |
101 | } |
102 | 102 | ||
103 | /** Create address space area of common attributes. |
103 | /** Create address space area of common attributes. |
104 | * |
104 | * |
105 | * The created address space area is added to the target address space. |
105 | * The created address space area is added to the target address space. |
106 | * |
106 | * |
107 | * @param as Target address space. |
107 | * @param as Target address space. |
108 | * @param type Type of area. |
108 | * @param type Type of area. |
109 | * @param size Size of area in multiples of PAGE_SIZE. |
109 | * @param size Size of area in multiples of PAGE_SIZE. |
110 | * @param base Base address of area. |
110 | * @param base Base address of area. |
111 | * |
111 | * |
112 | * @return Address space area on success or NULL on failure. |
112 | * @return Address space area on success or NULL on failure. |
113 | */ |
113 | */ |
114 | as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base) |
114 | as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base) |
115 | { |
115 | { |
116 | ipl_t ipl; |
116 | ipl_t ipl; |
117 | as_area_t *a; |
117 | as_area_t *a; |
118 | 118 | ||
119 | if (base % PAGE_SIZE) |
119 | if (base % PAGE_SIZE) |
120 | panic("addr not aligned to a page boundary"); |
120 | panic("addr not aligned to a page boundary"); |
121 | 121 | ||
122 | ipl = interrupts_disable(); |
122 | ipl = interrupts_disable(); |
123 | spinlock_lock(&as->lock); |
123 | spinlock_lock(&as->lock); |
124 | 124 | ||
125 | /* |
125 | /* |
126 | * TODO: test as_area which is to be created doesn't overlap with an existing one. |
126 | * TODO: test as_area which is to be created doesn't overlap with an existing one. |
127 | */ |
127 | */ |
128 | 128 | ||
129 | a = (as_area_t *) malloc(sizeof(as_area_t)); |
129 | a = (as_area_t *) malloc(sizeof(as_area_t)); |
130 | if (a) { |
130 | if (a) { |
131 | spinlock_initialize(&a->lock, "as_area_lock"); |
131 | spinlock_initialize(&a->lock, "as_area_lock"); |
132 | 132 | ||
133 | link_initialize(&a->link); |
133 | link_initialize(&a->link); |
134 | a->type = type; |
134 | a->type = type; |
135 | a->size = size; |
135 | a->size = size; |
136 | a->base = base; |
136 | a->base = base; |
137 | 137 | ||
138 | list_append(&a->link, &as->as_area_head); |
138 | list_append(&a->link, &as->as_area_head); |
139 | } |
139 | } |
140 | 140 | ||
141 | spinlock_unlock(&as->lock); |
141 | spinlock_unlock(&as->lock); |
142 | interrupts_restore(ipl); |
142 | interrupts_restore(ipl); |
143 | 143 | ||
144 | return a; |
144 | return a; |
145 | } |
145 | } |
146 | 146 | ||
147 | /** Initialize mapping for one page of address space. |
147 | /** Initialize mapping for one page of address space. |
148 | * |
148 | * |
149 | * This functions maps 'page' to 'frame' according |
149 | * This functions maps 'page' to 'frame' according |
150 | * to attributes of the address space area to |
150 | * to attributes of the address space area to |
151 | * wich 'page' belongs. |
151 | * wich 'page' belongs. |
152 | * |
152 | * |
153 | * @param a Target address space. |
153 | * @param a Target address space. |
154 | * @param page Virtual page within the area. |
154 | * @param page Virtual page within the area. |
155 | * @param frame Physical frame to which page will be mapped. |
155 | * @param frame Physical frame to which page will be mapped. |
156 | */ |
156 | */ |
157 | void as_set_mapping(as_t *as, __address page, __address frame) |
157 | void as_set_mapping(as_t *as, __address page, __address frame) |
158 | { |
158 | { |
159 | as_area_t *a, *area = NULL; |
159 | as_area_t *a, *area = NULL; |
160 | link_t *cur; |
160 | link_t *cur; |
161 | ipl_t ipl; |
161 | ipl_t ipl; |
162 | 162 | ||
163 | ipl = interrupts_disable(); |
163 | ipl = interrupts_disable(); |
164 | spinlock_lock(&as->lock); |
164 | spinlock_lock(&as->lock); |
165 | 165 | ||
166 | /* |
166 | /* |
167 | * First, try locate an area. |
167 | * First, try locate an area. |
168 | */ |
168 | */ |
169 | for (cur = as->as_area_head.next; cur != &as->as_area_head; cur = cur->next) { |
169 | for (cur = as->as_area_head.next; cur != &as->as_area_head; cur = cur->next) { |
170 | a = list_get_instance(cur, as_area_t, link); |
170 | a = list_get_instance(cur, as_area_t, link); |
171 | spinlock_lock(&a->lock); |
171 | spinlock_lock(&a->lock); |
172 | 172 | ||
173 | if ((page >= a->base) && (page < a->base + a->size * PAGE_SIZE)) { |
173 | if ((page >= a->base) && (page < a->base + a->size * PAGE_SIZE)) { |
174 | area = a; |
174 | area = a; |
175 | break; |
175 | break; |
176 | } |
176 | } |
177 | 177 | ||
178 | spinlock_unlock(&a->lock); |
178 | spinlock_unlock(&a->lock); |
179 | } |
179 | } |
180 | 180 | ||
181 | if (!area) { |
181 | if (!area) { |
182 | panic("page not part of any as_area\n"); |
182 | panic("page not part of any as_area\n"); |
183 | } |
183 | } |
184 | 184 | ||
185 | /* |
185 | /* |
186 | * Note: area->lock is held. |
186 | * Note: area->lock is held. |
187 | */ |
187 | */ |
188 | 188 | ||
189 | page_mapping_insert(page, as->asid, frame, get_area_flags(area), (__address) as->ptl0); |
189 | page_mapping_insert(as, page, frame, get_area_flags(area), (__address) as->ptl0); |
190 | 190 | ||
191 | spinlock_unlock(&area->lock); |
191 | spinlock_unlock(&area->lock); |
192 | spinlock_unlock(&as->lock); |
192 | spinlock_unlock(&as->lock); |
193 | interrupts_restore(ipl); |
193 | interrupts_restore(ipl); |
194 | } |
194 | } |
195 | 195 | ||
196 | /** Handle page fault within the current address space. |
196 | /** Handle page fault within the current address space. |
197 | * |
197 | * |
198 | * This is the high-level page fault handler. |
198 | * This is the high-level page fault handler. |
199 | * Interrupts are assumed disabled. |
199 | * Interrupts are assumed disabled. |
200 | * |
200 | * |
201 | * @param page Faulting page. |
201 | * @param page Faulting page. |
202 | * |
202 | * |
203 | * @return 0 on page fault, 1 on success. |
203 | * @return 0 on page fault, 1 on success. |
204 | */ |
204 | */ |
205 | int as_page_fault(__address page) |
205 | int as_page_fault(__address page) |
206 | { |
206 | { |
207 | link_t *cur; |
207 | link_t *cur; |
208 | as_area_t *a, *area = NULL; |
208 | as_area_t *a, *area = NULL; |
209 | __address frame; |
209 | __address frame; |
210 | 210 | ||
211 | ASSERT(AS); |
211 | ASSERT(AS); |
212 | spinlock_lock(&AS->lock); |
212 | spinlock_lock(&AS->lock); |
213 | 213 | ||
214 | /* |
214 | /* |
215 | * Search this areas of this address space for presence of 'page'. |
215 | * Search this areas of this address space for presence of 'page'. |
216 | */ |
216 | */ |
217 | for (cur = AS->as_area_head.next; cur != &AS->as_area_head; cur = cur->next) { |
217 | for (cur = AS->as_area_head.next; cur != &AS->as_area_head; cur = cur->next) { |
218 | a = list_get_instance(cur, as_area_t, link); |
218 | a = list_get_instance(cur, as_area_t, link); |
219 | spinlock_lock(&a->lock); |
219 | spinlock_lock(&a->lock); |
220 | 220 | ||
221 | if ((page >= a->base) && (page < a->base + a->size * PAGE_SIZE)) { |
221 | if ((page >= a->base) && (page < a->base + a->size * PAGE_SIZE)) { |
222 | 222 | ||
223 | /* |
223 | /* |
224 | * We found the area containing 'page'. |
224 | * We found the area containing 'page'. |
225 | * TODO: access checking |
225 | * TODO: access checking |
226 | */ |
226 | */ |
227 | area = a; |
227 | area = a; |
228 | break; |
228 | break; |
229 | } |
229 | } |
230 | 230 | ||
231 | spinlock_unlock(&a->lock); |
231 | spinlock_unlock(&a->lock); |
232 | } |
232 | } |
233 | 233 | ||
234 | if (!area) { |
234 | if (!area) { |
235 | /* |
235 | /* |
236 | * No area contained mapping for 'page'. |
236 | * No area contained mapping for 'page'. |
237 | * Signal page fault to low-level handler. |
237 | * Signal page fault to low-level handler. |
238 | */ |
238 | */ |
239 | spinlock_unlock(&AS->lock); |
239 | spinlock_unlock(&AS->lock); |
240 | return 0; |
240 | return 0; |
241 | } |
241 | } |
242 | 242 | ||
243 | /* |
243 | /* |
244 | * Note: area->lock is held. |
244 | * Note: area->lock is held. |
245 | */ |
245 | */ |
246 | 246 | ||
247 | /* |
247 | /* |
248 | * In general, there can be several reasons that |
248 | * In general, there can be several reasons that |
249 | * can have caused this fault. |
249 | * can have caused this fault. |
250 | * |
250 | * |
251 | * - non-existent mapping: the area is a scratch |
251 | * - non-existent mapping: the area is a scratch |
252 | * area (e.g. stack) and so far has not been |
252 | * area (e.g. stack) and so far has not been |
253 | * allocated a frame for the faulting page |
253 | * allocated a frame for the faulting page |
254 | * |
254 | * |
255 | * - non-present mapping: another possibility, |
255 | * - non-present mapping: another possibility, |
256 | * currently not implemented, would be frame |
256 | * currently not implemented, would be frame |
257 | * reuse; when this becomes a possibility, |
257 | * reuse; when this becomes a possibility, |
258 | * do not forget to distinguish between |
258 | * do not forget to distinguish between |
259 | * the different causes |
259 | * the different causes |
260 | */ |
260 | */ |
261 | frame = frame_alloc(0, ONE_FRAME, NULL); |
261 | frame = frame_alloc(0, ONE_FRAME, NULL); |
262 | memsetb(PA2KA(frame), FRAME_SIZE, 0); |
262 | memsetb(PA2KA(frame), FRAME_SIZE, 0); |
263 | 263 | ||
264 | /* |
264 | /* |
265 | * Map 'page' to 'frame'. |
265 | * Map 'page' to 'frame'. |
266 | * Note that TLB shootdown is not attempted as only new information is being |
266 | * Note that TLB shootdown is not attempted as only new information is being |
267 | * inserted into page tables. |
267 | * inserted into page tables. |
268 | */ |
268 | */ |
269 | page_mapping_insert(page, AS->asid, frame, get_area_flags(area), (__address) AS->ptl0); |
269 | page_mapping_insert(AS, page, frame, get_area_flags(area), (__address) AS->ptl0); |
270 | 270 | ||
271 | spinlock_unlock(&area->lock); |
271 | spinlock_unlock(&area->lock); |
272 | spinlock_unlock(&AS->lock); |
272 | spinlock_unlock(&AS->lock); |
273 | 273 | ||
274 | return 1; |
274 | return 1; |
275 | } |
275 | } |
276 | 276 | ||
277 | /** Install address space on CPU. |
277 | /** Install address space on CPU. |
278 | * |
278 | * |
279 | * @param as Address space. |
279 | * @param as Address space. |
280 | */ |
280 | */ |
281 | void as_install(as_t *as) |
281 | void as_install(as_t *as) |
282 | { |
282 | { |
283 | ipl_t ipl; |
283 | ipl_t ipl; |
284 | 284 | ||
285 | asid_install(as); |
285 | asid_install(as); |
286 | 286 | ||
287 | ipl = interrupts_disable(); |
287 | ipl = interrupts_disable(); |
288 | spinlock_lock(&as->lock); |
288 | spinlock_lock(&as->lock); |
289 | ASSERT(as->ptl0); |
289 | ASSERT(as->ptl0); |
290 | SET_PTL0_ADDRESS(as->ptl0); |
290 | SET_PTL0_ADDRESS(as->ptl0); |
291 | spinlock_unlock(&as->lock); |
291 | spinlock_unlock(&as->lock); |
292 | interrupts_restore(ipl); |
292 | interrupts_restore(ipl); |
293 | 293 | ||
294 | /* |
294 | /* |
295 | * Perform architecture-specific steps. |
295 | * Perform architecture-specific steps. |
296 | * (e.g. write ASID to hardware register etc.) |
296 | * (e.g. write ASID to hardware register etc.) |
297 | */ |
297 | */ |
298 | as_install_arch(as); |
298 | as_install_arch(as); |
299 | 299 | ||
300 | AS = as; |
300 | AS = as; |
301 | } |
301 | } |
302 | 302 | ||
303 | /** Compute flags for virtual address translation subsytem. |
303 | /** Compute flags for virtual address translation subsytem. |
304 | * |
304 | * |
305 | * The address space area must be locked. |
305 | * The address space area must be locked. |
306 | * Interrupts must be disabled. |
306 | * Interrupts must be disabled. |
307 | * |
307 | * |
308 | * @param a Address space area. |
308 | * @param a Address space area. |
309 | * |
309 | * |
310 | * @return Flags to be used in page_mapping_insert(). |
310 | * @return Flags to be used in page_mapping_insert(). |
311 | */ |
311 | */ |
312 | int get_area_flags(as_area_t *a) |
312 | int get_area_flags(as_area_t *a) |
313 | { |
313 | { |
314 | int flags; |
314 | int flags; |
315 | 315 | ||
316 | switch (a->type) { |
316 | switch (a->type) { |
317 | case AS_AREA_TEXT: |
317 | case AS_AREA_TEXT: |
318 | flags = PAGE_EXEC | PAGE_READ | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
318 | flags = PAGE_EXEC | PAGE_READ | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
319 | break; |
319 | break; |
320 | case AS_AREA_DATA: |
320 | case AS_AREA_DATA: |
321 | case AS_AREA_STACK: |
321 | case AS_AREA_STACK: |
322 | flags = PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
322 | flags = PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
323 | break; |
323 | break; |
324 | default: |
324 | default: |
325 | panic("unexpected as_area_type_t %d", a->type); |
325 | panic("unexpected as_area_type_t %d", a->type); |
326 | } |
326 | } |
327 | 327 | ||
328 | return flags; |
328 | return flags; |
329 | } |
329 | } |
330 | 330 |