23.03.2013 Views

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

call ___printf_chk<br />

mov eax, esi<br />

shr eax, 8<br />

and eax, 0Fh<br />

mov [esp+8], eax<br />

mov dword ptr [esp+4], offset aFamily_idD ; "family_id=%d\n"<br />

mov dword ptr [esp], 1<br />

call ___printf_chk<br />

mov eax, esi<br />

shr eax, 0Ch<br />

and eax, 3<br />

mov [esp+8], eax<br />

mov dword ptr [esp+4], offset aProcessor_type ; "processor_type=%d\n"<br />

mov dword ptr [esp], 1<br />

call ___printf_chk<br />

mov eax, esi<br />

shr eax, 10h<br />

shr esi, 14h<br />

and eax, 0Fh<br />

and esi, 0FFh<br />

mov [esp+8], eax<br />

mov dword ptr [esp+4], offset aExtended_model ; "extended_model_id=%d\n"<br />

mov dword ptr [esp], 1<br />

call ___printf_chk<br />

mov [esp+8], esi<br />

mov dword ptr [esp+4], offset unk_80486D0<br />

mov dword ptr [esp], 1<br />

call ___printf_chk<br />

add esp, 18h<br />

xor eax, eax<br />

pop ebx<br />

pop esi<br />

mov esp, ebp<br />

pop ebp<br />

retn<br />

main endp<br />

Almost the same. The only thing <strong>to</strong> note is that GCC somehow united calculation of extended_model_id<br />

and extended_family_id in<strong>to</strong> one block, instead of calculating them separately, be<strong>for</strong>e corresponding each<br />

printf() call.<br />

Working with the float type as with a structure<br />

As it was already noted in section about FPU 1.12, both float and double types consisted of sign, significand<br />

(or fraction) and exponent. But will we able <strong>to</strong> work with these fields directly? Let’s try with float.<br />

#include <br />

#include <br />

Figure 1.1: float value <strong>for</strong>mat (illustration taken from wikipedia)<br />

75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!