如何改变这种Linux的大会code到兼容UNIX组装code? [英] How to change this linux Assembly code into compatible UNIX assembly code?

查看:163
本文介绍了如何改变这种Linux的大会code到兼容UNIX组装code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变这个以下汇编code到UNIX兼容code,而无需使用Linux内核(或系统?)调用。 (INT 0x80的$)

I wish to change this following assembly code into UNIX compatible code without using the linux kernel (or system?) call. (int $0x80)

这code是英特尔32位奔腾平台上,写在AT& T公司的语法

This code is for Intel 32bit Pentium platform, written in AT&T syntax

#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 ),以消除操作系统依赖性。

Suggestion: Write a C program, with inline assembly. You could also call C library functions (like printf) from your assembly, in order to remove the OS dependency.

下面是用内联汇编的例子: http://softpixel.com/~cwright /programming/simd/cpuid.php

Here's an example with inline assembly: http://softpixel.com/~cwright/programming/simd/cpuid.php

这篇关于如何改变这种Linux的大会code到兼容UNIX组装code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