汇编 – RESB,RESW,RESD,RESQ在NASM中分配多少字节?

参见英文答案 > What are the sizes of tword, oword and yword operands?                                    2个 
DB分配1个字节.

 

DW分配2个字节.

DD分配4个字节.

DQ分配8个字节.

所以我假设:

RESB 1分配1个字节.

RESW 1分配2个字节.

RESD 1分配4个字节.

RESQ 1分配8个字节.

我对么?

documentation并没有多说:

 

3.2.2 RESB and Friends: Declaring Uninitialized Data

RESB, RESW, RESD, RESQ, REST, RESO, RESY and RESZ are designed to be
used in the BSS section of a module: they declare uninitialized
storage space. Each takes a single operand, which is the number of
bytes, words, doublewords or whatever to reserve. As stated in section
2.2.7, NASM does not support the MASM/TASM syntax of reserving uninitialized space by writing DW ? or similar things: this is what it
does instead. The operand to a RESB-type pseudo-instruction is a
critical expression: see section 3.8.

For example:

buffer: resb 64 ; reserve 64 bytes

wordvar: resw 1 ; reserve a word

realarray resq 10 ; array of ten reals

ymmval: resy 1 ; one YMM register

zmmvals: resz 32 ; 32 ZMM registers

Am I correct?

是.

对于d *和res *,整个NASM的大小后缀是一致的.它们将字节与xword的x86指令助记符后缀相匹配. (例如psubd使用压缩的dword元素).

甚至还有一个使用o(oct-word):cqo的指令助记符.

y和z大小后缀明显匹配ymm和zmm寄存器大小,即使指令助记符现在像VBROADCASTI32X8因为AVX512屏蔽粒度.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值