[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0810071137550.2591-100000@iolanthe.rowland.org>
Date: Tue, 7 Oct 2008 11:40:46 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: "K.Prasad" <prasad@...ux.vnet.ibm.com>
cc: linux-kernel@...r.kernel.org, Roland McGrath <roland@...hat.com>,
<akpm@...ux-foundation.org>, <mingo@...e.hu>,
<jason.wessel@...driver.com>, <avi@...ranet.com>,
<richardj_moore@...ibm.com>
Subject: Re: [RFC Patch 6/9] Use virtual debug registers in process/thread
handling code
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists