compiler
compiler

Reputation: 4363

What does negative address mean in assembly?

0xffffffff8100b9e4: callq  *-0x7ec55ec0(,%rax,8)

What does *-0x7ec55ec0 mean here?

Upvotes: 1

Views: 2166

Answers (3)

Gunther Piez
Gunther Piez

Reputation: 30439

"0x7ec55ec0" is a negative address offset. And yes, it will be subtracted from the value of 8*%rax. This subtraction is in the two complements representation of a 64 bit unsigned equivalent to adding "0xffffffff8100b9e4".

Presumably the value of %rax*8 will by greater than 0x7ec55ec0, so that a value in the usual range of the code or data segment results.

Note that address offsets on a x86 platform are indeed always signed (both 8 bit and 32 bit offests), but the resulting addresses are of course unsigned.

Upvotes: 0

Jonathan Wood
Jonathan Wood

Reputation: 67195

There are no negative addresses. Addresses are unsigned.

What it means is that you took an address with the high bit set, and formatted it as a signed number (or used a method that formatted it as a signed number).

Upvotes: 2

C. K. Young
C. K. Young

Reputation: 223013

In this context, -0x7ec55ec0 is just a shorter way to write 0xffffffff813aa140 (in other words, -0x7ec55ec0 + 0x10000000000000000).

Presumably, there's a jump table at that address, indexed by rax.

If it's any help, the same instruction in Intel assembly syntax is:

call qword ptr [0xffffffff813aa140 + rax*8]

Upvotes: 3

Related Questions