CPUID,用于显示CPU的vendor information

.section .data
output:
.asciz "The processor Vendor ID is '%s'\n"
.section .bss
.lcomm buffer ,24
.section .text
.globl main
main:
#eax里面存放的是cpuid这个指令的参数 
#eax=0时输出processor Vendor information
movl $0,%eax
cpuid

movl $buffer,%edi

# EBX contains the low 4 bytes of the string.
# EDX contains the middle 4 bytes of the string.
# ECX contains the last 4 bytes of the string.
# 把他们放在一起 
movl %ebx,(%edi)
movl %edx,4(%edi)
movl %ecx,8(%edi)

#用printf输出
pushl $buffer
pushl $output
call printf
addl $8,%esp

#程序结束,调用exit并退出
pushl $0
call exit

此博客中的热门博文

少写代码,多读别人写的代码

在windows下使用llvm+clang

tensorflow distributed runtime初窥