File tree Expand file tree Collapse file tree 2 files changed +19
-26
lines changed Expand file tree Collapse file tree 2 files changed +19
-26
lines changed Original file line number Diff line number Diff line change @@ -163,31 +163,6 @@ after:
163
163
mov %eax ,%fs // Was 32bit POC Data
164
164
mov %eax ,%gs // Was 32bit POC CLS
165
165
166
- /*
167
- * Fix up the IDT desciptors
168
- * The relocation delta in IDT tables has been fixed in relocate()
169
- */
170
- movl %eax , %edx
171
- leal HOST_IDT(%rip ), %edx
172
- movl $HOST_IDT_ENTRIES, %ecx
173
-
174
- .fixup_idt_entries:
175
- xorl %eax , %eax
176
- xchgl %eax , 12 (%edx ) /* Set rsvd bits to 0; eax now has
177
- high 32 of entry point */
178
- xchgl %eax , 8 (%edx ) /* Set bits 63..32 of entry point;
179
- eax now has low 32 of entry point */
180
- movw %ax , (%edx ) /* Set bits 0-15 of procedure entry
181
- point */
182
- shr $16 , %eax
183
- movw %ax , 6 (%edx ) /* Set bits 16-31 of entry point */
184
- addl $X64_IDT_DESC_SIZE,%edx
185
- loop .fixup_idt_entries
186
-
187
- /* Load IDT */
188
- lea HOST_IDTR(%rip ), %rbx
189
- lidtq (%rbx )
190
-
191
166
/* continue with chipset level initialization */
192
167
call bsp_boot_init
193
168
Original file line number Diff line number Diff line change @@ -445,9 +445,24 @@ void init_default_irqs(uint16_t cpu_id)
445
445
}
446
446
}
447
447
448
- static void set_idt (struct host_idt_descriptor * idtd )
448
+ static inline void fixup_idt (struct host_idt_descriptor * idtd )
449
449
{
450
+ int i ;
451
+ union idt_64_descriptor * idt_desc = (union idt_64_descriptor * )idtd -> idt ;
452
+ uint32_t entry_hi_32 , entry_lo_32 ;
453
+
454
+ for (i = 0 ; i < HOST_IDT_ENTRIES ; i ++ ) {
455
+ entry_lo_32 = idt_desc [i ].fields .offset_63_32 ;
456
+ entry_hi_32 = idt_desc [i ].fields .rsvd ;
457
+ idt_desc [i ].fields .rsvd = 0U ;
458
+ idt_desc [i ].fields .offset_63_32 = entry_hi_32 ;
459
+ idt_desc [i ].fields .high32 .bits .offset_31_16 = entry_lo_32 >> 16U ;
460
+ idt_desc [i ].fields .low32 .bits .offset_15_0 = entry_lo_32 & 0xffffUL ;
461
+ }
462
+ }
450
463
464
+ static inline void set_idt (struct host_idt_descriptor * idtd )
465
+ {
451
466
asm volatile (" lidtq %[idtd]\n" : /* no output parameters */
452
467
: /* input parameters */
453
468
[idtd ] "m" (* idtd ));
@@ -457,6 +472,9 @@ void interrupt_init(uint16_t pcpu_id)
457
472
{
458
473
struct host_idt_descriptor * idtd = & HOST_IDTR ;
459
474
475
+ if (pcpu_id == BOOT_CPU_ID ) {
476
+ fixup_idt (idtd );
477
+ }
460
478
set_idt (idtd );
461
479
init_lapic (pcpu_id );
462
480
init_default_irqs (pcpu_id );
You can’t perform that action at this time.
0 commit comments