diff --git a/abi/abi_test.go b/abi/abi_test.go index aecdb64..10004d6 100644 --- a/abi/abi_test.go +++ b/abi/abi_test.go @@ -208,3 +208,10 @@ func TestSnpPlatformInfo(t *testing.T) { } } } + +func TestCpuid(t *testing.T) { + a, b, c, d := cpuid(1) + if (a | b | c | d) == 0 { + t.Errorf("cpuid(1) = 0, 0, 0, 0") + } +} diff --git a/abi/cpuid.go b/abi/cpuid.go new file mode 100644 index 0000000..e6f7b8f --- /dev/null +++ b/abi/cpuid.go @@ -0,0 +1,10 @@ +//go:build !amd64 || gccgo +// +build !amd64 gccgo + +package abi + +func init() { + cpuid = func(op uint32) (eax, ebx, ecx, edx uint32) { + return 0, 0, 0, 0 + } +} diff --git a/abi/cpuid_amd64.go b/abi/cpuid_amd64.go new file mode 100644 index 0000000..c0e0297 --- /dev/null +++ b/abi/cpuid_amd64.go @@ -0,0 +1,10 @@ +//go:build amd64 && !gccgo +// +build amd64,!gccgo + +package abi + +func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32) + +func init() { + cpuid = asmCpuid +}