Skip to contentSkip to conversation

x86, kvm: add ad_mask static inline

PATCH In review Harvey Harrison 2 participants 4 messages Feb 18, 2008 – Feb 19, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 x86, kvm: add ad_mask static inline

Replaces open-coded mask calculation in macros.

---
 arch/x86/kvm/x86_emulate.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/kvm/x86_emulate.c +8 -3
index 7958600..7460432 100644
@@ -426,10 +426,15 @@ static u16 twobyte_table[256] = {
 	(_type)_x;							\
 })
 
+static inline unsigned long ad_mask(struct decode_cache *c)
+{
+	return (1UL << (c->ad_bytes << 3)) - 1;
+}
+
 /* Access/update address held in a register, based on addressing mode. */
 #define address_mask(reg)						\
 	((c->ad_bytes == sizeof(unsigned long)) ? 			\
-		(reg) :	((reg) & ((1UL << (c->ad_bytes << 3)) - 1)))
+		(reg) :	((reg) & ad_mask(c)))
 #define register_address(base, reg)                                     \
 	((base) + address_mask(reg))
 #define register_address_increment(reg, inc)                            \
@@ -440,9 +445,9 @@ static u16 twobyte_table[256] = {
 			(reg) += _inc;					\
 		else							\
 			(reg) = ((reg) & 				\
-				 ~((1UL << (c->ad_bytes << 3)) - 1)) |	\
+				 ~ad_mask(c)) |	\
 				(((reg) + _inc) &			\
-				 ((1UL << (c->ad_bytes << 3)) - 1));	\
+				 ad_mask(c));	\
 	} while (0)
 
 #define JMP_REL(rel) 							\
Signature · 1 line
1.5.4.1.1278.gc75be
#1 lore raw
Quoted 3 lines · Harvey Harrison

Replaces open-coded mask calculation in macros.

Please regenerate against kvm.git (patch 2 doesn't apply; see http://kvm.qumranet.com/kvmwiki/Code). Also please copy [email protected] on kvm patches.

(first patch applied)

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 8 lines · Harvey Harrison
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Harvey Harrison

Replaces open-coded mask calculation in macros.

Quoted 9 lines
Quoted 5 lines

Please regenerate against kvm.git (patch 2 doesn't apply; see http://kvm.qumranet.com/kvmwiki/Code). Also please copy [email protected] on kvm patches.

(first patch applied)

Against what branch?

master

Signature · 1 line
error compiling committee.c: too many arguments to function