Received: from eggs.gnu.org ([2001:4830:134:3::10]:60061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgdTM-0003ko-SM for qemu-devel@nongnu.org; Mon, 28 Sep 2015 14:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgdTJ-0006MS-H5 for qemu-devel@nongnu.org; Mon, 28 Sep 2015 14:48:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgdTJ-0006MI-Bo for qemu-devel@nongnu.org; Mon, 28 Sep 2015 14:48:21 -0400 Date: Mon, 28 Sep 2015 15:48:17 -0300 From: Eduardo Habkost Message-ID: <20150928184817.GE30243@thinpad.lan.raisama.net> References: <1442342713-29497-1-git-send-email-rth@twiddle.net> <55FFF2A0.7070808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55FFF2A0.7070808@redhat.com> Subject: Re: [Qemu-devel] [PATCH 0/8] target-i386: Implement debug extensions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Richard Henderson 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: > > 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) (I've expanded the diff context below, to make review easier) > /* If nothing is changing except the global/local enable bits, > then we can make the change more efficient. */ > if (((old_dr7 ^ new_dr7) & ~0xff) == 0) { > /* Fold the global and local enable bits together into the > global fields, then xor to show which registers have > changed collective enable state. */ > 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; Why is DR7_FIXED_1 forced here, but not at the other branch below? Also, the previous code didn't force DR7_FIXED_1, so shouldn't we implement this fix in a separate patch instead of squashing it into patch 4/8? > + 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; > } > } > } else { > for (i = 0; i < DR7_MAX_BP; i++) { > hw_breakpoint_remove(env, i); > } > env->dr[7] = new_dr7; > for (i = 0; i < DR7_MAX_BP; i++) { > iobpt |= hw_breakpoint_insert(env, i); > } > } -- Eduardo