aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-06-24 12:54:40 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-25 06:40:39 -0400
commitf8203b59c7b20154ff08e90fca438f8939fca4bf (patch)
tree158b6968667c9bfcb0919ff036fd0023dda1171a
parent2d3ecdfec9514907084b29b1fb08932da5a5ec7e (diff)
downloadkvm-unit-tests-f8203b59c7b20154ff08e90fca438f8939fca4bf.tar.gz
x86: move IDT away from address 0
Address 0 is also used for the SIPI vector (which is probably something worth changing as well), and now that we call setup_idt very early the SIPI vector overwrites the first few bytes of the IDT, and in particular the #DE handler. Fix this for both 32-bit and 64-bit, even though the different form of the descriptors meant that only 32-bit showed a failure. Reported-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/cstart.S10
-rw-r--r--x86/cstart64.S11
2 files changed, 17 insertions, 4 deletions
diff --git a/x86/cstart.S b/x86/cstart.S
index 5ad70b5..a3c7931 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -4,8 +4,6 @@
.globl boot_idt
.global online_cpus
-boot_idt = 0
-
ipi_vector = 0x20
max_cpus = MAX_TEST_CPUS
@@ -30,6 +28,12 @@ i = 0
i = i + 1
.endr
+boot_idt:
+ .rept 256
+ .quad 0
+ .endr
+end_boot_idt:
+
.globl gdt32
gdt32:
.quad 0
@@ -71,7 +75,7 @@ tss:
tss_end:
idt_descr:
- .word 16 * 256 - 1
+ .word end_boot_idt - boot_idt - 1
.long boot_idt
.section .init
diff --git a/x86/cstart64.S b/x86/cstart64.S
index 1ecfbdb..b44d0ae 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -9,6 +9,8 @@ boot_idt = 0
.globl gdt64_desc
.globl online_cpus
+boot_idt = 0
+
ipi_vector = 0x20
max_cpus = MAX_TEST_CPUS
@@ -51,6 +53,13 @@ ptl5:
.align 4096
+boot_idt:
+ .rept 256
+ .quad 0
+ .quad 0
+ .endr
+end_boot_idt:
+
gdt64_desc:
.word gdt64_end - gdt64 - 1
.quad gdt64
@@ -282,7 +291,7 @@ lvl5:
retq
idt_descr:
- .word 16 * 256 - 1
+ .word end_boot_idt - boot_idt - 1
.quad boot_idt
online_cpus: