From: Ian S. <is...@gm...> - 2008-12-22 17:00:15
|
Sorry.. what I meant to say was an "absolute indirect" jump. >From the Intel manual: JMP r/m64 "Jump near, absolute indirect, RIP = 64-Bit offset from register or memory". Is there a way to not fake it? The reason is that at the beginning of my "kernel" I have a jump table for all of the various system calls. kernel_start: jmp start ; The actual start of the kernel code ; Aligned for simplicity... It does waste a bit of space. align 16 jmp near os_print_string ; 0x00010010 (physical address that apps can call) align 8 jmp near os_print_char align 8 jmp near os_print_char_hex align 8 .... etc, etc. Thanks, -Ian On Mon, Dec 22, 2008 at 11:33 AM, H. Peter Anvin <hp...@zy...> wrote: > Ian Seyler wrote: >> Hello, >> >> I posted this question in the Expert discussion forum but did not get >> a working answer. I figured I would try the mailing list too. >> >> What is the syntax for a 64-bit absolute jump in NASM? > > There isn't one, because there is no such instruction. > >> For instance what I want to do is this: >> [BITS 64] >> jmp 0x1234567890ABCDEF ; or FFFF800000000000 as the start of the >> upper canonical address. >> >> According to the Intel manuals this should be encoded with opcode 0xFF >> (followed by a 64-bit (offset?) address) but NASM keeps using opcode >> 0xE9 (with a 32-bit offset address). > > FF is an *indirect* jump. > >> How can I get NASM to encode a 64-bit absolute jump? > > You can't. Again, there is no such instruction. You can fake it, > however, with the following code sequence: > > jmp far qword [rel next] > next: > resq 0x123456789abcdef > > This is an indirect jump, but puts the offset immediately following the > instruction, and uses RIP-relative addressing to get a fixed byte sequence. > > -hpa > > ------------------------------------------------------------------------------ > _______________________________________________ > Nasm-devel mailing list > Nas...@li... > https://lists.sourceforge.net/lists/listinfo/nasm-devel > |