第四章例子程序

来源:互联网 发布:3m平台 源码 编辑:程序博客网 时间:2024/05/20 04:51

在macOS Terminal中输入

cc -arch i386 -Wl,-no_pie cpuid.s./a.out

输出

The processor Vendor ID is 'GenuineIntel'

代码如下

# cc -arch i386 -Wl,-no_pie cpuid.s    .text    .globl _main    .p2align 2_main:    pushl %ebp    movl $0, %eax    cpuid    movl $buffer, %edi    movl %ebx, (%edi)    movl %edx, 4(%edi)    movl %ecx, 8(%edi)    pushl $buffer    pushl $output    call _printf    addl $8, %esp    xorl %eax, %eax    popl %ebp    retl    .cstringoutput:    .asciz "The processor Vendor ID is '%s'\n"    .lcomm buffer, 13, 2
原创粉丝点击