Why does this MOVSS instruction use RIP relative addressing?

I found the following assembly code in a disassembler (C ++ floating point logic).

  842: movss  0x21a(%rip),%xmm0 

I understand that when the rip process will always be 842, and this 0x21a (% rip) will be const. It seems a little strange to use this register.

I want to know if there is any advantage in using the relative rip address, and not for other addressing.

+1
source share
1 answer

RIP - This is an instruction pointer register, which means that it contains the address of the instruction following the current instruction.

For example, consider the following code:

mov  rax, [rip]
nop

RIP , NOP. , NOP RAX.

, , RIP . , RIP " 842" . RIP , . 842 - , ; , .: -)

(0x21A). RIP. : %rip + 0x21A.

RIP - - , 64- . , , RIP -relative. , RIP - 64- . , 64- , RIP - . ( Skywing), , :

( ) x64 x86 , , , RIP- .

RIP- - , 32- () . x86 (call, jmp soforth), x64 .

RIP- ? , , , , . () ( DLL EXE), ( ), , . x86 , , , . , , , , , .

[., ]

, RIP, - ( "fixups" ) , , , . , , (- PE), , , , .

x64 - , RIP.

Windows, - .

, , , - , XMM0, RIP- - .

+4

Source: https://habr.com/ru/post/1659327/


All Articles