Rev 269 | Rev 279 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 269 | Rev 271 | ||
---|---|---|---|
Line 70... | Line 70... | ||
70 | struct tss *tss_p = NULL; |
70 | struct tss *tss_p = NULL; |
71 | 71 | ||
72 | /* gdtr is changed by kmp before next CPU is initialized */ |
72 | /* gdtr is changed by kmp before next CPU is initialized */ |
73 | struct ptr_16_32 bsp_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt - BOOT_OFFSET) }; |
73 | struct ptr_16_32 bsp_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt - BOOT_OFFSET) }; |
74 | struct ptr_16_32 ap_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; |
74 | struct ptr_16_32 ap_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; |
75 | struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; |
75 | struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = (__address) gdt }; |
76 | struct ptr_16_32 idtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(idt), .base = KA2PA((__address) idt) }; |
- | |
77 | 76 | ||
78 | void gdt_setbase(struct descriptor *d, __address base) |
77 | void gdt_setbase(struct descriptor *d, __address base) |
79 | { |
78 | { |
80 | d->base_0_15 = base & 0xffff; |
79 | d->base_0_15 = base & 0xffff; |
81 | d->base_16_23 = ((base) >> 16) & 0xff; |
80 | d->base_16_23 = ((base) >> 16) & 0xff; |
Line 164... | Line 163... | ||
164 | ); |
163 | ); |
165 | } |
164 | } |
166 | 165 | ||
167 | void pm_init(void) |
166 | void pm_init(void) |
168 | { |
167 | { |
169 | struct descriptor *gdt_p = (struct descriptor *) PA2KA(gdtr.base); |
168 | struct descriptor *gdt_p = (struct descriptor *) gdtr.base; |
170 | - | ||
- | 169 | struct ptr_16_32 idtr; |
|
171 | 170 | ||
172 | /* |
171 | /* |
173 | * Update addresses in GDT and IDT to their virtual counterparts. |
172 | * Update addresses in GDT and IDT to their virtual counterparts. |
174 | */ |
173 | */ |
175 | if (config.cpu_active == 1) |
- | |
176 | gdtr.base = (__address) gdt; |
174 | idtr.limit = sizeof(idt); |
177 | idtr.base = (__address) idt; |
175 | idtr.base = (__address) idt; |
178 | __asm__ volatile ("lgdt %0\n" : : "m" (gdtr)); |
176 | __asm__ volatile ("lgdt %0\n" : : "m" (gdtr)); |
179 | __asm__ volatile ("lidt %0\n" : : "m" (idtr)); |
177 | __asm__ volatile ("lidt %0\n" : : "m" (idtr)); |
180 | 178 | ||
181 | /* |
179 | /* |