最新手册

Top (Using as)Top (Using as)https://sourceware.org/binutils/docs/as/index.html2.38  版本

https://sourceware.org/binutils/docs-2.38/as.pdf


伪指令 .macro 定义,macro可以嵌套,在开源代码中大量使用,需重点关注,官方描述如下

The commands .macro and .endm allow you to define macros that generate assembly output. For example, this definition specifies a macro sum that puts a sequence of numbers into memory:

        .macro  sum from=0, to=5.long   \from.if     \to-\fromsum     "(\from+1)",\to.endif.endm

With that definition, ‘SUM 0,5’ is equivalent to this assembly input:

        .long   0.long   1.long   2.long   3.long   4.long   5

.macro macname ¶

.macro macname macargs … ¶

Begin the definition of a macro called macname. If your macro definition requires arguments, specify their names after the macro name, separated by commas or spaces. You can qualify the macro argument to indicate whether all invocations must specify a non-blank value (through ‘:req’), or whether it takes all of the remaining arguments (through ‘:vararg’). You can supply a default value for any macro argument by following the name with ‘=deflt’. You cannot define two macros with the same macname unless it has been subject to the .purgem directive (see .purgem name) between the two definitions. For example, these are all valid .macro statements:

.macro comm

Begin the definition of a macro called comm, which takes no arguments.

.macro plus1 p, p1

.macro plus1 p p1

Either statement begins the definition of a macro called plus1, which takes two arguments; within the macro definition, write ‘\p’ or ‘\p1’ to evaluate the arguments.

.macro reserve_str p1=0 p2

Begin the definition of a macro called reserve_str, with two arguments. The first argument has a default value, but not the second. After the definition is complete, you can call the macro either as ‘reserve_str a,b’ (with ‘\p1’ evaluating to a and ‘\p2’ evaluating to b), or as ‘reserve_str ,b’ (with ‘\p1’ evaluating as the default, in this case ‘0’, and ‘\p2’ evaluating to b).

.macro m p1:req, p2=0, p3:vararg

Begin the definition of a macro called m, with at least three arguments. The first argument must always have a value specified, but not the second, which instead has a default value. The third formal will get assigned all remaining arguments specified at invocation time.

When you call a macro, you can specify the argument values either by position, or by keyword. For example, ‘sum 9,17’ is equivalent to ‘sum to=17, from=9’.

Note that since each of the macargs can be an identifier exactly as any other one permitted by the target architecture, there may be occasional problems if the target hand-crafts special meanings to certain characters when they occur in a special position. For example, if the colon (:) is generally permitted to be part of a symbol name, but the architecture specific code special-cases it when occurring as the final character of a symbol (to denote a label), then the macro parameter replacement code will have no way of knowing that and consider the whole construct (including the colon) an identifier, and check only this identifier for being the subject to parameter substitution. So for example this macro definition:

   .macro label l
\l:.endm

might not work as expected. Invoking ‘label foo’ might not create a label called ‘foo’ but instead just insert the text ‘\l:’ into the assembler source, probably generating an error about an unrecognised identifier.

Similarly problems might occur with the period character (‘.’) which is often allowed inside opcode names (and hence identifier names). So for example constructing a macro to build an opcode from a base name and a length specifier like this:

   .macro opcode base length\base.\length.endm

and invoking it as ‘opcode store l’ will not create a ‘store.l’ instruction but instead generate some kind of error as the assembler tries to interpret the text ‘\base.\length’.

There are several possible ways around this problem:

Insert white space

If it is possible to use white space characters then this is the simplest solution. eg:

   .macro label l
\l :.endm

Use ‘\()’,The string ‘\()’ can be used to separate the end of a macro argument from the following text. eg:------------开源代码中大量使用,包括固件,内核,出处均来源于此

   .macro opcode base length\base\().\length.endm

Use the alternate macro syntax mode

In the alternative macro syntax mode the ampersand character (‘&’) can be used as a separator. eg:-----------------&作为分隔符

   .altmacro.macro label l
l&:.endm

Note: this problem of correctly identifying string parameters to pseudo ops also applies to the identifiers used in .irp (see .irp symbol,values…) and .irpc (see .irpc symbol,values…) as well.

Another issue can occur with the actual arguments passed during macro invocation: Multiple arguments can be separated by blanks or commas. To have arguments actually contain blanks or commas (or potentially other non-alpha- numeric characters), individual arguments will need to be enclosed in either parentheses (), square brackets [], or double quote " characters. The latter may be the only viable option in certain situations, as only double quotes are actually stripped while establishing arguments. It may be important to be aware of two escaping models used when processing such quoted argument strings: For one two adjacent double quotes represent a single double quote in the resulting argument, going along the lines of the stripping of the enclosing quotes. But then double quotes can also be escaped by a backslash \, but this backslash will not be retained in the resulting actual argument as then seen / used while expanding the macro.

As a consequence to the first of these escaping mechanisms two string literals intended to be representing separate macro arguments need to be separated by white space (or, better yet, by a comma). To state it differently, such adjacent string literals - even if separated only by a blank - will not be concatenated when determining macro arguments, even if they’re only separated by white space. This is unlike certain other pseudo ops, e.g. .ascii.

.endm

Mark the end of a macro definition.

.exitm

Exit early from the current macro definition.

\@

as maintains a counter of how many macros it has executed in this pseudo-variable; you can copy that number to your output with ‘\@’, but only within a macro definition.

LOCAL name [ , … ] ¶

Warning: LOCAL is only available if you select “alternate macro syntax” with ‘--alternate’ or .altmacro. See .altmacro.

