How can I read PC(program counter) during Linux kernel booting?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I want to know the PC(program counter) during Linux kernel booting.
 But I have no idea of printing PC.
 Should I use assembler code ?
 Please make me get the idea of using c-code..

Re: How can I read PC(program counter) during Linux kernel booting?
El dia del senyor de Dimarts 14 Setembre 2004 08:01, al grup de news
comp.os.linux.embedded, en JoohyeonPark va escriure:

Quoted text here. Click to load it

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



Site Timeline