On Mon, Sep 21, 2015 at 02:05:52PM +0200, Paolo Bonzini wrote: > > > On 15/09/2015 20:45, Richard Henderson wrote: > > Best guess, since I can't find any code that actually uses them. > > Linux actively turns them off at boot... > > I've sent a kvm-unit-tests patch to test debug extensions. It shows > that debug extensions work, but the following needs to be squashed in > patch 4:
This can't be squashed directly into patch 4/8 because patch 7/8 touches the same code, but I have solved the conflicts manually (the resulting tree is exactly the same). I will send the conflict resolution diffs as replies to patches 4/8 and 7/8. > > diff --git a/target-i386/bpt_helper.c b/target-i386/bpt_helper.c > index c258598..b24e446 100644 > --- a/target-i386/bpt_helper.c > +++ b/target-i386/bpt_helper.c > @@ -134,14 +134,14 @@ void cpu_x86_update_dr7(CPUX86State *env, uint32_t > new_dr7) > int mod = ((old_dr7 | old_dr7 * 2) ^ (new_dr7 | new_dr7 * 2)) & 0xff; > > for (i = 0; i < DR7_MAX_BP; i++) { > - if (mod & (2 << i * 2)) { > - /* We know that register i has changed enable state; > - recheck what that state should be and apply. */ > - if (hw_breakpoint_enabled(new_dr7, i)) { > - iobpt |= hw_breakpoint_insert(env, i); > - } else { > - hw_breakpoint_remove(env, i); > - } > + if ((mod & (2 << i * 2)) && !hw_breakpoint_enabled(new_dr7, i)) { > + hw_breakpoint_remove(env, i); > + } > + } > + env->dr[7] = new_dr7 | DR7_FIXED_1; > + for (i = 0; i < DR7_MAX_BP; i++) { > + if (mod & (2 << i * 2) && hw_breakpoint_enabled(new_dr7, i)) { > + iobpt |= hw_breakpoint_insert(env, i); > } else if (hw_breakpoint_type(new_dr7, i) == DR7_TYPE_IO_RW > && hw_breakpoint_enabled(new_dr7, i)) { > iobpt |= HF_IOBPT_MASK; > > Otherwise, hw_breakpoint_insert doesn't work because it expects to > see an updated env->dr[7]. > > There are a couple other issues that the tests expose, but they are > not regressions so I will send patches later. > > Paolo > -- Eduardo