0
votes

Because the address xxxx:yyyyyyyy is 32 bits in protected mode, I put a 48-bits address in a piece of memory and want to give indirect jmp, here is what I wrote:

mov eax,s1
mov [address],eax
mov ax,SelectorCode32
mov [address+4],ax
jmp  fword [address]

address:dd 0
        dw 0

But the nasm shows that jmp fword [address] is wrong, I've read some suggestions like this, but didn't help either, so what should I do?

1
See this,and in my situation,a method choose a right tss to jmp,so the address is unknown before it runs,so jmp xxxx:yyyyyyyy is useless.user2269707
@AkiSuihkonen You are wrong. What you're talking about is the JMP ptr16:32 form, but there's also JMP m16:32. See your Intel or AMD manual.Alexey Frunze
Nasm is a nice family assembler and doesn't know the fword. :) Just jmp far [address] should do it. Maybe jmp far dword [address] if it's not in 32-bit code.Frank Kotler

1 Answers

2
votes

The NASM's syntax for near and far calls is different from those of TASM and MASM.

Here are the two options for indirect jumps:

jmp [fptr] ; jump to CS:0x12345678
jmp far [fptr] ; jump to 0xABCD:0x12345678

fptr dd 0x12345678
     dw 0xABCD

You can also always push the far address onto the stack and do retf.