* Problems with debugging I/O port access in kdb on i386
@ 2002-03-18 18:23 Martin Wilck
0 siblings, 0 replies; only message in thread
From: Martin Wilck @ 2002-03-18 18:23 UTC (permalink / raw)
To: Keith Owens; +Cc: Linux Kernel mailing list
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
easily):
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");
return(0);
}
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
patch.
As a hack, I inserted the above line in kdba_installdbreg() after the
line
dr7 |= DR7_GE;
This works fine, I can now trap the I/O accesses I want.
Cheers,
Martin
--
Martin Wilck Phone: +49 5251 8 15113
Fujitsu Siemens Computers Fax: +49 5251 8 20409
Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com
D-33106 Paderborn http://www.fujitsu-siemens.com/primergy
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-18 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18 18:23 Problems with debugging I/O port access in kdb on i386 Martin Wilck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).