cpu.x86: Some calls to CPUID take a parameter in ECX. Add cpuid-extended to allow these.
parent
e45f0ec9e2
commit
e97c8971a5
|
@ -230,13 +230,14 @@ M: x86.32 flatten-struct-type
|
||||||
|
|
||||||
M: x86.32 struct-return-on-stack? os linux? not ;
|
M: x86.32 struct-return-on-stack? os linux? not ;
|
||||||
|
|
||||||
M: x86.32 (cpuid) ( n regs -- )
|
M: x86.32 (cpuid) ( eax ecx regs -- )
|
||||||
void { uint void* } cdecl [
|
void { uint uint void* } cdecl [
|
||||||
! Save ds-reg, rs-reg
|
! Save ds-reg, rs-reg
|
||||||
EDI PUSH
|
EDI PUSH
|
||||||
EAX ESP 4 [+] MOV
|
EAX ESP 4 [+] MOV
|
||||||
|
ECX ESP 8 [+] MOV
|
||||||
CPUID
|
CPUID
|
||||||
EDI ESP 8 [+] MOV
|
EDI ESP 12 [+] MOV
|
||||||
EDI [] EAX MOV
|
EDI [] EAX MOV
|
||||||
EDI 4 [+] EBX MOV
|
EDI 4 [+] EBX MOV
|
||||||
EDI 8 [+] ECX MOV
|
EDI 8 [+] ECX MOV
|
||||||
|
|
|
@ -131,10 +131,11 @@ M: x86.64 float-on-stack? f ;
|
||||||
|
|
||||||
M: x86.64 struct-return-on-stack? f ;
|
M: x86.64 struct-return-on-stack? f ;
|
||||||
|
|
||||||
M: x86.64 (cpuid) ( n regs -- )
|
M: x86.64 (cpuid) ( rax rcx regs -- )
|
||||||
void { uint void* } cdecl [
|
void { uint uint void* } cdecl [
|
||||||
RAX param-reg-0 MOV
|
RAX param-reg-0 MOV
|
||||||
RSI param-reg-1 MOV
|
RCX param-reg-1 MOV
|
||||||
|
RSI param-reg-2 MOV
|
||||||
CPUID
|
CPUID
|
||||||
RSI [] EAX MOV
|
RSI [] EAX MOV
|
||||||
RSI 4 [+] EBX MOV
|
RSI 4 [+] EBX MOV
|
||||||
|
|
|
@ -85,11 +85,14 @@ MEMO: sse-version ( -- n )
|
||||||
: sse4.1? ( -- ? ) sse-version 41 >= ;
|
: sse4.1? ( -- ? ) sse-version 41 >= ;
|
||||||
: sse4.2? ( -- ? ) sse-version 42 >= ;
|
: 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 ;
|
4 <uint-array> [ (cpuid) ] keep >array ;
|
||||||
|
|
||||||
|
: cpuid ( rax -- 4array ) 0 cpuid-extended ;
|
||||||
|
|
||||||
: cpu-stepping ( -- n ) 1 cpuid first 4 bits ;
|
: cpu-stepping ( -- n ) 1 cpuid first 4 bits ;
|
||||||
: cpu-model ( -- n ) 1 cpuid first -4 shift 4 bits ;
|
: cpu-model ( -- n ) 1 cpuid first -4 shift 4 bits ;
|
||||||
: cpu-family ( -- n ) 1 cpuid first -8 shift 4 bits ;
|
: cpu-family ( -- n ) 1 cpuid first -8 shift 4 bits ;
|
||||||
|
|
Loading…
Reference in New Issue