Rev 1959 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1959 | Rev 2017 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | extern void xen_callback(void); |
69 | extern void xen_callback(void); |
70 | extern void xen_failsafe_callback(void); |
70 | extern void xen_failsafe_callback(void); |
71 | 71 | ||
72 | void arch_pre_main(void) |
72 | void arch_pre_main(void) |
73 | { |
73 | { |
74 | xen_vm_assist(VMASST_CMD_ENABLE, VMASST_TYPE_WRITABLE_PAGETABLES); |
- | |
75 | - | ||
76 | pte_t pte; |
74 | pte_t pte; |
77 | memsetb((uintptr_t) &pte, sizeof(pte), 0); |
75 | memsetb((uintptr_t) &pte, sizeof(pte), 0); |
78 | 76 | ||
79 | pte.present = 1; |
77 | pte.present = 1; |
80 | pte.writeable = 1; |
78 | pte.writeable = 1; |
81 | pte.frame_address = ADDR2PFN((uintptr_t) start_info.shared_info); |
79 | pte.frame_address = ADDR2PFN((uintptr_t) start_info.shared_info); |
82 | xen_update_va_mapping(&shared_info, pte, UVMF_INVLPG); |
80 | ASSERT(xen_update_va_mapping(&shared_info, pte, UVMF_INVLPG) == 0); |
83 | 81 | ||
- | 82 | if (!(start_info.flags & SIF_INITDOMAIN)) { |
|
- | 83 | /* Map console frame */ |
|
84 | pte.present = 1; |
84 | pte.present = 1; |
85 | pte.writeable = 1; |
85 | pte.writeable = 1; |
86 | pte.frame_address = start_info.console_mfn; |
86 | pte.frame_address = start_info.console.domU.mfn; |
87 | xen_update_va_mapping(&console_page, pte, UVMF_INVLPG); |
87 | ASSERT(xen_update_va_mapping(&console_page, pte, UVMF_INVLPG) == 0); |
- | 88 | } else |
|
- | 89 | start_info.console.domU.evtchn = 0; |
|
88 | 90 | ||
89 | xen_set_callbacks(XEN_CS, xen_callback, XEN_CS, xen_failsafe_callback); |
91 | ASSERT(xen_set_callbacks(XEN_CS, xen_callback, XEN_CS, xen_failsafe_callback) == 0); |
90 | 92 | ||
91 | /* Create identity mapping */ |
93 | /* Create identity mapping */ |
92 | 94 | ||
93 | meminfo.start = ADDR2PFN(ALIGN_UP(KA2PA(start_info.ptl0), PAGE_SIZE)) + start_info.pt_frames; |
95 | meminfo.start = ADDR2PFN(ALIGN_UP(KA2PA(start_info.ptl0), PAGE_SIZE)) + start_info.pt_frames; |
94 | meminfo.size = start_info.frames - meminfo.start; |
96 | meminfo.size = start_info.frames - meminfo.start; |
Line 105... | Line 107... | ||
105 | uintptr_t tva = PA2KA(tpa); |
107 | uintptr_t tva = PA2KA(tpa); |
106 | 108 | ||
107 | memsetb(tva, PAGE_SIZE, 0); |
109 | memsetb(tva, PAGE_SIZE, 0); |
108 | 110 | ||
109 | pte_t *tptl3 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(start_info.ptl0, PTL0_INDEX(tva))); |
111 | pte_t *tptl3 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(start_info.ptl0, PTL0_INDEX(tva))); |
110 | SET_FRAME_FLAGS(tptl3, PTL3_INDEX(tva), PAGE_PRESENT); |
112 | SET_FRAME_ADDRESS(tptl3, PTL3_INDEX(tva), 0); |
111 | SET_PTL1_ADDRESS(start_info.ptl0, PTL0_INDEX(va), tpa); |
113 | SET_PTL1_ADDRESS(start_info.ptl0, PTL0_INDEX(va), tpa); |
- | 114 | SET_FRAME_ADDRESS(tptl3, PTL3_INDEX(tva), tpa); |
|
112 | 115 | ||
113 | last_ptl0 = PTL0_INDEX(va); |
116 | last_ptl0 = PTL0_INDEX(va); |
114 | meminfo.reserved++; |
117 | meminfo.reserved++; |
115 | } |
118 | } |
116 | 119 |