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?