Get the Contents of EIP and CR1 in Real Mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
XStream

Get the Contents of EIP and CR1 in Real Mode

Post by XStream »

Hey,

Just as the topic says, I need get the contents of EIP and CR1 so that my error handler can print up the state of the machine, I am currently in real mode but it is probably the same no matter what mode your in.

I have tried

Code: Select all

mov   eax, eip/cr1
and I have also tried

Code: Select all

push   eip/cr1
pop   eax
But neither way works??

Cheers.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Get the Contents of EIP and CR1 in Real Mode

Post by Candy »

XStream wrote: Hey,

Just as the topic says, I need get the contents of EIP and CR1 so that my error handler can print up the state of the machine, I am currently in real mode but it is probably the same no matter what mode your in.

I have tried

Code: Select all

mov   eax, eip/cr1
and I have also tried

Code: Select all

push   eip/cr1
pop   eax
But neither way works??

Cheers.
For eip

Code: Select all

call nearjump
nearjump:
pop eax
CR1 doesn't exist. It's physically not existant in the processor afaik.

If it was, you could read it with mov eax, cr1 (movl %cr1, %eax).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Get the Contents of EIP and CR1 in Real Mode

Post by Solar »

CR1 is reserved for all purposes, according to the Intel manuals. Even if you could print its values, it wouldn't help anyone anything. ;)
Every good solution is obvious once you've found it.
XStream

Re:Get the Contents of EIP and CR1 in Real Mode

Post by XStream »

Thanks guys.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Get the Contents of EIP and CR1 in Real Mode

Post by Brendan »

Hi,
Candy wrote:

Code: Select all

call nearjump
nearjump:
pop eax
For real mode you might want to use "pop ax" instead of "pop eax"....


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply