NASB中RESB,RESW,RESD,RESQ分配多少字节? [英] How much bytes does RESB, RESW, RESD, RESQ allocates in NASM?
问题描述
DB
分配1个字节.
DW
分配2个字节.
DD
分配4个字节.
DQ
分配8个字节.
所以我认为:
RESB 1
分配1个字节.
RESW 1
分配2个字节.
RESD 1
分配4个字节.
RESQ 1
分配8个字节.
我正确吗?
文档没有"不多说:
3.2.2 RESB和朋友:声明未初始化的数据
RESB,RESW,RESD,RESQ,REST,RESO,RESY和RESZ设计为 在模块的BSS部分中使用:它们声明未初始化 储存空间.每个都采用一个操作数,即 字节,字,双字或任何保留字.如本节所述 2.2.7,NASM不支持通过编写DW?保留未初始化空间的MASM/TASM语法.或类似的东西:这就是它 相反. RESB型伪指令的操作数是 批判性表达:请参见3.8节.
例如:
缓冲区:resb 64;保留64个字节
wordvar:resw 1;保留一个字词
realarray resq 10;十个实数的数组
ymmval:resy 1;一个YMM寄存器
zmmvals:resz 32; 32个ZMM寄存器
我正确吗?
是.
对于d*
和res*
,整个NASM的大小后缀都是一致的.它们将x86指令助记符后缀匹配为字节到qword. (例如psubd
适用于打包的dword元素).
甚至还有使用o
(八字)的指令助记符: cqo
.
VBROADCASTI32X8
,因为AVX512的屏蔽粒度.DB
allocates 1 byte.
DW
allocates 2 bytes.
DD
allocates 4 bytes.
DQ
allocates 8 bytes.
So I assume that:
RESB 1
allocates 1 byte.
RESW 1
allocates 2 bytes.
RESD 1
allocates 4 bytes.
RESQ 1
allocates 8 bytes.
Am I correct?
The documentation doesn't say much:
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?
yes.
The size suffixes are consistent throughout NASM, for d*
and res*
. They match x86 instruction mnemonic suffixes for byte to qword. (e.g. psubd
works with packed dword elements).
There's even an instruction mnemonic that uses o
(oct-word): cqo
.
y and z size suffixes obviously match ymm and zmm register sizes, even though the instruction mnemonics are now things like VBROADCASTI32X8
because of AVX512 masking granularity.
这篇关于NASB中RESB,RESW,RESD,RESQ分配多少字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!