--- cpuid.asm 2004/03/22 22:36:24 1.5 +++ cpuid.asm 2004/08/22 11:46:10 1.8 @@ -19,7 +19,7 @@ ; * along with this program ; if not, write to the Free Software ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; * -; * $Id: cpuid.asm,v 1.5 2004/03/22 22:36:24 edgomez Exp $ +; * $Id: cpuid.asm,v 1.8 2004/08/22 11:46:10 edgomez Exp $ ; * ; ***************************************************************************/ @@ -27,10 +27,19 @@ %macro cglobal 1 %ifdef PREFIX - global _%1 - %define %1 _%1 + %ifdef MARK_FUNCS + global _%1:function + %define %1 _%1:function + %else + global _%1 + %define %1 _%1 + %endif %else - global %1 + %ifdef MARK_FUNCS + global %1:function + %else + global %1 + %endif %endif %endmacro @@ -62,9 +71,9 @@ ALIGN 32 %ifdef FORMAT_COFF -SECTION .rodata data +SECTION .rodata %else -SECTION .rodata data align=16 +SECTION .rodata align=16 %endif vendorAMD: @@ -99,6 +108,8 @@ push edi push ebp + sub esp, 12 ; Stack space for vendor name + xor ebp, ebp ; CPUID command ? @@ -118,9 +129,9 @@ ; get vendor string, used later xor eax, eax cpuid - mov [esp-12], ebx ; vendor string - mov [esp-12+4], edx - mov [esp-12+8], ecx + mov [esp], ebx ; vendor string + mov [esp+4], edx + mov [esp+8], ecx test eax, eax jz near .cpu_quit @@ -151,7 +162,7 @@ ; AMD cpu ? lea esi, [vendorAMD] - lea edi, [esp-12] + lea edi, [esp] mov ecx, 12 cld repe cmpsb @@ -170,6 +181,8 @@ mov eax, ebp + add esp, 12 + pop ebp pop edi pop esi