From patchwork Mon Dec 16 09:57:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 3352721 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D01EAC0D4A for ; Mon, 16 Dec 2013 09:57:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B344920303 for ; Mon, 16 Dec 2013 09:57:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93D8420364 for ; Mon, 16 Dec 2013 09:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220Ab3LPJ5n (ORCPT ); Mon, 16 Dec 2013 04:57:43 -0500 Received: from david.siemens.de ([192.35.17.14]:28127 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753188Ab3LPJ5m (ORCPT ); Mon, 16 Dec 2013 04:57:42 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id rBG9vZqI025214; Mon, 16 Dec 2013 10:57:35 +0100 Received: from mchn199C.mchp.siemens.de.com ([146.254.78.38]) by mail1.siemens.de (8.14.3/8.14.3) with SMTP id rBG9vTCD007502; Mon, 16 Dec 2013 10:57:35 +0100 From: Jan Kiszka To: Gleb Natapov , Paolo Bonzini Cc: kvm , Arthur Chunqi Li Subject: [PATCH 11/15] VMX: Make syscall handler optional Date: Mon, 16 Dec 2013 10:57:24 +0100 Message-Id: X-Mailer: git-send-email 1.8.1.1.298.ge7eed54 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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} }, };