OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:04 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: How to load all registers into C struct?
PostPosted: Thu Nov 25, 2021 8:15 pm 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hi,

Just a few comments...

1. push ebx/pop ebx to save/restore ebx on the now working stack around cpuid.
2. with bochs debugger you could just do b <entrypoint>, c, regs to get the value of EBX (with x <addr> to confirm its contents.) Don't underestimate the usefulness of debuggers. You could have gotten the value of EBX in about a minute. Take your time to get comfortable with debuggers right now - don't wait.
3. i typically recommend writing to serial port since emulators and virtual machines can redirect it to a file. That way you can have debug messages and output whatever you want. No need to try to "get the value of a register" when you can just output an entire structure contents through serial and output it to a file.

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 61 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group