Sergei Shtylyov wrote:
>>I rolled up several patches along with my changes to fix HW breakpoints
>>on x86_64 and i386. I also deprecated some of the #defines in favor of
>>using the kgdb_ops to control the HW breakpoints for other non IA archs
>>at the point that these are implemented.
>>Until such time that there is a common interface for kernel HW
>>breakpoints, if a user space application uses HW breakpoints the kernel
>>breakpoints will disappear. I tested execution, data access and data
>>write breakpoints and all work with gdb 6.6.
>>
>>If there are no objections, I am going to replace the i386.patch with
>>i386_hw_breakpoints.patch and x86_64_breakpoints.patch and merge the
>>core changes for arch breakpoints to core-lite.patch.
> There *are* objections now -- belated as usual. :-<
>>Signed-off-by: Jason Wessel <[EMAIL PROTECTED]>
>>Index: linux-2.6.21.1/arch/i386/kernel/kgdb.c
>>===================================================================
>>--- linux-2.6.21.1.orig/arch/i386/kernel/kgdb.c
>>+++ linux-2.6.21.1/arch/i386/kernel/kgdb.c
[...]
>>@@ -126,8 +128,53 @@ static struct hw_breakpoint {
>> { .enabled = 0 },
>> };
>>
>>-#ifdef CONFIG_KGDB_ARCH_HAS_HARDWARE_BREAKPOINTS
>>-int kgdb_remove_hw_break(unsigned long addr)
>>+static void kgdb_correct_hw_break(void)
>>+{
>>+ int breakno;
>>+ int correctit;
>>+ int breakbit;
>>+ unsigned long dr7;
>>+
>>+ get_debugreg(dr7, 7);
>>+ correctit = 0;
>>+ for (breakno = 0; breakno < 3; breakno++) {
> Hm, why not breakno < 4 if we have 4 breakpoint regs? :-O
>>+ breakbit = 2 << (breakno << 1);
>>+ if (!(dr7 & breakbit) && breakinfo[breakno].enabled) {
>>+ correctit = 1;
>>+ dr7 |= breakbit;
>>+ dr7 &= ~(0xf0000 << (breakno << 2));
>>+ dr7 |= (((breakinfo[breakno].len << 2) |
> We should shift .len by 18, otherwise the local/global enable bits are
> being corrupt. :-/
Uh, forget it -- there were braces around! :-<
>>+ breakinfo[breakno].type) << 16) <<
>>+ (breakno << 2);
>>+ switch (breakno) {
>>+ case 0:
>>+ set_debugreg(breakinfo[breakno].addr, 0);
>>+ break;
>>+
>>+ case 1:
>>+ set_debugreg(breakinfo[breakno].addr, 1);
>>+ break;
>>+
>>+ case 2:
>>+ set_debugreg(breakinfo[breakno].addr, 2);
>>+ break;
>>+
>>+ case 3:
> This case is never hit due to a wrong loop condition.
>>+ set_debugreg(breakinfo[breakno].addr, 3);
>>+ break;
>>+ }
>>+ } else if ((dr7 & breakbit) && !breakinfo[breakno].enabled) {
>>+ correctit = 1;
>>+ dr7 &= ~breakbit;
>>+ dr7 &= ~(0xf0000 << (breakno << 2));
>>+ }
>>+ }
>>+ if (correctit)
>>+ set_debugreg(dr7, 7);
>>+}
>>+
>>Index: linux-2.6.21.1/arch/x86_64/kernel/kgdb.c
>>===================================================================
>>--- linux-2.6.21.1.orig/arch/x86_64/kernel/kgdb.c
>>+++ linux-2.6.21.1/arch/x86_64/kernel/kgdb.c
[...]
>>@@ -136,10 +137,115 @@ enabled:0}, {
>> enabled:0}, {
>> enabled:0}};
>>
>>+static void kgdb_correct_hw_break(void)
>>+{
>>+ int breakno;
>>+ int correctit;
>>+ int breakbit;
>>+ unsigned long dr7;
>>+
>>+ get_debugreg(dr7, 7);
>>+ correctit = 0;
>>+ for (breakno = 0; breakno < 3; breakno++) {
> The same wrong condition here.
>>+ breakbit = 2 << (breakno << 1);
>>+ if (!(dr7 & breakbit) && breakinfo[breakno].enabled) {
>>+ correctit = 1;
>>+ dr7 |= breakbit;
>>+ dr7 &= ~(0xf0000 << (breakno << 2));
>>+ dr7 |= (((breakinfo[breakno].len << 2) |
> And the same wrong shift here.
Correct here as well. :-)
WBR, Sergei
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport