diff mbox series

[kvm-unit-tests,1/3] x86: Handle all known exceptions with ASM_TRY()

Message ID 20220930232450.1677811-2-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series nVMX: Fix VMREAD/VMWRITE #PF tests | expand

Commit Message

Sean Christopherson Sept. 30, 2022, 11:24 p.m. UTC
Install the ASM_TRY() exception handler for all known exception vectors
so that ASM_TRY() can be used for other exceptions, e.g. #PF.  ASM_TRY()
might not Just Work in all cases, but there's no good reason to limit
usage to just #DE, #UD, and #GP.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 lib/x86/desc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index a20be92..b293ae4 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -301,12 +301,12 @@  void setup_idt(void)
 
 	idt_initialized = true;
 	for (i = 0; i < 32; i++) {
-		if (idt_handlers[i])
-			set_idt_entry(i, idt_handlers[i], 0);
+		if (!idt_handlers[i])
+			continue;
+
+                set_idt_entry(i, idt_handlers[i], 0);
+                handle_exception(i, check_exception_table);
 	}
-	handle_exception(0, check_exception_table);
-	handle_exception(6, check_exception_table);
-	handle_exception(13, check_exception_table);
 }
 
 void load_idt(void)