作者在 2010-12-18 22:34:27 发布以下内容
#cpuid.s Sample program to extract the processor Vendor ID
.section .data
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
.section .text
.globl _start
_start:
movl $0, %eax
cpuid
movl $output, %edi
movl %ebx, 28(%edi)
movl %edx, 32(%edi)
movl %ecx, 36(%edi)
movl $4, %eax
movl $1, %ebx
movl $output, %ecx
movl $42, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
---------------------------------------------------------------------------------------------------------------------------
EAX value cpuid output
0 Vendor ID string, and the maximum cpuid option value supported
1 Processor type, family, model, and stepping information
2 Processor cache configuration
3 Processor serial number
4 Cache configuration
5 Monitor information
80000000h Extended vendor ID string and supported levels
80000001h Extended processor type, family, model, and stepping information
80000002h
-80000004h Extended processor name string
.section .data
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
.section .text
.globl _start
_start:
movl $0, %eax
cpuid
movl $output, %edi
movl %ebx, 28(%edi)
movl %edx, 32(%edi)
movl %ecx, 36(%edi)
movl $4, %eax
movl $1, %ebx
movl $output, %ecx
movl $42, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
---------------------------------------------------------------------------------------------------------------------------
EAX value cpuid output
0 Vendor ID string, and the maximum cpuid option value supported
1 Processor type, family, model, and stepping information
2 Processor cache configuration
3 Processor serial number
4 Cache configuration
5 Monitor information
80000000h Extended vendor ID string and supported levels
80000001h Extended processor type, family, model, and stepping information
80000002h
-80000004h Extended processor name string