Assembly Language for Beginners

(nextflipdebug2) #1

1.24. STRUCTURES


MSVC + OllyDbg


Let’s load our example into OllyDbg and see, what values are set in EAX/EBX/ECX/EDX after the execution
of CPUID:


Figure 1.108:OllyDbg: After CPUID execution

EAX has0x000206A7(myCPUis Intel Xeon E3-1220).
This is 0 b 00000000000000100000011010100111 in binary form.


Here is how the bits are distributed by fields:


field in binary form in decimal form
reserved2 0000 0
extended_family_id 00000000 0
extended_model_id 0010 2
reserved1 00 0
processor_id 00 0
family_id 0110 6
model 1010 10
stepping 0111 7

Listing 1.351: Console output

stepping=7
model=10
family_id=6
processor_type=0
extended_model_id=2
extended_family_id=0


GCC


Let’s try GCC 4.4.1 with-O3option.


Listing 1.352: Optimizing GCC 4.4.1

main proc near ; DATA XREF: _start+17
push ebp
mov ebp, esp
and esp, 0FFFFFFF0h
push esi

Free download pdf