Skip to contentSkip to conversation

hvm/monitor: fix usage of the control register mask

PATCH In review Roger Pau Monne 2 participants 2 messages Feb 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvm/monitor: fix usage of the control register mask

Previous usage is not correct and would prevent certain updates from being notified to the monitor client.

For example if (value ^ old) == (PGE | PSE) and mask == PGE this update would not be notified.

---
Cc: Razvan Cojocaru <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/x86/hvm/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/monitor.c +1 -1
index 131b85209f..04665c5f6c 100644
@@ -39,7 +39,7 @@ bool hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old)
     if ( (ad->monitor.write_ctrlreg_enabled & ctrlreg_bitmask) &&
          (!(ad->monitor.write_ctrlreg_onchangeonly & ctrlreg_bitmask) ||
           value != old) &&
-         (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) )
+         ((value ^ old) & ~ad->monitor.write_ctrlreg_mask[index]) )
     {
         bool sync = ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask;
 
Signature · 7 lines
2.16.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Roger Pau Monne

Previous usage is not correct and would prevent certain updates from being notified to the monitor client.

For example if (value ^ old) == (PGE | PSE) and mask == PGE this update would not be notified.

---
Cc: Razvan Cojocaru <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 xen/arch/x86/hvm/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/monitor.c +0 -0
index 131b85209f..04665c5f6c 100644

xen/arch/x86/hvm/monitor.c bool hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old) · line 44

Quoted 7 lines
xen/arch/x86/hvm/monitor.c +1 -1
@@ -39,7 +39,7 @@ bool hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old)
     if ( (ad->monitor.write_ctrlreg_enabled & ctrlreg_bitmask) &&
          (!(ad->monitor.write_ctrlreg_onchangeonly & ctrlreg_bitmask) ||
           value != old) &&
-         (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) )
+         ((value ^ old) & ~ad->monitor.write_ctrlreg_mask[index]) )
     {
         bool sync = ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask;

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel