From patchwork Sat Apr 17 09:08:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lai Jiangshan X-Patchwork-Id: 93294 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3H98aG5004221 for ; Sat, 17 Apr 2010 09:08:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755385Ab0DQJIQ (ORCPT ); Sat, 17 Apr 2010 05:08:16 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:65224 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755253Ab0DQJIP (ORCPT ); Sat, 17 Apr 2010 05:08:15 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id E741717003F; Sat, 17 Apr 2010 17:08:09 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o3H96SuD007488; Sat, 17 Apr 2010 17:06:28 +0800 Received: from [10.167.141.204] (unknown [10.167.141.204]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 3ABC9DC2A3; Sat, 17 Apr 2010 17:11:00 +0800 (CST) Message-ID: <4BC97A7D.4070502@cn.fujitsu.com> Date: Sat, 17 Apr 2010 17:08:13 +0800 From: Lai Jiangshan User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti , LKML , kvm@vger.kernel.org Subject: [PATCH] kvm: reduce couple for ACC_EXEC_MASK Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 17 Apr 2010 09:08:42 +0000 (UTC) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 81eab9a..34f4aa2 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -101,11 +101,9 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte) { unsigned access; - access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; -#if PTTYPE == 64 - if (is_nx(vcpu)) - access &= ~(gpte >> PT64_NX_SHIFT); -#endif + access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)); + if (PTTYPE != 64 || !is_nx(vcpu) || (gpte & PT64_NX_MASK)) + access |= ACC_EXEC_MASK; return access; }