arm 有用常用伪指令网址介绍

Useful assembler directives and macros for the GNU assembler - Architectures and Processors blog - Arm Community blogs - Arm Community

gnu assembler最新官方手册和.macro介绍相关推荐

  1. 【翻译自HVR官方手册】HVR数据复制软件介绍与术语解释

    [翻译自HVR官方手册]HVR数据复制软件介绍与术语解释 HVR数据复制软件是荷兰HVR公司推出的一款数据复制软件,用于db到db,db到file,file到db,file到file的实时复制. 整个 ...

  2. QT QList<T>介绍与应用、详解、使用说明、官方手册翻译

    文章目录 1. 简介 2. 使用示例 3. 官方手册 4. Member Function Documentation 1. 简介 QList<T>是目前最常用的容器类 .它存储了给定类型 ...

  3. 服务器日志文件中包含堆栈跟踪,日志框架 Logback 官方手册(第三章:Configuration)...

    以下内容翻译整理自logback官方手册,地址:logback官方手册 logback 配置 将日志请求插入应用程序代码需要相当多的计划和工作.观察表明,大约有4%的代码用于日志记录.因此,即使是一个 ...

  4. zabbix-3.2 官方手册

    zabbix官方手册 手册分为19部分 第一部分是写介绍 1 Manual structure(可看可不看) Structure The content of this Zabbix 3.2 manu ...

  5. grub2详解(翻译和整理官方手册)

    GRUB2是借鉴GRUB改写到更加安全强大到多系统引导程序,现在大部分较新的Linux发行版都是使用GRUB2作为引导程序的. GRUB2采用了模块化设计,使得GRUB2核心更加精炼,使用更加灵活,同 ...

  6. 链接脚本(Linker Scripts)语法和规则解析(翻译自官方手册)

    原链接:链接脚本(Linker Scripts)语法和规则解析(翻译自官方手册)_BSP-路人甲的博客-CSDN博客_链接脚本语法 为了便于与英文原文对照学习与理解(部分翻译可能不准确),本文中的每个 ...

  7. libmodbus官方手册中文翻译

    最近做libmodbus相关内容,因为中文没有libmodbus各个函数的详细解释,所以在此把要用的libmodbus的官方手册包括所有的函数都翻译整理一下,给自己和大家们学习,欢迎大家交流指正.手册 ...

  8. grasshop 犀牛5.0下载_神契幻奇谭 v1.129版发布 快来下载神契幻奇谭2020最新官方版...

    全文导读 下载神契幻奇谭就上高手游,神契幻奇谭是一款具有二次元.烧脑特征的角色扮演手机游戏,最让人难忘的是精致生动的形象设计系统和宏大的剧情,平平淡淡还是揭竿而起,传奇史诗由您亲自谱写!神契幻奇谭日前 ...

  9. GCM Google官方示例的简单介绍和使用

    GCM Google官方示例的简单介绍和使用 准备工作 翻墙 先翻墙,翻不了墙一切都白搭-- Google账号 申请Google账号 进入Google开发管理台 创建工程(Google管理台上的Pro ...

  10. Vue3手册译稿 - 基础 - 介绍

    介绍 提示 已经了解Vue2且仅想知道Vue3有哪些新功能?请参阅迁移指南 Vue.js是什么? Vue(读音/vjuː/,像view一样发音)是一套用于构建用户界面的先进框架,不像其他僵化的框架,V ...

最新文章

  1. 如何确认mongodb数据插入是否成功_go连接mongodb
  2. 数据标准化(归一化)
  3. 多进程与多线程的区别
  4. 进程间的通信——无名管道
  5. 12.1、Libgdx的图像之持续性和非持续性渲染
  6. 计算机语言学家,著名计算语言学家冯志伟为人文学院师生作专题讲座
  7. 阶梯式的岗位技术培训认证体系
  8. spring之基本介绍以及老版本框架的下载地址
  9. 存数组元素的个数_HashMap1.8之后为什么要采用数组+链表+红黑树的储存方式?
  10. [转载] Java中的strictfp关键字
  11. Linux下更改目录及其下的子目录和文件的访问权限
  12. 质量值体系 Phred33 和 Phred 64 的由来 及其在质量控制中的实际影响
  13. 实现文章上一篇和下一篇的两种方式
  14. jquery选择器篇
  15. 相控阵天线(三):直线阵列天线低副瓣综合(切比雪夫、泰勒分布、SinZ-Z和Villeneuve分布、含python代码)
  16. php采集今日头条出现问题,使用php蓝天采集抓取今日头条ajax的文章内容
  17. linux内核版本指什么意思,Linux的内核版本是怎么回事
  18. Python中的魔法函数(__init__()和__ str__())
  19. linux个人学习记录
  20. 【概念辨析】二维数组传参的几种可能性

热门文章

  1. 大话西游2人气稳定服务器,大话西游2开服18年的老区还得排队,凌烟阁确实够火...
  2. 【Docker】安装-win7
  3. 全面解析用友网络四位一体数字营销
  4. 用Scratch制作手游的角色方向虚拟控制器/虚拟摇杆的方法+源码
  5. oracle回收站还原,Oracle从“回收站”恢复删除的表
  6. 怎么查看linux系统硬盘,查看Linux磁盘空间的八大方法
  7. 基于STM32的DDS信号发生器
  8. pc模式 华为mate30_很实用!华为Mate 30全系支持PC模式,无线充+投屏更方便!
  9. linux创建deamon
  10. CAJ文件怎么转换成Word文档