Public domain
/*
* Sample program to extract the processor Vendor ID
* Filename : cpuid.s
* Compile : as -o cpuid.o cpuid.s
* Link : ld -o cpuid cpuid.o
*
*/
.section .data
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
.section .text
.global _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
/*
* Sample program to extract the processor Vendor ID
* Filename : cpuid.s
* Compile & Link : gcc -o cpuid.o cpuid.s
*
*/
.section .data
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
.section .text
.global main
main:
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
BY: Pejman Moghadam
TAG: asm, gcc, cpuid
DATE: 2013-01-05 14:46:03