Message ID | 20200626092333.2830-2-namit@vmware.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: realmode: fixes | expand |
On 26/06/20 11:23, Nadav Amit wrote: > The realmode test does not initialize the IDTR, assuming that its base > is zero and its limit 0x3ff. Initialize it, as the BIOS might not set it > as such. Rather the bootloader: realmode.flat is started as multiboot, that is in a 32-bit protected mode environment---which includes an IDT. Paolo > Signed-off-by: Nadav Amit <namit@vmware.com> > --- > x86/realmode.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/x86/realmode.c b/x86/realmode.c > index 234d607..ef79f7e 100644 > --- a/x86/realmode.c > +++ b/x86/realmode.c > @@ -1799,6 +1799,7 @@ void realmode_start(void) > unsigned long long r_gdt[] = { 0, 0x9b000000ffff, 0x93000000ffff }; > > struct table_descr r_gdt_descr = { sizeof(r_gdt) - 1, &r_gdt }; > +struct table_descr r_idt_descr = { 0x3ff, 0 }; > > asm( > ".section .init \n\t" > @@ -1819,6 +1820,7 @@ asm( > ".text \n\t" > "start: \n\t" > "lgdt r_gdt_descr \n\t" > + "lidt r_idt_descr \n\t" > "ljmp $8, $1f; 1: \n\t" > ".code16gcc \n\t" > "mov $16, %eax \n\t" >
diff --git a/x86/realmode.c b/x86/realmode.c index 234d607..ef79f7e 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1799,6 +1799,7 @@ void realmode_start(void) unsigned long long r_gdt[] = { 0, 0x9b000000ffff, 0x93000000ffff }; struct table_descr r_gdt_descr = { sizeof(r_gdt) - 1, &r_gdt }; +struct table_descr r_idt_descr = { 0x3ff, 0 }; asm( ".section .init \n\t" @@ -1819,6 +1820,7 @@ asm( ".text \n\t" "start: \n\t" "lgdt r_gdt_descr \n\t" + "lidt r_idt_descr \n\t" "ljmp $8, $1f; 1: \n\t" ".code16gcc \n\t" "mov $16, %eax \n\t"
The realmode test does not initialize the IDTR, assuming that its base is zero and its limit 0x3ff. Initialize it, as the BIOS might not set it as such. Signed-off-by: Nadav Amit <namit@vmware.com> --- x86/realmode.c | 2 ++ 1 file changed, 2 insertions(+)