Reverse Engineering for Beginners

(avery) #1

CHAPTER 17. FLOATING-POINT UNIT CHAPTER 17. FLOATING-POINT UNIT


FSTP ST(1)was executed: a value of 5.6 is now at the top of the FPU stack.


Figure 17.25:OllyDbg:FSTPwas executed

We now see that theFSTP ST(1)instruction works as follows: it leaves what was at the top of the stack, but clearsST(1).


GCC 4.4.1


Listing 17.12: GCC 4.4.1

d_max proc near


b = qword ptr -10h
a = qword ptr -8
a_first_half = dword ptr 8
a_second_half = dword ptr 0Ch
b_first_half = dword ptr 10h
b_second_half = dword ptr 14h


push ebp
mov ebp, esp
sub esp, 10h

; put a and b to local stack:


mov eax, [ebp+a_first_half]
mov dword ptr [ebp+a], eax
mov eax, [ebp+a_second_half]
mov dword ptr [ebp+a+4], eax
mov eax, [ebp+b_first_half]
mov dword ptr [ebp+b], eax
mov eax, [ebp+b_second_half]
mov dword ptr [ebp+b+4], eax

; load a and b to FPU stack:

Free download pdf