mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>,
	akpm@linux-foundation.org, mingo@elte.hu,
	jason.wessel@windriver.com, avi@qumranet.com,
	richardj_moore@uk.ibm.com
Subject: Re: [RFC Patch 6/9] Use virtual debug registers in process/thread handling code
Date: Tue, 7 Oct 2008 23:18:52 +0530	[thread overview]
Message-ID: <20081007174852.GE4130@in.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0810071137550.2591-100000@iolanthe.rowland.org>

On Tue, Oct 07, 2008 at 11:40:46AM -0400, Alan Stern wrote:
> On Tue, 7 Oct 2008, K.Prasad wrote:
> 
> > This patch enables the use of abstract/virtual debug registers in
> > process-handling routines.
> 
> ...
> > --- linux-bkpt-lkml-27-rc9.orig/arch/x86/kernel/process_32.c
> > +++ linux-bkpt-lkml-27-rc9/arch/x86/kernel/process_32.c
> > @@ -56,6 +56,8 @@
> >  #include <asm/cpu.h>
> >  #include <asm/kdebug.h>
> >  #include <asm/idle.h>
> > +#include <asm/debugreg.h>
> > +#include <asm/hw_breakpoint.h>
> >  
> >  asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
> >  
> > @@ -158,9 +160,11 @@ void cpu_idle(void)
> >  void __show_registers(struct pt_regs *regs, int all)
> >  {
> >  	unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
> > -	unsigned long d0, d1, d2, d3, d6, d7;
> > +	unsigned long u_debugreg[8];
> >  	unsigned long sp;
> >  	unsigned short ss, gs;
> > +	struct thread_hw_breakpoint *thbi = current->thread.hw_breakpoint_info;
> > +	int i;
> >  
> >  	if (user_mode_vm(regs)) {
> >  		sp = regs->sp;
> > @@ -201,17 +205,18 @@ void __show_registers(struct pt_regs *re
> >  	printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
> >  			cr0, cr2, cr3, cr4);
> >  
> > -	get_debugreg(d0, 0);
> > -	get_debugreg(d1, 1);
> > -	get_debugreg(d2, 2);
> > -	get_debugreg(d3, 3);
> > +	if (thbi) {
> > +		for (i = 0; i < HB_NUM; ++i)
> > +			u_debugreg[i] = thbi->vdr_bps[i].info.address;
> > +		u_debugreg[7] = thbi->vdr7;
> > +	}
> > +	u_debugreg[6] = current->thread.vdr6;
> > +
> >  	printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
> > -			d0, d1, d2, d3);
> > +					u_debugreg[0], u_debugreg[1],
> > +						u_debugreg[2], u_debugreg[3]);
> >  
> > -	get_debugreg(d6, 6);
> > -	get_debugreg(d7, 7);
> > -	printk("DR6: %08lx DR7: %08lx\n",
> > -			d6, d7);
> > +	printk("DR6: %08lx DR7: %08lx\n", u_debugreg[6], u_debugreg[7]);
> 
> I don't like this at all.  show_registers() should display the physical
> register contents, not the virtualized values.  Ditto for the 64-byte
> version of this routine.
> 
> Alan Stern
> 
Agreed, will modify this!

Thanks,
K.Prasad


  reply	other threads:[~2008-10-07 17:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 11:38 [RFC Patch 0/9] Hardware Breakpoint interfaces K.Prasad
2008-10-07 11:40 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-10-07 15:21   ` Alan Stern
2008-10-07 16:49     ` K.Prasad
2008-10-07 11:41 ` [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2008-10-07 15:36   ` Alan Stern
2008-10-07 17:23     ` K.Prasad
2008-10-07 17:38       ` Alan Stern
2008-10-07 17:28     ` K.Prasad
2008-10-07 11:42 ` [RFC Patch 3/9] Modifying generic debug exception to use virtual debug registers K.Prasad
2008-10-07 11:43 ` [RFC Patch 4/9] Modify kprobe exception handler to recognise single-stepping by HW Breakpoint handler K.Prasad
2008-10-07 11:44 ` [RFC Patch 5/9] Use wrapper routines around debug registers in processor related functions K.Prasad
2008-10-07 11:44 ` [RFC Patch 6/9] Use virtual debug registers in process/thread handling code K.Prasad
2008-10-07 15:40   ` Alan Stern
2008-10-07 17:48     ` K.Prasad [this message]
2008-10-07 11:45 ` [RFC Patch 7/9] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2008-10-07 11:46 ` [RFC Patch 8/9] Modify Ptrace to use wrapper routines to access breakpoint registers K.Prasad
2008-10-07 11:46 ` [RFC Patch 9/9] Cleanup HW Breakpoint registers before kexec K.Prasad
2008-10-07 12:29 ` [RFC Patch 0/9] Hardware Breakpoint interfaces Avi Kivity
2008-10-07 14:32   ` K.Prasad
2008-10-07 14:36     ` Avi Kivity
2008-10-07 16:45       ` K.Prasad
2008-10-07 16:52         ` Avi Kivity
2008-10-08 19:20 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-10-08 19:25 ` [RFC Patch 6/9] Use virtual debug registers in process/thread handling code K.Prasad
2008-10-16  1:44   ` Roland McGrath
2008-10-16 14:27     ` Alan Stern
2008-10-18  0:08       ` Roland McGrath
2008-10-18 15:34         ` Alan Stern
2008-12-03  4:54           ` Roland McGrath
2008-12-04  1:05           ` Roland McGrath
2008-12-04 12:23             ` K.Prasad
2008-12-04 19:08 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-12-04 19:13 ` [RFC Patch 6/9] Use virtual debug registers in process/thread handling code K.Prasad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081007174852.GE4130@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@qumranet.com \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richardj_moore@uk.ibm.com \
    --cc=roland@redhat.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome