Changeset 8cd140f2 in mainline
- Timestamp:
- 2006-12-11T14:14:46Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 134877d
- Parents:
- b82a13c
- Location:
- kernel/arch/ia32xen
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32xen/include/boot/boot.h
rb82a13c r8cd140f2 118 118 pfn_t store_mfn; /**< Shared page (machine page) */ 119 119 evtchn_t store_evtchn; /**< Event channel for store communication */ 120 pfn_t console_mfn; /**< Console page (machine page) */ 121 evtchn_t console_evtchn; /**< Event channel for console messages */ 120 121 union { 122 struct { 123 pfn_t mfn; /**< Console page (machine page) */ 124 evtchn_t evtchn; /**< Event channel for console messages */ 125 } domU; 126 127 struct { 128 uint32_t info_off; /**< Offset of console_info struct */ 129 uint32_t info_size; /**< Size of console_info struct from start */ 130 } dom0; 131 } console; 132 122 133 pte_t *ptl0; /**< Boot PTL0 (kernel address) */ 123 134 uint32_t pt_frames; /**< Number of bootstrap page table frames */ … … 127 138 int8_t cmd_line[GUEST_CMDLINE]; 128 139 } start_info_t; 140 141 #define XEN_CONSOLE_VGA 0x03 142 #define XEN_CONSOLE_VESA 0x23 143 144 typedef struct { 145 uint8_t video_type; 146 147 union { 148 struct { 149 uint16_t font_height; 150 uint16_t cursor_x; 151 uint16_t cursor_y; 152 uint16_t rows; 153 uint16_t columns; 154 } vga; 155 156 struct { 157 uint16_t width; 158 uint16_t height; 159 uint16_t bytes_per_line; 160 uint16_t bits_per_pixel; 161 uint32_t lfb_base; 162 uint32_t lfb_size; 163 uint8_t red_pos; 164 uint8_t red_size; 165 uint8_t green_pos; 166 uint8_t green_size; 167 uint8_t blue_pos; 168 uint8_t blue_size; 169 uint8_t rsvd_pos; 170 uint8_t rsvd_size; 171 } vesa_lfb; 172 } info; 173 } console_info_t; 129 174 130 175 typedef struct { -
kernel/arch/ia32xen/include/hypercall.h
rb82a13c r8cd140f2 62 62 #define XEN_VERSION 17 63 63 #define XEN_CONSOLE_IO 18 64 #define XEN_VM_ASSIST 2165 64 #define XEN_MMUEXT_OP 26 66 65 … … 102 101 103 102 104 /*105 * Commands to XEN_VM_ASSIST106 */107 #define VMASST_CMD_ENABLE 0108 #define VMASST_CMD_DISABLE 1109 #define VMASST_TYPE_4GB_SEGMENTS 0110 #define VMASST_TYPE_4GB_SEGMENTS_NOTIFY 1111 #define VMASST_TYPE_WRITABLE_PAGETABLES 2112 113 114 103 #define DOMID_SELF (0x7FF0U) 115 104 #define DOMID_IO (0x7FF1U) … … 219 208 { 220 209 return hypercall3(XEN_CONSOLE_IO, cmd, count, str); 221 }222 223 static inline int xen_vm_assist(const unsigned int cmd, const unsigned int type)224 {225 return hypercall2(XEN_VM_ASSIST, cmd, type);226 210 } 227 211 -
kernel/arch/ia32xen/include/mm/page.h
rb82a13c r8cd140f2 77 77 mmu_ext.cmd = MMUEXT_NEW_BASEPTR; \ 78 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 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 89 mmu_update_t update; \ 84 90 \ 85 91 update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl0))[(i)])); \ 86 update.val = PA2MA(a) | 0x0003; \ 87 xen_mmu_update(&update, 1, NULL, DOMID_SELF); \ 88 } 92 update.val = PA2MA(a); \ 93 ASSERT(xen_mmu_update(&update, 1, NULL, DOMID_SELF) == 0); \ 94 } 95 89 96 #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) 90 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 106 #define GET_PTL1_FLAGS_ARCH(ptl0, i) get_pt_flags((pte_t *) (ptl0), (index_t)(i)) … … 197 210 static inline void set_pt_flags(pte_t *pt, index_t i, int flags) 198 211 { 199 pte_t *p = &pt[i];200 201 p ->page_cache_disable = !(flags & PAGE_CACHEABLE);202 p ->present = !(flags & PAGE_NOT_PRESENT);203 p ->uaccessible = (flags & PAGE_USER) != 0;204 p ->writeable = (flags & PAGE_WRITE) != 0;205 p ->global = (flags & PAGE_GLOBAL) != 0;212 pte_t p = pt[i]; 213 214 p.page_cache_disable = !(flags & PAGE_CACHEABLE); 215 p.present = !(flags & PAGE_NOT_PRESENT); 216 p.uaccessible = (flags & PAGE_USER) != 0; 217 p.writeable = (flags & PAGE_WRITE) != 0; 218 p.global = (flags & PAGE_GLOBAL) != 0; 206 219 207 220 /* 208 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 -
kernel/arch/ia32xen/src/boot/boot.S
rb82a13c r8cd140f2 49 49 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, kernel_image_start) 50 50 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) 51 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, " writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel")51 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "auto_translated_physmap|supervisor_mode_kernel") 52 52 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no") 53 53 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic") -
kernel/arch/ia32xen/src/drivers/xconsole.c
rb82a13c r8cd140f2 43 43 #define MASK_INDEX(index, ring) ((index) & (sizeof(ring) - 1)) 44 44 45 static bool asynchronous = false;46 45 static void xen_putchar(chardev_t *d, const char ch); 47 46 … … 55 54 chardev_initialize("xen_out", &xen_console, &xen_ops); 56 55 stdout = &xen_console; 57 if (!(start_info.flags & SIF_INITDOMAIN))58 asynchronous = true;59 56 } 60 57 61 58 void xen_putchar(chardev_t *d, const char ch) 62 59 { 63 if ( asynchronous) {60 if (start_info.console.domU.evtchn != 0) { 64 61 uint32_t cons = console_page.out_cons; 65 62 uint32_t prod = console_page.out_prod; … … 78 75 console_page.out_prod = prod; 79 76 80 xen_notify_remote(start_info.console _evtchn);77 xen_notify_remote(start_info.console.domU.evtchn); 81 78 } else 82 79 xen_console_io(CONSOLE_IO_WRITE, 1, &ch); -
kernel/arch/ia32xen/src/ia32xen.c
rb82a13c r8cd140f2 72 72 void arch_pre_main(void) 73 73 { 74 xen_vm_assist(VMASST_CMD_ENABLE, VMASST_TYPE_WRITABLE_PAGETABLES);75 76 74 pte_t pte; 77 75 memsetb((uintptr_t) &pte, sizeof(pte), 0); … … 80 78 pte.writeable = 1; 81 79 pte.frame_address = ADDR2PFN((uintptr_t) start_info.shared_info); 82 xen_update_va_mapping(&shared_info, pte, UVMF_INVLPG); 83 84 pte.present = 1; 85 pte.writeable = 1; 86 pte.frame_address = start_info.console_mfn; 87 xen_update_va_mapping(&console_page, pte, UVMF_INVLPG); 88 89 xen_set_callbacks(XEN_CS, xen_callback, XEN_CS, xen_failsafe_callback); 80 ASSERT(xen_update_va_mapping(&shared_info, pte, UVMF_INVLPG) == 0); 81 82 if (!(start_info.flags & SIF_INITDOMAIN)) { 83 /* Map console frame */ 84 pte.present = 1; 85 pte.writeable = 1; 86 pte.frame_address = start_info.console.domU.mfn; 87 ASSERT(xen_update_va_mapping(&console_page, pte, UVMF_INVLPG) == 0); 88 } else 89 start_info.console.domU.evtchn = 0; 90 91 ASSERT(xen_set_callbacks(XEN_CS, xen_callback, XEN_CS, xen_failsafe_callback) == 0); 90 92 91 93 /* Create identity mapping */ … … 94 96 meminfo.size = start_info.frames - meminfo.start; 95 97 meminfo.reserved = 0; 96 98 97 99 uintptr_t pa; 98 100 index_t last_ptl0 = 0; … … 108 110 109 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 113 SET_PTL1_ADDRESS(start_info.ptl0, PTL0_INDEX(va), tpa); 114 SET_FRAME_ADDRESS(tptl3, PTL3_INDEX(tva), tpa); 112 115 113 116 last_ptl0 = PTL0_INDEX(va);
Note:
See TracChangeset
for help on using the changeset viewer.