【发布时间】:2011-09-13 04:30:58
【问题描述】:
我希望在不使用 linux 内核(或系统?)调用的情况下将以下汇编代码更改为 UNIX 兼容代码。 (int $0x80)
此代码适用于 Intel 32 位 Pentium 平台,使用 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
谢谢,
【问题讨论】:
-
任何时候你在谈论汇编,你都需要指定 CPU 架构。明确的。即使是 x86。
-
谢谢,我补充说,它的英特尔奔腾平台
-
哪个 Unix?为什么你认为它们都有兼容的系统调用约定?还是汇编程序?