Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: KVM: Replace get_{gdt,idt}_base() by get_{gdt,idt}()

get_gdt_base() and get_idt_base() only return the base address
of the descriptor tables. Soon we will need to get the size as well.
Change the prototype of those functions so that they return
the whole desc_ptr struct instead of the address field.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Wei Huang <wei.huang2@amd.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Eric Auger and committed by
Paolo Bonzini
1ecaabed a06230b6

+7 -7
+4 -4
tools/testing/selftests/kvm/include/x86_64/processor.h
··· 220 220 __asm__ __volatile__("mov %0, %%cr4" : : "r" (val) : "memory"); 221 221 } 222 222 223 - static inline uint64_t get_gdt_base(void) 223 + static inline struct desc_ptr get_gdt(void) 224 224 { 225 225 struct desc_ptr gdt; 226 226 __asm__ __volatile__("sgdt %[gdt]" 227 227 : /* output */ [gdt]"=m"(gdt)); 228 - return gdt.address; 228 + return gdt; 229 229 } 230 230 231 - static inline uint64_t get_idt_base(void) 231 + static inline struct desc_ptr get_idt(void) 232 232 { 233 233 struct desc_ptr idt; 234 234 __asm__ __volatile__("sidt %[idt]" 235 235 : /* output */ [idt]"=m"(idt)); 236 - return idt.address; 236 + return idt; 237 237 } 238 238 239 239 #define SET_XMM(__var, __xmm) \
+3 -3
tools/testing/selftests/kvm/lib/x86_64/vmx.c
··· 288 288 vmwrite(HOST_FS_BASE, rdmsr(MSR_FS_BASE)); 289 289 vmwrite(HOST_GS_BASE, rdmsr(MSR_GS_BASE)); 290 290 vmwrite(HOST_TR_BASE, 291 - get_desc64_base((struct desc64 *)(get_gdt_base() + get_tr()))); 292 - vmwrite(HOST_GDTR_BASE, get_gdt_base()); 293 - vmwrite(HOST_IDTR_BASE, get_idt_base()); 291 + get_desc64_base((struct desc64 *)(get_gdt().address + get_tr()))); 292 + vmwrite(HOST_GDTR_BASE, get_gdt().address); 293 + vmwrite(HOST_IDTR_BASE, get_idt().address); 294 294 vmwrite(HOST_IA32_SYSENTER_ESP, rdmsr(MSR_IA32_SYSENTER_ESP)); 295 295 vmwrite(HOST_IA32_SYSENTER_EIP, rdmsr(MSR_IA32_SYSENTER_EIP)); 296 296 }