1

I'm working through example from a Windows disassembly training guide. In the exercise rax is set to a byte ptr, then rbx a word ptr. I notice the next byte of memory is skipped before rcx is to a dword ptr. Why did a byte of memory get skipped? Is there some alignment requirement?

Addressing modes

3

The main reason to align the data is for performance (some architectures will fault on misaligned data, but since you tagged this with windbg, we will assume amd/intel x64 + windows).

Quoting from the AMD64 Architecture Programmer’s Manual Volume 1:

The AMD64 architecture does not impose data-alignment requirements for accessing data in memory. However, depending on the location of the misaligned operand with respect to the width of the data bus and other aspects of the hardware implementation (such as store-to-load forwarding mechanisms), a misaligned memory access can require more bus cycles than an aligned access. For maximum performance, avoid misaligned memory accesses.

Ideally the word-sized data (pointed via rbx) would be 2-byte aligned, but as noted above, it is not required.

Not the answer you're looking for? Browse other questions tagged or ask your own question.