diff options
author | Ivan Orlov <iorlov@amazon.com> | 2024-12-17 18:14:57 +0000 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-12-18 15:14:46 -0800 |
commit | 4e9427aeb9572a4023b42e64ca2cd2ca3cbf7e20 (patch) | |
tree | 7f6174c606b7deb3693bf46e8d1d57882efe3adc /tools/testing/selftests/kvm/include | |
parent | 7bd7ff99110a2f63f758b292ab762cad16b85656 (diff) |
KVM: selftests: Add and use a helper function for x86's LIDT
Implement a function for setting the IDT descriptor from the guest
code. Replace the existing lidt occurrences with calls to this function
as `lidt` is used in multiple places.
Signed-off-by: Ivan Orlov <iorlov@amazon.com>
Link: https://lore.kernel.org/r/20241217181458.68690-7-iorlov@amazon.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include')
-rw-r--r-- | tools/testing/selftests/kvm/include/x86/processor.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h index b6753e27dfb6..daa02b851273 100644 --- a/tools/testing/selftests/kvm/include/x86/processor.h +++ b/tools/testing/selftests/kvm/include/x86/processor.h @@ -569,6 +569,11 @@ static inline void set_cr4(uint64_t val) __asm__ __volatile__("mov %0, %%cr4" : : "r" (val) : "memory"); } +static inline void set_idt(const struct desc_ptr *idt_desc) +{ + __asm__ __volatile__("lidt %0"::"m"(*idt_desc)); +} + static inline u64 xgetbv(u32 index) { u32 eax, edx; |