gnu汇编程序指令的文档 [英] documentation of gnu assembler directives

查看:142
本文介绍了gnu汇编程序指令的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此刻,我正在尝试学习mips组装.为此,我编写了一个非常简单的c程序...

I'm trying to learn mips assembly at the moment. To that end, I wrote a very simple c program...

int main(){}

...并使用gcc的-S选项在mips机器上对其进行编译,以生成汇编代码.这是主要功能的开头:

...and compiled it on a mips machine with the -S option to gcc to generate assembly code. Here is what the beginning of the main function looks like:


    .ent   main
main:
    .frame $fp,8,$31
    .mask  0x40000000,-8
    .fmask 0x00000000,0

然后,我通过查看文档以了解所有含义.气体,但我在那里找不到任何这些指令.那是什么意思呢?在哪里可以找到更多信息?

I then tried to figure out what this all means by looking at the documentation for gas, but I couldn't find any of these directives there. So what do they mean? Where can I find more information?

推荐答案

我知道我的回答有点晚了.迟到总比没有好.

I know my answer is kind of late. Better late than never.

编译汇编文件时,代码中可能会显示两种指令.

When you compile an assembly file, two kinds of directives may show up in the code.

  1. 一种是汇编程序支持的指令,在您的情况下,它是GNU as指令.

另一种类型取决于您的汇编语言,并且由于您显然在此处使用mips汇编,因此.ent实际上是mips assembly指令.

The other kind depends on you assembly language, and because you are apparently using mips assembly here, the .ent is actually a mips assembly directive.

这是指南,可以找到.ent .frame .fmask .mask指令:它们都是mips汇编指令.或者,您可以仅Google MIPS Assembly Language Programmer’s Guide.导航到chapter 8, Pseudo Op-Codes,您将获得所需的一切.

Here is the guide where you can find .ent .frame .fmask .mask directives: they are all mips assembly directives. Or you can just Google MIPS Assembly Language Programmer’s Guide. Navigate to chapter 8, Pseudo Op-Codes and you will get all you need.

您可能想知道GNU as如何支持mips directives?键入Info as,导航到章节Machine Dependent Features,然后导航到子章节MIPS-Dependent.但是,仍然找不到.ent指令,也找不到.frame .fmask .mask.这是因为info as不是mips组装指南,并且不能那么全面.

You may wonder how GNU as can support mips directives? Type Info as, navigate to chapter Machine Dependent Features, then navigate to subchapter MIPS-Dependent. But still, you can't find .ent directive here, nor .frame .fmask .mask. That is because info as is not a mips assembly guide and can not be that much comprehensive.

顺便说一下,许多程序员熟悉的汇编器nasm具有自己的指令和语法(Intel风格),与GNU as的指令和语法(源自古代AT& T风格)不同.同样,不同的汇编语言可能也有自己的唯一指令(但语法没有),而汇编程序也可以支持它们.这就是为什么两个指令源可能会出现在汇编文件中的原因.现在,GNU as汇编器甚至可以支持Intel语法.此外,还有一些工具可以在AT& T和Intel语法之间进行转换.但是,您应该记住指令与语法不同.坦白地说,我对此也感到困惑.

By the way, nasm, the assembler which many programmer are familiar with, has its own directives and syntax (Intel style) which are different from those of GNU as (derived from ancient AT&T style). Similarly, different assembly language may have their own unique directives (but not syntax) supported by assemblers that can assemble them too. That's why two source of directives may show up in an assembly file. Now, the GNU as assembler can even support Intel syntax. And furthermore, there are tools to translate between AT&T and Intel syntax. However, you should remember that directives are different from syntax. Frankly speaking, I am confused about this too.

这篇关于gnu汇编程序指令的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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