Rev 2007 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2007 | Rev 2017 | ||
---|---|---|---|
Line 74... | Line 74... | ||
74 | #define SET_PTL0_ADDRESS_ARCH(ptl0) { \ |
74 | #define SET_PTL0_ADDRESS_ARCH(ptl0) { \ |
75 | mmuext_op_t mmu_ext; \ |
75 | mmuext_op_t mmu_ext; \ |
76 | \ |
76 | \ |
77 | mmu_ext.cmd = MMUEXT_NEW_BASEPTR; \ |
77 | mmu_ext.cmd = MMUEXT_NEW_BASEPTR; \ |
78 | mmu_ext.mfn = ADDR2PFN(PA2MA(ptl0)); \ |
78 | mmu_ext.mfn = ADDR2PFN(PA2MA(ptl0)); \ |
79 | xen_mmuext_op(&mmu_ext, 1, NULL, DOMID_SELF); \ |
79 | ASSERT(xen_mmuext_op(&mmu_ext, 1, NULL, DOMID_SELF) == 0); \ |
80 | } |
80 | } |
81 | 81 | ||
82 | #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) { \ |
82 | #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) { \ |
- | 83 | mmuext_op_t mmu_ext; \ |
|
- | 84 | \ |
|
- | 85 | mmu_ext.cmd = MMUEXT_PIN_L1_TABLE; \ |
|
- | 86 | mmu_ext.mfn = ADDR2PFN(PA2MA(a)); \ |
|
- | 87 | ASSERT(xen_mmuext_op(&mmu_ext, 1, NULL, DOMID_SELF) == 0); \ |
|
- | 88 | \ |
|
83 | mmu_update_t update; \ |
89 | mmu_update_t update; \ |
84 | \ |
90 | \ |
85 | update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl0))[(i)])); \ |
91 | update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl0))[(i)])); \ |
86 | update.val = PA2MA(a) | 0x0003; \ |
92 | update.val = PA2MA(a); \ |
87 | xen_mmu_update(&update, 1, NULL, DOMID_SELF); \ |
93 | ASSERT(xen_mmu_update(&update, 1, NULL, DOMID_SELF) == 0); \ |
88 | } |
94 | } |
- | 95 | ||
89 | #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) |
96 | #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) |
90 | #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) |
97 | #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) |
91 | #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) (((pte_t *) (ptl3))[(i)].frame_address = PA2MA(a) >> 12) |
98 | #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) { \ |
- | 99 | mmu_update_t update; \ |
|
- | 100 | \ |
|
- | 101 | update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl3))[(i)])); \ |
|
- | 102 | update.val = PA2MA(a); \ |
|
- | 103 | ASSERT(xen_mmu_update(&update, 1, NULL, DOMID_SELF) == 0); \ |
|
- | 104 | } |
|
92 | 105 | ||
93 | #define GET_PTL1_FLAGS_ARCH(ptl0, i) get_pt_flags((pte_t *) (ptl0), (index_t)(i)) |
106 | #define GET_PTL1_FLAGS_ARCH(ptl0, i) get_pt_flags((pte_t *) (ptl0), (index_t)(i)) |
94 | #define GET_PTL2_FLAGS_ARCH(ptl1, i) PAGE_PRESENT |
107 | #define GET_PTL2_FLAGS_ARCH(ptl1, i) PAGE_PRESENT |
95 | #define GET_PTL3_FLAGS_ARCH(ptl2, i) PAGE_PRESENT |
108 | #define GET_PTL3_FLAGS_ARCH(ptl2, i) PAGE_PRESENT |
96 | #define GET_FRAME_FLAGS_ARCH(ptl3, i) get_pt_flags((pte_t *) (ptl3), (index_t)(i)) |
109 | #define GET_FRAME_FLAGS_ARCH(ptl3, i) get_pt_flags((pte_t *) (ptl3), (index_t)(i)) |
Line 194... | Line 207... | ||
194 | ); |
207 | ); |
195 | } |
208 | } |
196 | 209 | ||
197 | static inline void set_pt_flags(pte_t *pt, index_t i, int flags) |
210 | static inline void set_pt_flags(pte_t *pt, index_t i, int flags) |
198 | { |
211 | { |
199 | pte_t *p = &pt[i]; |
212 | pte_t p = pt[i]; |
200 | 213 | ||
201 | p->page_cache_disable = !(flags & PAGE_CACHEABLE); |
214 | p.page_cache_disable = !(flags & PAGE_CACHEABLE); |
202 | p->present = !(flags & PAGE_NOT_PRESENT); |
215 | p.present = !(flags & PAGE_NOT_PRESENT); |
203 | p->uaccessible = (flags & PAGE_USER) != 0; |
216 | p.uaccessible = (flags & PAGE_USER) != 0; |
204 | p->writeable = (flags & PAGE_WRITE) != 0; |
217 | p.writeable = (flags & PAGE_WRITE) != 0; |
205 | p->global = (flags & PAGE_GLOBAL) != 0; |
218 | p.global = (flags & PAGE_GLOBAL) != 0; |
206 | 219 | ||
207 | /* |
220 | /* |
208 | * Ensure that there is at least one bit set even if the present bit is cleared. |
221 | * Ensure that there is at least one bit set even if the present bit is cleared. |
209 | */ |
222 | */ |
210 | p->soft_valid = true; |
223 | p.soft_valid = true; |
- | 224 | ||
- | 225 | mmu_update_t update; |
|
- | 226 | ||
- | 227 | update.ptr = PA2MA(KA2PA(&(pt[i]))); |
|
- | 228 | update.pte = p; |
|
- | 229 | xen_mmu_update(&update, 1, NULL, DOMID_SELF); |
|
211 | } |
230 | } |
212 | 231 | ||
213 | extern void page_arch_init(void); |
232 | extern void page_arch_init(void); |
214 | extern void page_fault(int n, istate_t *istate); |
233 | extern void page_fault(int n, istate_t *istate); |
215 | 234 |