diff mbox

[11/15] VMX: Make syscall handler optional

Message ID e4568f7436361b09907bf4315ddafbaf3e040005.1387187847.git.jan.kiszka@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka Dec. 16, 2013, 9:57 a.m. UTC
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@siemens.com>
---
 x86/vmx.c       |  3 ++-
 x86/vmx_tests.c | 28 ++++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)
diff mbox

Patch

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} },
 };