Double fault after initialize local apic
Posted: Fri Nov 19, 2021 1:57 pm
I've met a double fault after I initialized local apic and execute sti() instruction. What I did to initialize local apic is:
1. enable xapic and x2apic
2. enable local apic
3. mask all LVT registers (since my CPU platform is Pentium 4, it only has 6 LVT registers)
here is my code to mask all LVT register:
(I know it looks a little bit silly to use a lot of embedded assembly, but I just want to take a test over local apic)
After that, I execute sti() to set IF eflags to 1 and got a double fault. I suppose all the interrupt received by local apic was masked through LVT, but where did the first interrupt of double fault come from?
1. enable xapic and x2apic
2. enable local apic
3. mask all LVT registers (since my CPU platform is Pentium 4, it only has 6 LVT registers)
here is my code to mask all LVT register:
Code: Select all
__asm__ __volatile__(
"movq $0x832,%%rcx \n\t"//mask LVT Timer register
"wrmsr \n\t"
"movq $0x833,%%rcx \n\t"//mask LVT Thermal Sensor register
"wrmsr \n\t"
"movq $0x834,%%rcx \n\t"//mask LVT Performance Monitoring register
"wrmsr \n\t"
"movq $0x835,%%rcx \n\t"//mask LVT LINT0 register
"wrmsr \n\t"
"movq $0x836,%%rcx \n\t"//mask LVT LINT1 register
"wrmsr \n\t"
"movq $0x837,%%rcx \n\t"//mask LVT Error register
"wrmsr \n\t"
:
:"a"(0x10000),"d"(0x00)
:
);
After that, I execute sti() to set IF eflags to 1 and got a double fault. I suppose all the interrupt received by local apic was masked through LVT, but where did the first interrupt of double fault come from?