Reverse Engineering for Beginners

(avery) #1

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


JPEwasn’t triggered, soFLDloads the value ofa(5.6) inST(0):


Figure 17.15:OllyDbg: secondFLDexecuted

The function finishes its work.


Optimizing MSVC 2010


Listing 17.11: Optimizing MSVC 2010

_a$ = 8 ; size = 8
_b$ = 16 ; size = 8
_d_max PROC
fld QWORD PTR _b$[esp-4]
fld QWORD PTR _a$[esp-4]


; current stack state: ST(0) = _a, ST(1) = _b


fcom ST(1) ; compare _a and ST(1) = (_b)
fnstsw ax
test ah, 65 ; 00000041H
jne SHORT $LN5@d_max
; copy ST(0) to ST(1) and pop register,
; leave (_a) on top
fstp ST(1)


; current stack state: ST(0) = _a


ret 0
$LN5@d_max:
; copy ST(0) to ST(0) and pop register,
; leave (_b) on top
fstp ST(0)


; current stack state: ST(0) = _b

Free download pdf