]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86: Some calls to CPUID take a parameter in ECX. Add cpuid-extended to allow...
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 19 Sep 2012 18:30:54 +0000 (11:30 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 19 Sep 2012 18:30:54 +0000 (11:30 -0700)
basis/cpu/x86/32/32.factor
basis/cpu/x86/64/64.factor
basis/cpu/x86/features/features.factor

index 4c9680f0ba6ad8b07c1867e7600cb4798fda4e68..cd532d34e2999e7f4f5f92c1f7b8b4e17f3817e2 100755 (executable)
@@ -230,13 +230,14 @@ M: x86.32 flatten-struct-type
 
 M: x86.32 struct-return-on-stack? os linux? not ;
 
-M: x86.32 (cpuid) ( n regs -- )
-    void { uint void* } cdecl [
+M: x86.32 (cpuid) ( eax ecx regs -- )
+    void { uint uint void* } cdecl [
         ! Save ds-reg, rs-reg
         EDI PUSH
         EAX ESP 4 [+] MOV
+        ECX ESP 8 [+] MOV
         CPUID
-        EDI ESP 8 [+] MOV
+        EDI ESP 12 [+] MOV
         EDI [] EAX MOV
         EDI 4 [+] EBX MOV
         EDI 8 [+] ECX MOV
index 8270dc758c1f708c3f6143d60247e72c72d3c014..dc83164b068267ecfb5663ed119ac001755a57e0 100644 (file)
@@ -131,10 +131,11 @@ M: x86.64 float-on-stack? f ;
 
 M: x86.64 struct-return-on-stack? f ;
 
-M: x86.64 (cpuid) ( n regs -- )
-    void { uint void* } cdecl [
+M: x86.64 (cpuid) ( rax rcx regs -- )
+    void { uint uint void* } cdecl [
         RAX param-reg-0 MOV
-        RSI param-reg-1 MOV
+        RCX param-reg-1 MOV
+        RSI param-reg-2 MOV
         CPUID
         RSI [] EAX MOV
         RSI 4 [+] EBX MOV
index 0206d0431acbba43b20681e6e45f8187a9553fe4..84fe129a3f42a4bcf5abbab2060b51d955a32eed 100644 (file)
@@ -85,11 +85,14 @@ MEMO: sse-version ( -- n )
 : sse4.1? ( -- ? ) sse-version 41 >= ;
 : sse4.2? ( -- ? ) sse-version 42 >= ;
 
-HOOK: (cpuid) cpu ( n regs -- )
+HOOK: (cpuid) cpu ( rax rcx regs -- )
 
-: cpuid ( n -- 4array )
+
+: cpuid-extended ( rax rcx -- 4array )
    4 <uint-array> [ (cpuid) ] keep >array ;
 
+: cpuid ( rax -- 4array ) 0 cpuid-extended ;
+
 : cpu-stepping ( -- n ) 1 cpuid first 4 bits ;
 : cpu-model ( -- n ) 1 cpuid first -4 shift 4 bits ;
 : cpu-family ( -- n ) 1 cpuid first -8 shift 4 bits ;