我希望在不使用Linux内核(或系统?)的情况下将下面的程序集代码更改为与Unix兼容的代码。打电话来。(整数$0x80)
此代码适用于英特尔32位奔腾平台,用AT&T语法编写

#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

谢谢,

最佳答案

建议:用内联汇编语言编写一个c程序。您还可以从程序集中调用C库函数(如printf),以移除操作系统依赖项。
下面是内联程序集的示例:http://softpixel.com/~cwright/programming/simd/cpuid.php

关于linux - 如何将此linux汇编代码更改为兼容的UNIX汇编代码?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6318402/

10-11 15:30