Rev 251 | Rev 430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 251 | Rev 391 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | #include <arch/types.h> |
32 | #include <arch/types.h> |
33 | #include <typedefs.h> |
33 | #include <typedefs.h> |
34 | #include <arch/asm.h> |
34 | #include <arch/asm.h> |
35 | #include <memstr.h> |
35 | #include <memstr.h> |
36 | 36 | ||
37 | - | ||
38 | void page_init(void) |
37 | void page_init(void) |
39 | { |
38 | { |
40 | page_arch_init(); |
39 | page_arch_init(); |
41 | map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
40 | map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0); |
42 | } |
41 | } |
Line 107... | Line 106... | ||
107 | ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); |
106 | ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); |
108 | 107 | ||
109 | SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame); |
108 | SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame); |
110 | SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags); |
109 | SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags); |
111 | } |
110 | } |
- | 111 | ||
- | 112 | /** Find mapping for virtual page |
|
- | 113 | * |
|
- | 114 | * Find mapping for virtual page. |
|
- | 115 | * |
|
- | 116 | * @param page Virtual page. |
|
- | 117 | * @param root PTL0 address if non-zero. |
|
- | 118 | * |
|
- | 119 | * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise. |
|
- | 120 | */ |
|
- | 121 | pte_t *find_mapping(__address page, __address root) |
|
- | 122 | { |
|
- | 123 | pte_t *ptl0, *ptl1, *ptl2, *ptl3; |
|
- | 124 | ||
- | 125 | ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); |
|
- | 126 | ||
- | 127 | if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) |
|
- | 128 | return NULL; |
|
- | 129 | ||
- | 130 | ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page))); |
|
- | 131 | ||
- | 132 | if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) |
|
- | 133 | return NULL; |
|
- | 134 | ||
- | 135 | ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page))); |
|
- | 136 | ||
- | 137 | if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) |
|
- | 138 | return NULL; |
|
- | 139 | ||
- | 140 | ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); |
|
- | 141 | ||
- | 142 | return &ptl3[PTL3_INDEX(page)]; |
|
- | 143 | } |