Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on

Re: How can I read PC(program counter) during Linux kernel booting?
comp.os.linux.embedded, en JoohyeonPark va escriure:

Alternative 1: use a pc emulator such as bochs / embedded machine emulator
from your developement machine.
Alternative 2: exec the kernel from within gdb
Alternative 3: write a wrapper around the boot process, depending on your
environement.
For x86 systems, you can install interrupt handler 3, then proceed in single
step each instruction. The ISR (interrupt service routine) can give you the
PC (with any other registrer you want). To get the PC, grab it from the
stack.
For other systems, you may need to find a suitable interrupt (check the
processor databook to check if there's a single step interrupt /
instruction ) and do the same.
If there isn't such instruction / operation mode, you can use a NMI/INT,
using the NMI/INT ISR as main control for the debugger, and letting just
the computer to execute one instruction before the next interrupt (usually
by leaving the interrupt pin aserted continually).
Ideally, you should do remote debugging using an unused communications port,
because if you insert printk/printf commands in the ISR you could be
tampering with the machine hardware status that the kernel expects.
Beware of unsuspected side effects, such as timing problems with drivers,
and so on.
--
--------------------
Albert Gonzalez
--------------------
Albert Gonzalez
Site Timeline
- » emac inc's linux starter kit
- — Next thread in » Embedded Linux
-
- » Cross tools for SH processors and Slackware
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Telefon na wiele kilometrow.
- — The site's Newest Thread. Posted in » Electronics (Polish)
-