Changeset 7d3d641 in mainline for kernel/arch/xen32/src/pm.c
- Timestamp:
- 2006-08-01T20:45:26Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5b23a82
- Parents:
- 3e5cc686
- File:
-
- 1 edited
-
kernel/arch/xen32/src/pm.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/xen32/src/pm.c
r3e5cc686 r7d3d641 76 76 }; 77 77 78 static idescriptor_t idt[IDT_ITEMS];78 static trap_info_t traps[IDT_ITEMS + 1]; 79 79 80 80 static tss_t tss; … … 99 99 } 100 100 101 void idt_setoffset(idescriptor_t *d, uintptr_t offset)102 {103 /*104 * Offset is a linear address.105 */106 d->offset_0_15 = offset & 0xffff;107 d->offset_16_31 = offset >> 16;108 }109 110 101 void tss_initialize(tss_t *t) 111 102 { … … 113 104 } 114 105 115 /* 116 * This function takes care of proper setup of IDT and IDTR. 117 */ 118 void idt_init(void) 119 { 120 idescriptor_t *d; 121 int i; 122 106 void traps_init(void) 107 { 108 index_t i; 109 123 110 for (i = 0; i < IDT_ITEMS; i++) { 124 d = &idt[i]; 125 126 d->unused = 0; 127 d->selector = selector(KTEXT_DES); 128 129 d->access = AR_PRESENT | AR_INTERRUPT; /* masking interrupt */ 130 131 if (i == VECTOR_SYSCALL) { 132 /* 133 * The syscall interrupt gate must be calleable from userland. 134 */ 135 d->access |= DPL_USER; 136 } 111 traps[i].vector = i; 137 112 138 idt_setoffset(d, ((uintptr_t) interrupt_handlers) + i*interrupt_handler_size); 113 if (i == VECTOR_SYSCALL) 114 traps[i].flags = 3; 115 else 116 traps[i].flags = 0; 117 118 traps[i].cs = XEN_CS; 119 traps[i].address = ((uintptr_t) interrupt_handlers) + i * interrupt_handler_size; 139 120 exc_register(i, "undef", (iroutine) null_interrupt); 140 121 } 122 traps[IDT_ITEMS].vector = 0; 123 traps[IDT_ITEMS].flags = 0; 124 traps[IDT_ITEMS].cs = 0; 125 traps[IDT_ITEMS].address = NULL; 126 141 127 exc_register(13, "gp_fault", (iroutine) gp_fault); 142 128 exc_register( 7, "nm_fault", (iroutine) nm_fault); … … 173 159 { 174 160 descriptor_t *gdt_p = (descriptor_t *) gdtr.base; 175 ptr_16_32_t idtr; 176 177 /* 178 * Update addresses in GDT and IDT to their virtual counterparts. 179 */ 180 idtr.limit = sizeof(idt); 181 idtr.base = (uintptr_t) idt; 161 182 162 // gdtr_load(&gdtr); 183 // idtr_load(&idtr); 184 185 /* 186 * Each CPU has its private GDT and TSS. 187 * All CPUs share one IDT. 188 */ 189 190 // if (config.cpu_active == 1) { 191 // idt_init(); 192 // /* 193 // * NOTE: bootstrap CPU has statically allocated TSS, because 194 // * the heap hasn't been initialized so far. 195 // */ 163 164 if (config.cpu_active == 1) { 165 traps_init(); 166 xen_set_trap_table(traps); 167 /* 168 * NOTE: bootstrap CPU has statically allocated TSS, because 169 * the heap hasn't been initialized so far. 170 */ 196 171 tss_p = &tss; 197 // } 198 // else { 199 // tss_p = (tss_t *) malloc(sizeof(tss_t), FRAME_ATOMIC); 200 // if (!tss_p) 201 // panic("could not allocate TSS\n"); 202 // } 172 } else { 173 tss_p = (tss_t *) malloc(sizeof(tss_t), FRAME_ATOMIC); 174 if (!tss_p) 175 panic("could not allocate TSS\n"); 176 } 203 177 204 178 // tss_initialize(tss_p);
Note:
See TracChangeset
for help on using the changeset viewer.
