I wish to change this following assembly code into UNIX compatible code without using the linux kernel (or system?) call. (int $0x80)
This code is for Intel 32bit Pentium platform, written in AT&T syntax
#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
thanks,
Suggestion: Write a C program, with inline assembly. You could also call C library functions (like
printf) from your assembly, in order to remove the OS dependency.Here’s an example with inline assembly: http://softpixel.com/~cwright/programming/simd/cpuid.php