[panda-users] Access to registers
alessandro mantovani
alk13 at hotmail.it
Wed Apr 25 08:37:31 EDT 2018
Hi all,
I'm writing a plugin which needs to read values contained in registers of an x86 architecture. In particular I need to access to 'AH' and 'AL' registers from a "translate_insn" callback correcly registered. If I access the registers through:
#ifdef TARGET_I386
CPUArchState * cpu = (CPUArchState*) env;
target_ulong reg_ah = cpu->regs[R_AH];
target_ulong reg_al = cpu->regs[R_AL];
....
#endif
The problem is that if I print variables "reg_ah" and "reg_al" I always collect the same value for 'AH' and the same value for 'AL'. It is like if the plugin doesn't flush. So if the first read value is '0xabcd' for 'AH' all the following callbacks will print that register 'AH' contains '0xabcd'.
In addition to this, it is strange (in my opinion) that if I do:
printf("value of ah: " TARGET_FMT_lx "\n", cpu->regs[R_AH]);
It prints a value which is bigger than an 8-bit number. Registers 'AH' and 'AL' have both size 8 bit , so I would expect that I can get 0xff at maximum. Maybe I must enable something to correctly access to registers?
Thanks,
elmanto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/panda-users/attachments/20180425/95aff32e/attachment.html
More information about the panda-users
mailing list