Reputation: 9140
The test is on 64-bit/x86 Ubuntu 12.04. With GCC
4.6.3.
So basically I am manipulating some x64 assembly code. And I observed that RIP-relative addressing require the absolute address to be 16-byte aligned.
Here is an example when debugging using gdb
:
0x40f38d <S_0x40F614+61> xorpd 0x84d3(%rip),%xmm0 # 0x417868 <S_0x417DE0>
This memory reference to address 0x417868
fail (segmentation fault), as this address is only 8-byte aligned.
0x40f38d <S_0x40F614+61> xorpd 0x8a4b(%rip),%xmm0 # 0x417de0 <S_0x417DE0>
This memory reference can work, as address 0x417de0
is 16 byte aligned.
This is my observation, and I didn't find any official materials discussing about this issue. Could anyone tell me
Upvotes: 0
Views: 340
Reputation: 6413
It's the xorpd
instruction. It causes and Exception of type 4, which happens when you specify an unaligned memory location without the VEX prefix. (So vxorpd
wouldn't fault on unaligned.)
However, it's not the only one, there are about 106 more instructions that cause the same thing.
Upvotes: 4