flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
iseyler 02 Jul 2009, 20:46
Hi everyone,
In the Intel manual it talks about a 64-bit absolute indirect jump: FF /4 - JMP r/m64 - Jump near, absolute indirect, RIP = 64-Bit offset from register or memory. How can I use this opcode? I get an "error: value out of range." error when compiling the code below. Code: USE64 ORG 0x0000000000100000 kernel_start: call 0x1234567890abcdef Thanks, -Ian _________________ BareMetal OS - http://www.returninfinity.com/bare-metal-os Mono-tasking 64-bit OS for x86-64 based computers written entirely in Assembly |
|||
![]() |
|
LocoDelAssembly 02 Jul 2009, 21:36
iseyler, that doesn't mean the address of the m64 operand can be a 64-bit sized address.
You'll have to use this: Code: USE64 ORG 0x0000000000100000 kernel_start: mov rax, 0x1234567890abcdef jmp rax ; Encoded as FF E0 jmp near [pointer] ; Encoded as FF 25 [03 00 00 00] (RIP-relative address) int3 int3 int3 pointer dq 0x1234567890abcdef In the context of the Intel's documentation, m64 means that it is the memory pointer which will be 64 bits wide, not that the 64-bit target will be encoded in the instruction. |
|||
![]() |
|
asmcoder 03 Jul 2009, 05:55
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:49; edited 1 time in total |
|||
![]() |
|
Fanael 03 Jul 2009, 11:57
Yes, it is. Address of variable 'pointer' is RIP-relative.
|
|||
![]() |
|
Borsuc 03 Jul 2009, 12:56
This is a diagram:
Code: RELATIVE OFFSET ABSOLUTE 64-BIT ADDRESS call----------------->qword value at address specified------------------------->function address |
|||
![]() |
|
iseyler 03 Jul 2009, 15:16
Thanks for the info!
I'll go ahead with the "jmp near [pointer]" method as I don't want to overwrite a register. Thanks again, -Ian |
|||
![]() |
|
asmcoder 03 Jul 2009, 15:38
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:49; edited 1 time in total |
|||
![]() |
|
LocoDelAssembly 03 Jul 2009, 15:45
Dear asmcoder,
Code: ; pseudo-code of JMP mov temp, qword [RIP+3] ; [pointer] loaded into temp ; This is the RIP-relative part mov RIP, temp |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.