Patches 1-4 clean up tss_descr; it is declared as a struct descriptor_table_ptr but it is actualy pointing to an _entry_ in the GDT. Also it is different per CPU, but tss_descr does not recognize that. Fix both by reusing the code (already present e.g. in the vmware_backdoors test) that extracts the base from the GDT entry; and also provide a helper to retrieve the limit, which is needed in vmx.c. Patches 5-9 move the IDT, GDT and TSS to C code. This was originally done by Zixuan Wang for the UEFI port, which is 64-bit only. The series extends this to 32-bit code for consistency and to avoid duplicating code between C and assembly. Paolo v2->v3: cleaned up handling of 16 byte descriptors (new patch 1) get TR limit from GDT rename high four bits of segment limit to "limit2" included Zixuan's work to port GDT/TSS/IDT to C, extended to 32-bit Paolo Bonzini (8): x86: cleanup handling of 16-byte GDT descriptors x86: fix call to set_gdt_entry unify field names and definitions for GDT descriptors replace tss_descr global with a function x86: Move IDT to desc.c x86: unify name of 32-bit and 64-bit GDT x86: get rid of ring0stacktop x86: Move 32-bit GDT and TSS to desc.c Zixuan Wang (1): x86: Move 64-bit GDT and TSS to desc.c lib/x86/asm/setup.h | 6 +++ lib/x86/desc.c | 116 +++++++++++++++++++++++++++++++++++------ lib/x86/desc.h | 31 +++++------ lib/x86/setup.c | 49 +++++++++++++++++ lib/x86/usermode.c | 9 ++-- x86/access.c | 16 +++--- x86/cstart.S | 115 ++++++---------------------------------- x86/cstart64.S | 97 ++++------------------------------ x86/smap.c | 2 +- x86/svm_tests.c | 15 ++---- x86/taskswitch.c | 4 +- x86/umip.c | 19 ++++--- x86/vmware_backdoors.c | 22 +++----- x86/vmx.c | 17 +++--- x86/vmx_tests.c | 4 +- 15 files changed, 244 insertions(+), 278 deletions(-) create mode 100644 lib/x86/asm/setup.h -- 2.27.0