Rev 430 | Rev 501 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 430 | Rev 492 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | #include <memstr.h> |
35 | #include <memstr.h> |
36 | 36 | ||
37 | void page_init(void) |
37 | void page_init(void) |
38 | { |
38 | { |
39 | page_arch_init(); |
39 | page_arch_init(); |
40 | map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
40 | page_mapping_insert(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
41 | } |
41 | } |
42 | 42 | ||
43 | /** Map memory structure |
43 | /** Map memory structure |
44 | * |
44 | * |
45 | * Identity-map memory structure |
45 | * Identity-map memory structure |
Line 55... | Line 55... | ||
55 | 55 | ||
56 | length = size + (s - (s & ~(PAGE_SIZE-1))); |
56 | length = size + (s - (s & ~(PAGE_SIZE-1))); |
57 | cnt = length/PAGE_SIZE + (length%PAGE_SIZE>0); |
57 | cnt = length/PAGE_SIZE + (length%PAGE_SIZE>0); |
58 | 58 | ||
59 | for (i = 0; i < cnt; i++) |
59 | for (i = 0; i < cnt; i++) |
60 | map_page_to_frame(s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); |
60 | page_mapping_insert(s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); |
61 | 61 | ||
62 | } |
62 | } |
63 | 63 | ||
64 | /** Map page to frame |
64 | /** Map page to frame |
65 | * |
65 | * |
Line 69... | Line 69... | ||
69 | * @param page Virtual address of the page to be mapped. |
69 | * @param page Virtual address of the page to be mapped. |
70 | * @param frame Physical address of memory frame to which the mapping is done. |
70 | * @param frame Physical address of memory frame to which the mapping is done. |
71 | * @param flags Flags to be used for mapping. |
71 | * @param flags Flags to be used for mapping. |
72 | * @param root Explicit PTL0 address. |
72 | * @param root Explicit PTL0 address. |
73 | */ |
73 | */ |
74 | void map_page_to_frame(__address page, __address frame, int flags, __address root) |
74 | void page_mapping_insert(__address page, __address frame, int flags, __address root) |
75 | { |
75 | { |
76 | pte_t *ptl0, *ptl1, *ptl2, *ptl3; |
76 | pte_t *ptl0, *ptl1, *ptl2, *ptl3; |
77 | __address newpt; |
77 | __address newpt; |
78 | 78 | ||
79 | ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); |
79 | ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); |
Line 116... | Line 116... | ||
116 | * @param page Virtual page. |
116 | * @param page Virtual page. |
117 | * @param root PTL0 address if non-zero. |
117 | * @param root PTL0 address if non-zero. |
118 | * |
118 | * |
119 | * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise. |
119 | * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise. |
120 | */ |
120 | */ |
121 | pte_t *find_mapping(__address page, __address root) |
121 | pte_t *page_mapping_find(__address page, __address root) |
122 | { |
122 | { |
123 | pte_t *ptl0, *ptl1, *ptl2, *ptl3; |
123 | pte_t *ptl0, *ptl1, *ptl2, *ptl3; |
124 | 124 | ||
125 | ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); |
125 | ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); |
126 | 126 |