Page 2 of 2

Re: How to load all registers into C struct?

Posted: Thu Nov 25, 2021 8:15 pm
by neon
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.