[PATCH 11/15] VMX: Make syscall handler optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of requiring to reference the basic handler, just allow NULL as
syscall handler for those tests that don't care. Makes test definitions
a bit more compact.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 x86/vmx.c       |  3 ++-
 x86/vmx_tests.c | 28 ++++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/x86/vmx.c b/x86/vmx.c
index f220e13..f6f2f59 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -97,7 +97,8 @@ asm(
 
 static void __attribute__((__used__)) syscall_handler(u64 syscall_no)
 {
-	current->syscall_handler(syscall_no);
+	if (current->syscall_handler)
+		current->syscall_handler(syscall_no);
 }
 
 static inline int vmx_on()
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 04238ac..fe7bbdf 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -69,10 +69,6 @@ int basic_exit_handler()
 	return VMX_TEST_EXIT;
 }
 
-void basic_syscall_handler(u64 syscall_no)
-{
-}
-
 void vmenter_main()
 {
 	u64 rax;
@@ -1123,26 +1119,22 @@ static int ept_exit_handler()
 	return VMX_TEST_VMEXIT;
 }
 
-/* name/init/guest_main/exit_handler/syscall_handler/guest_regs
-   basic_* just implement some basic functions */
+/* name/init/guest_main/exit_handler/syscall_handler/guest_regs */
 struct vmx_test vmx_tests[] = {
-	{ "null", NULL, basic_guest_main, basic_exit_handler,
-		basic_syscall_handler, {0} },
-	{ "vmenter", NULL, vmenter_main, vmenter_exit_handler,
-		basic_syscall_handler, {0} },
+	{ "null", NULL, basic_guest_main, basic_exit_handler, NULL, {0} },
+	{ "vmenter", NULL, vmenter_main, vmenter_exit_handler, NULL, {0} },
 	{ "preemption timer", preemption_timer_init, preemption_timer_main,
-		preemption_timer_exit_handler, basic_syscall_handler, {0} },
+		preemption_timer_exit_handler, NULL, {0} },
 	{ "control field PAT", test_ctrl_pat_init, test_ctrl_pat_main,
-		test_ctrl_pat_exit_handler, basic_syscall_handler, {0} },
+		test_ctrl_pat_exit_handler, NULL, {0} },
 	{ "control field EFER", test_ctrl_efer_init, test_ctrl_efer_main,
-		test_ctrl_efer_exit_handler, basic_syscall_handler, {0} },
+		test_ctrl_efer_exit_handler, NULL, {0} },
 	{ "CR shadowing", NULL, cr_shadowing_main,
-		cr_shadowing_exit_handler, basic_syscall_handler, {0} },
+		cr_shadowing_exit_handler, NULL, {0} },
 	{ "I/O bitmap", iobmp_init, iobmp_main, iobmp_exit_handler,
-		basic_syscall_handler, {0} },
+		NULL, {0} },
 	{ "instruction intercept", insn_intercept_init, insn_intercept_main,
-		insn_intercept_exit_handler, basic_syscall_handler, {0} },
-	{ "EPT framework", ept_init, ept_main, ept_exit_handler,
-		basic_syscall_handler, {0} },
+		insn_intercept_exit_handler, NULL, {0} },
+	{ "EPT framework", ept_init, ept_main, ept_exit_handler, NULL, {0} },
 	{ NULL, NULL, NULL, NULL, NULL, {0} },
 };
-- 
1.8.1.1.298.ge7eed54

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux