Move the IDT data structures from x86/cstart.S and x86/cstart64.S to lib/x86/desc.c, so that the follow-up UEFI support commits can reuse these definitions, without re-defining them in UEFI's boot up assembly code. Extracted by a patch by Zixuan Wang <zxwang42@xxxxxxxxx> and ported to 32-bit too. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- lib/x86/desc.c | 10 ++++++++++ x86/cstart.S | 11 ----------- x86/cstart64.S | 14 -------------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/lib/x86/desc.c b/lib/x86/desc.c index 94f0ddb..2ef5aad 100644 --- a/lib/x86/desc.c +++ b/lib/x86/desc.c @@ -3,6 +3,16 @@ #include "processor.h" #include <setjmp.h> +/* Boot-related data structures */ + +/* IDT and IDT descriptor */ +idt_entry_t boot_idt[256] = {0}; + +struct descriptor_table_ptr idt_descr = { + .limit = sizeof(boot_idt) - 1, + .base = (unsigned long)boot_idt, +}; + #ifndef __x86_64__ __attribute__((regparm(1))) #endif diff --git a/x86/cstart.S b/x86/cstart.S index bcf7218..4461c38 100644 --- a/x86/cstart.S +++ b/x86/cstart.S @@ -1,7 +1,6 @@ #include "apic-defs.h" -.globl boot_idt .global online_cpus ipi_vector = 0x20 @@ -28,12 +27,6 @@ i = 0 i = i + 1 .endr -boot_idt: - .rept 256 - .quad 0 - .endr -end_boot_idt: - .globl gdt32 gdt32: .quad 0 @@ -78,10 +71,6 @@ tss: .endr tss_end: -idt_descr: - .word end_boot_idt - boot_idt - 1 - .long boot_idt - .section .init .code32 diff --git a/x86/cstart64.S b/x86/cstart64.S index cf38bae..b98a0d3 100644 --- a/x86/cstart64.S +++ b/x86/cstart64.S @@ -1,9 +1,6 @@ #include "apic-defs.h" -.globl boot_idt - -.globl idt_descr .globl gdt64_desc .globl online_cpus .globl cpu_online_count @@ -50,13 +47,6 @@ ptl5: .align 4096 -boot_idt: - .rept 256 - .quad 0 - .quad 0 - .endr -end_boot_idt: - gdt64_desc: .word gdt64_end - gdt64 - 1 .quad gdt64 @@ -290,10 +280,6 @@ setup_5level_page_table: lvl5: retq -idt_descr: - .word end_boot_idt - boot_idt - 1 - .quad boot_idt - online_cpus: .fill (max_cpus + 7) / 8, 1, 0 -- 2.34.0.rc1.387.gb447b232ab-goog