arm 汇编

Difference between .equ and .word in ARM Assembly?

.word is a directive that allocates a word-sized amount of storage space (memory) in that location. It can additionally have that location initialized with a given value.

.equ is more like a C preprocessor #define statement - it gets substituted in any subsequent code.

https://sourceware.org/binutils/docs-2.24/as/Equ.html#Equ

https://sourceware.org/binutils/docs-2.24/as/Word.html#Word

This is not actually ARM-specific, but applies to all gas targets.


.word 即是一个相当于内存中固定位置分配一个 word大小(4字节)的变量,它可以在初始化时就赋值一个给定的值。
.equ 更像是c语言中的 #define 语句,后面的任何位置的代码都可以用到它。

.equ	USR_MODE,		0x10	/* normal user mode */
.equ 	FIQ_MODE,		0x11	/* fiq fast interrupts mode */
.equ 	IRQ_MODE,		0x12	/* irq standard interrupts mode */
.equ 	SVC_MODE,		0x13	/* supervisor interrupts mode */
.equ 	ABT_MODE,		0x17	/* abort processing memory faults mode */
.equ 	UDF_MODE,		0x1b	/* undefined instructions mode */
.equ 	MODE_MASK,		0x1f	/* system running in priviledged operating mode */
.equ 	NO_INT,			0xc0
.equ    CPSR_IRQ_EN,	0x80
.equ    CPSR_IRQ_MASK,	0x40	/* disable interrupt mode (irq) */
.equ    CPSR_FIQ_MASK,	0x80	/* disable fast interrupt mode (fiq) */

.word 0x2000	/* 自拷贝文件大小 */
.word 0x0
.word 0x0
.word 0x0



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值