Re: Display instruction address in instrument

"Stanislav" <[email protected]> Fri, 25 Nov 2016 20:48:08 +0200
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
Hi,

I don't understand your question.
Are you interested in instruction CS:EIP as well ?
You could simply access CPU class from any of the function and grab the
value of any register at any moment.
For example the BEFORE_EXECUTION callback simply asks CPU about CS.D_B and
CS.L:

  i->is32 = BX_CPU(cpu)->sregs[BX_SEG_REG_CS].cache.u.segment.d_b;
  i->is64 = BX_CPU(cpu)->long64_mode(); 

Similarly you can get any value of any register, even EAX if you want. 

Stanislav

-----Original Message-----
From: Max [mailto:[email protected]] 
Sent: Wednesday, November 23, 2016 5:53 PM
To: [email protected]
Subject: [Bochs-developers] Display instruction address in instrument

Good day,

I'm new to Bochs and C++, that's why it's probably an easy question, sorry,
but I already spend few hours on the source code, without success.

I'm trying to adapt the function:
 void bx_print_instruction(unsigned cpu, const instruction_t *i) defined in:
 instrument/example0/instrument.cc
to display the memory address too, but I can't make it.

I tried to find the right attribut/method but didn't find.
I tried to pass EIP, but as the code runs in real mode (mbr), the CS part is
missing.
There's probably an easier way to do it than adding parameters to:
BX_INSTR_BEFORE_EXECUTION
BX_INSTR_AFTER_EXECUTION

Any hint ?

Regards,
Max

----------------------------------------------------------------------------
--
_______________________________________________
bochs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers


------------------------------------------------------------------------------