diff mbox series

[v2,5/9] KVM: selftests: move idt_entry to header

Message ID 20221103141351.50662-6-mlevitsk@redhat.com
State Accepted
Commit fc6392d51d4810e4b611ef7dabd594756e5a2406
Headers show
Series nSVM: Security and correctness fixes | expand

Commit Message

Maxim Levitsky Nov. 3, 2022, 2:13 p.m. UTC
struct idt_entry will be used for a test which will break IDT on purpose.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 .../selftests/kvm/include/x86_64/processor.h        | 13 +++++++++++++
 tools/testing/selftests/kvm/lib/x86_64/processor.c  | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

Comments

Liam Merwick Nov. 21, 2022, 4:32 p.m. UTC | #1
On 03/11/2022 14:13, Maxim Levitsky wrote:
> struct idt_entry will be used for a test which will break IDT on purpose.
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>

Reviewed-by: Liam Merwick <liam.merwick@oracle.com>


> ---
>   .../selftests/kvm/include/x86_64/processor.h        | 13 +++++++++++++
>   tools/testing/selftests/kvm/lib/x86_64/processor.c  | 13 -------------
>   2 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index e8ca0d8a6a7e0a..5da0c5e2a7afc4 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -748,6 +748,19 @@ struct ex_regs {
>   	uint64_t rflags;
>   };
>   
> +struct idt_entry {
> +	uint16_t offset0;
> +	uint16_t selector;
> +	uint16_t ist : 3;
> +	uint16_t : 5;
> +	uint16_t type : 4;
> +	uint16_t : 1;
> +	uint16_t dpl : 2;
> +	uint16_t p : 1;
> +	uint16_t offset1;
> +	uint32_t offset2; uint32_t reserved;
> +};
> +
>   void vm_init_descriptor_tables(struct kvm_vm *vm);
>   void vcpu_init_descriptor_tables(struct kvm_vcpu *vcpu);
>   void vm_install_exception_handler(struct kvm_vm *vm, int vector,
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 39c4409ef56a6a..41c1c73c464d48 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -1074,19 +1074,6 @@ void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits)
>   	}
>   }
>   
> -struct idt_entry {
> -	uint16_t offset0;
> -	uint16_t selector;
> -	uint16_t ist : 3;
> -	uint16_t : 5;
> -	uint16_t type : 4;
> -	uint16_t : 1;
> -	uint16_t dpl : 2;
> -	uint16_t p : 1;
> -	uint16_t offset1;
> -	uint32_t offset2; uint32_t reserved;
> -};
> -
>   static void set_idt_entry(struct kvm_vm *vm, int vector, unsigned long addr,
>   			  int dpl, unsigned short selector)
>   {
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
index e8ca0d8a6a7e0a..5da0c5e2a7afc4 100644
--- a/tools/testing/selftests/kvm/include/x86_64/processor.h
+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
@@ -748,6 +748,19 @@  struct ex_regs {
 	uint64_t rflags;
 };
 
+struct idt_entry {
+	uint16_t offset0;
+	uint16_t selector;
+	uint16_t ist : 3;
+	uint16_t : 5;
+	uint16_t type : 4;
+	uint16_t : 1;
+	uint16_t dpl : 2;
+	uint16_t p : 1;
+	uint16_t offset1;
+	uint32_t offset2; uint32_t reserved;
+};
+
 void vm_init_descriptor_tables(struct kvm_vm *vm);
 void vcpu_init_descriptor_tables(struct kvm_vcpu *vcpu);
 void vm_install_exception_handler(struct kvm_vm *vm, int vector,
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index 39c4409ef56a6a..41c1c73c464d48 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -1074,19 +1074,6 @@  void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits)
 	}
 }
 
-struct idt_entry {
-	uint16_t offset0;
-	uint16_t selector;
-	uint16_t ist : 3;
-	uint16_t : 5;
-	uint16_t type : 4;
-	uint16_t : 1;
-	uint16_t dpl : 2;
-	uint16_t p : 1;
-	uint16_t offset1;
-	uint32_t offset2; uint32_t reserved;
-};
-
 static void set_idt_entry(struct kvm_vm *vm, int vector, unsigned long addr,
 			  int dpl, unsigned short selector)
 {