[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4BC97A7D.4070502@cn.fujitsu.com>
Date: Sat, 17 Apr 2010 17:08:13 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, kvm@...r.kernel.org
Subject: [PATCH] kvm: reduce couple for ACC_EXEC_MASK
The statement "access &= ~(gpte >> PT64_NX_SHIFT);" tries
to clear bit ACC_EXEC_MASK actually. This statement
relies PT64_NX_SHIFT==63&&ACC_EXEC_MASK=1
This patch reduces this couple.
Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
---
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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists