follow is some asm code I write when I learn at&t
I just want to learn or talk, learn is hard.
so, wish help some one.
sorry for my poor english
first display CPUID
next is code use crt
have a joy
I just want to learn or talk, learn is hard.
so, wish help some one.
sorry for my poor english
first display CPUID
#cpuid.s show extract the processor vendor ID
.section .data
output:
.ascii "the processor vendor ID is 'XXXXXXXXXXXX'\n"
.section .text
.globl 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
next is code use crt
# cpuidinlib.s show extract the processor vendor ID using library
.section .data
output:
.asciz "the processor vendor ID is %s\n"
.section .bss
.lcomm buffer, 12
.section .text
.globl _start
_start:
movq $0, %rax
cpuid
movq $buffer, %rdi
movl %ebx, (%rdi)
movl %edx, 4(%rdi)
movl %ecx, 8(%rdi)
movq $output, %rdi
movq $buffer, %rsi
xorq %rax, %rax
call printf
movq $0, %rdi
xorq %rax, %rax
call exit
have a joy