From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] hardware debug register handling Date: Thu, 19 Jul 2007 11:35:12 +0300 Message-ID: <469F2240.2090506@qumranet.com> References: <9cde8bff0707190045je125293w5c6414e81f86f58b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Nguyen Anh Quynh Return-path: In-Reply-To: <9cde8bff0707190045je125293w5c6414e81f86f58b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Nguyen Anh Quynh wrote: > Currently, when handling hardware breakpoints, we always set values > for all the 4 hardware debug registers, regardless it is needed or > not. This patch fixes the bug. Why is this a problem? Only enabled breakpoints are programmed into dr7. > @@ -1519,12 +1522,18 @@ static void do_interrupt_requests(struct kvm_vcpu *vcpu, > > static void kvm_guest_debug_pre(struct kvm_vcpu *vcpu) > { > +#define SET_DEBUGREG(i) \ > + if (dbg->bp[i].enabled) { \ > + set_debugreg(dbg->bp[i].address, i); \ > + } > + > struct kvm_guest_debug *dbg = &vcpu->guest_debug; > > - set_debugreg(dbg->bp[0], 0); > - set_debugreg(dbg->bp[1], 1); > - set_debugreg(dbg->bp[2], 2); > - set_debugreg(dbg->bp[3], 3); > + SET_DEBUGREG(0); > + SET_DEBUGREG(1); > + SET_DEBUGREG(2); > + SET_DEBUGREG(3); > +#undef SET_DEBUGREG > Why those ugly macros? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/