2016-11-25 17:18:40 +01:00
|
|
|
/*
|
|
|
|
* The CPUID instruction is always supported on the amd64.
|
|
|
|
*/
|
|
|
|
.globl cpuid
|
|
|
|
cpuid:
|
2017-08-11 01:47:15 +02:00
|
|
|
pushq %rbx
|
|
|
|
pushq %rcx
|
|
|
|
pushq %rdx
|
|
|
|
movl %edi, %eax
|
|
|
|
cpuid
|
|
|
|
movl %eax, 0(%rsi)
|
|
|
|
movl %ebx, 4(%rsi)
|
|
|
|
movl %ecx, 8(%rsi)
|
|
|
|
movl %edx, 12(%rsi)
|
2016-11-25 17:18:40 +01:00
|
|
|
popq %rdx
|
|
|
|
popq %rcx
|
2017-08-11 01:47:15 +02:00
|
|
|
popq %rbx
|
2016-11-25 17:18:40 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Basic timing loop to determine CPU frequency.
|
|
|
|
* The AAM instruction is not available in 64-bit mode.
|
|
|
|
*/
|
|
|
|
.globl aamloop
|
|
|
|
aamloop:
|
|
|
|
pushq %rcx
|
|
|
|
movq %rdi, %rcx
|
|
|
|
aaml1:
|
|
|
|
xorq %rax, %rax /* close enough */
|
|
|
|
loop aaml1
|
|
|
|
popq %rcx
|
|
|
|
ret
|