All pastes #633051 Raw Edit

Unnamed

public text v1 · immutable
#633051 ·published 2007-07-25 12:13 UTC
rendered paste body
07FF780    push ebp
007FF781    mov ebp, esp
007FF783    sub esp, 00000014
007FF786    push ebx
007FF787    push esi
007FF788    mov esi, 00000003
007FF78D    mov [ebp-04], 00000001
007FF794    xor eax, eax
007FF796    cpuid                         # returns Vendor string in ebx/ecx/edx
007FF798    mov dword ptr [ebp-14], ebx
007FF79B    mov dword ptr [ebp-10], edx
007FF79E    mov dword ptr [ebp-0C], ecx
007FF7A1    mov [ebp-08], 00
007FF7A5    cmp eax, 00000004
007FF7A8    jl 007FF7BD
007FF7AA    mov eax, 00000004
007FF7AF    xor ecx, ecx
007FF7B1    cpuid                        # returns Deterministic Cache Parameters
007FF7B3    shr eax, 1A                  # Max. number of processor cores -1
007FF7B6    and eax, 0000003F
007FF7B9    inc eax                      # Now, eax = Max. number of processor cores
007FF7BA    mov dword ptr [ebp-04], eax
007FF7BD    lea eax, dword ptr [ebp-14]
007FF7C0    push 00AEAEB0                # Pointer to string "GenuineIntel"
007FF7C5    push eax
007FF7C6    call 009DCDE0                # compare vendor string with "GenuineIntel"
007FF7CB    add esp, 00000008
007FF7CE    test eax, eax                # is it "GenuineIntel"?
007FF7D0    jne 007FF7E5                 # No? then test for AMD...

            # It's an Intel CPU
007FF7D2    mov edx, dword ptr [ebp-04]  # number of CPU cores
007FF7D5    mov ecx, 00000001
007FF7DA    cmp ecx, edx                 # cores > 1 ?
007FF7DC    pop esi
007FF7DD    sbb eax, eax                 # eax := (cores > 1) ? -1 : 0
007FF7DF    pop ebx
007FF7E0    inc eax                      # eax := (cores > 1) ? 0 : 1
007FF7E1    mov esp, ebp
007FF7E3    pop ebp
007FF7E4    ret                          # return eax as the result.

            # It's not an Intel CPU
007FF7E5    lea edx, dword ptr [ebp-14]
007FF7E8    push 00AEAEA0                # Pointer to string "AuthenticAMD"
007FF7ED    push edx
007FF7EE    call 009DCDE0
007FF7F3    add esp, 00000008
007FF7F6    test eax, eax                # is it "AuthenticAMD"?
007FF7F8    mov eax, 00000002            # eax := 2
007FF7FD    je 007FF801
007FF7FF    mov eax, esi                 # eax := 3 (if not "AuthenticAMD")
007FF801    pop esi
007FF802    pop ebx
007FF803    mov esp, ebp
007FF805    pop ebp
007FF806    ret                          # return eax as the result.