target-i386: Fix evaluation of DR7 register
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 14 Dec 2009 11:26:27 +0000 (12:26 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 18 Dec 2009 17:26:25 +0000 (11:26 -0600)
hw_breakpoint_type and hw_breakpoint_len used the wrong index multiplier
to extract type and len.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-i386/cpu.h

index afb4da5..f3834b3 100644 (file)
@@ -835,12 +835,12 @@ static inline int hw_breakpoint_enabled(unsigned long dr7, int index)
 
 static inline int hw_breakpoint_type(unsigned long dr7, int index)
 {
-    return (dr7 >> (DR7_TYPE_SHIFT + (index * 2))) & 3;
+    return (dr7 >> (DR7_TYPE_SHIFT + (index * 4))) & 3;
 }
 
 static inline int hw_breakpoint_len(unsigned long dr7, int index)
 {
-    int len = ((dr7 >> (DR7_LEN_SHIFT + (index * 2))) & 3);
+    int len = ((dr7 >> (DR7_LEN_SHIFT + (index * 4))) & 3);
     return (len == 2) ? 8 : len + 1;
 }