[lkml]   [2002]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectProblems with debugging I/O port access in kdb on i386

Hi Keith, everybody,

I have encountered the following problems with kdb 2.1 (2.4.18)
when trying to catch I/O port accesses in kdb (both can probably be fixed

1. This code in kdb/kdb_bp.c:

if (kdba_verify_rw(addr, sizeof(kdb_machinst_t))) {
kdb_printf("Invalid address for breakpoint, ignoring bp command\n");

forbids to set I/O breakpoints on low ports (e.g. 0x20), because the
address check done by kdba_verify_rw is valid for memory addresses
only. AFAICS, no check whatsoever is necessary for I/O port addresses.

I would submit a patch for this, but the address check must be
postponed after the architecture-dependent parsing, and the information
whether this is an I/O port breakpoint must be passed to the checking
code. I don't know what implications that may have for the
other architectures.

2. The DE flag in the CR4 register must be set (for CPUs that have it)
in order to use I/O breakpoints at all. Otherwise they will be simply
ignored by the CPU.

Thus, a line like

if (cpu_has_de)
set_in_cr4 (X86_CR4_DE);

must be put in kdba_init().
That may not suffice because cpu_init() (kernel/setup.c) clears the DE
bit for each CPU, I don't know which one is called first.

Again, I do not oversee all possible implications, so I do not submit a

As a hack, I inserted the above line in kdba_installdbreg() after the

dr7 |= DR7_GE;

This works fine, I can now trap the I/O accesses I want.


Martin Wilck Phone: +49 5251 8 15113
Fujitsu Siemens Computers Fax: +49 5251 8 20409
Heinz-Nixdorf-Ring 1
D-33106 Paderborn

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.026 / U:10.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site