download cpucount_asm.asm
Language: Assembler
LOC: 46
Project Info
geekinfo - Cross-platform system information tool(geekinfo)
Server: Google
Type: svn
Google\g\geekinfo\trunk\
   basesystem.cpp
   basesystem.h
   cpucount.cpp
   cpucount.h
   cpucount_asm.asm
   cpucount_asm.h
   geekinfo.cpp
   geekinfo.h
   geekinfo_c.cpp
   geekinfo_c.h
   geekinfo_c_test.c
   linuxsystem.cpp
   linuxsystem.h
   macosxsystem.cpp
   macosxsystem.h
   Makefile.win32
   Makefile_c.win32
   model.cpp
   model.h
   model.py
   platform.h
   solarissystem.cpp
   solarissystem.h
   system.cpp
   system.h
   types.h
   win32system.cpp
   win32system.h
   wmi.cpp
   wmi.h

; Taken from original Intel cpucount.cpp code

%macro cglobal 1
	%ifdef PREFIX
		global _%1
		%define %1 _%1
	%else
		global %1
	%endif
%endmacro

SECTION .text
;.....................................................
cglobal  __MaxCorePerPhysicalProc__
;.....................................................
__MaxCorePerPhysicalProc__:
    xor eax, eax
    cpuid
    cmp eax, 4			 ;check if cpuid supports leaf 4
	jl single_core		 ;Single core
	mov eax, 4
	mov ecx, 0			 ;start with index = 0; Leaf 4 reports
	cpuid				 ;at least one valid cache level
	jmp multi_core

    single_core:
	xor eax, eax

    multi_core:
    
    ret

;.....................................................
cglobal  __find_maskwidth__
;.....................................................
__find_maskwidth__:
          enter 0, 0
          
          push ebx              ;\
          push ecx              ;\
          push edx              ;\
          push edi              ;\
          push esi
          
          mov eax, [ebp+8]       ; first parameter to function 
		  mov ecx, 0
		  dec eax
		  bsr cx, ax
		  jz next
		  inc cx
		  mov eax, ecx
next:
                
          pop esi               ;\
          pop edi               ;\
          pop edx               ;\
          pop ecx               ;\
          pop ebx               ;\
          
          leave
          ret

;.....................................................

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us