0

I need some help with understanding what is being actualy done in those two assembly lines:

fistp qword ptr [esp+10h] ss:0023:0013be80=0000000000001cf8

fild qword ptr [esp+10h] ss:0023:0013be80=0000000000002c36

What is the underlying operetion that changes 1cf8 to 2c36

Thanks in adv

3
  • Intel's floating point instructions are based on a stack. fist stores a 16-32-64-bit floating point number (IEEE) to the operand address, whereas fild loads from an address into the stack. The p suffix, is the variation of fist that pops the first value, ST(0), from said stack. The values you're seeing are not the underlying operand changing the address, but rather that before fistp is run, the value is 0x1cf8. After executing fistp, however, ST(0) is popped and written to [esp+0x10] as 0x2c36. When execution gets to fild, the previous value of ST(0) was already written. Commented Aug 23 at 18:34
  • ...that is assuming that there's no other instructions tampering with [esp+0x10] in between the two instructions you listed. (Related question: reverseengineering.stackexchange.com/questions/20559/…, link for answer is archived at web.archive.org/web/20071006182549/http://www.ray.masmcode.com/…) Commented Aug 23 at 18:40
  • First of all, sorry for late reply. Yes, you are right, it all seems clear for me now. Thank you for explanation.
    – Uddie
    Commented Aug 29 at 19:59

1 Answer 1

2

download software developer manual volume 2 for intel

volume 2 is instruction set reference

or as a second choice use online references

search fistp or any other instruction and read for better understanding

enter image description here

basically FISTP takes what is in st[0] converts it to a signed integer and stores it in destination and pops the st[0] (empties st[0])

suppose st[0] contains a valid float like 486.87 (using 32 bit ollydbg here) enter image description here

and your instruction pointer contains fistp qword ptr [esp+10] enter image description here

on executing this instruction esp+10 will hold 487 (486.87 rounded to 487 and positive signed) prior to execution enter image description here

post execution enter image description here

an the stack has been popped

enter image description here

hope you will be able to follow this for FILD

1
  • So sorry for late reply. I've got the procedure. I can manage on my own now. Thanks a lot!
    – Uddie
    Commented Aug 29 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.