Board index » delphi » Cpu vendor identification in BP7

Cpu vendor identification in BP7

I downloaded an asm function from the Cyrix web site. It returns the values
contained in eax, ebx, ecx and edx registers after a cpuid call. What can I
do to use it in BP7 (prototype of the external procedure ?) My problem is
getting the cpu vendor identification (input eax = 0).

Thanx.

;**************************************************************************
;       Function:       void get_cpuid_info (long level,
;                                            long &reg_eax,
;                                            long &reg_ebx,
;                                            long &reg_ecx,
;                                            long &reg_edx)
;
;       Purpose:        Execute CPUID instruction at level (eax==level)
;
;       Inputs:         level - eax value when CPUID is executed
;
;       Output:         reg_eax - eax after executing CPUID
;                       reg_ebx - ebx after executing CPUID
;                       reg_ecx - ecx after executing CPUID
;                       reg_edx - edx after executing CPUID
;**************************************************************************
_get_cpuid_info        proc near
.386
 push bp
 mov bp, sp

        push    eax
        push    ebx
        push    ecx
        push    edx
        push    esi

 mov eax, dword ptr [bp+4]      ; get level

cpuid

 mov si,word ptr [bp+8]
 mov dword ptr [si],eax        ; reg_eax := eax

 mov si,word ptr [bp+10]
 mov dword ptr [si],ebx        ; reg_ebx := ebx

 mov si,word ptr [bp+12]       ; reg_ecx := ecx
 mov dword ptr [si],ecx

 mov si,word ptr [bp+14]       ; reg_edx := edx
 mov dword ptr [si],edx

 pop     esi
 pop     edx
 pop     ecx
 pop     ebx
 pop     eax

 mov     sp,bp
 pop     bp
 ret
_get_cpuid_info        endp

 

Re:Cpu vendor identification in BP7


On Fri Jul 10, "Karem FENNOUCH" wrote:

Quote
>I downloaded an asm function from the Cyrix web site. It returns the values
>contained in eax, ebx, ecx and edx registers after a cpuid call. What can I
>do to use it in BP7 (prototype of the external procedure ?) My problem is
>getting the cpu vendor identification (input eax = 0).

This, or something very like it, might work directly as a BP7
procedure:

var
   regeax, regebx, regecx, regedx  : longint;

procedure
   getcpuid(    level    : longint); assembler;
(*       Purpose:        Execute CPUID instruction at level (eax==level)

         Inputs:         level - eax value when CPUID is executed

         Output:         reg_eax - eax after executing CPUID
                         reg_ebx - ebx after executing CPUID
                         reg_ecx - ecx after executing CPUID
                         reg_edx - edx after executing CPUID
*)

asm
   $66 mov       ax,level
   cpuid
   $66 mov       regeax,ax
   $66 mov       regebx,bx
   $66 mov       regecx,cx
   $66 mov       regedx,dx
end;

Brent
--
Brent Beach, Victoria, BC

Other Threads