Discussion:
Visual C++ inline asm far jmp
(too old to reply)
Lone Stranger
2006-04-07 05:28:42 UTC
Permalink
I have been trying to generate a far jump using inline assembly. However
everytime i try that, the compiler generate a near jump. I am doing
following:

__asm jmp DWORD PTR jumpBuffer

The opcode generated is

FF 25 XX XX XX XX

But this is the opcode for near jump. How do i generate a far jump?

Thanks
Lone
robertwessel2@yahoo.com
2006-04-07 07:31:16 UTC
Permalink
Post by Lone Stranger
I have been trying to generate a far jump using inline assembly. However
everytime i try that, the compiler generate a near jump. I am doing
__asm jmp DWORD PTR jumpBuffer
The opcode generated is
FF 25 XX XX XX XX
But this is the opcode for near jump. How do i generate a far jump?
I doubt that any 32 bit version of VC is capable of generating a far
jump, although I've not actually tried. And you're using a 32 bit
version since its generating a 32 bit offset in the jump. In any
event, if you really wanted to generate a 16:32 indirect jump, the
syntax would be "jmp fword ptr..." or something along those lines.

So what are you really trying to do?
Lone Stranger
2006-04-08 04:53:35 UTC
Permalink
Yup that was it.

__asm jmp fword ptr jumpBuffer

Thanks,
Lone
Post by ***@yahoo.com
Post by Lone Stranger
I have been trying to generate a far jump using inline assembly. However
everytime i try that, the compiler generate a near jump. I am doing
__asm jmp DWORD PTR jumpBuffer
The opcode generated is
FF 25 XX XX XX XX
But this is the opcode for near jump. How do i generate a far jump?
I doubt that any 32 bit version of VC is capable of generating a far
jump, although I've not actually tried. And you're using a 32 bit
version since its generating a 32 bit offset in the jump. In any
event, if you really wanted to generate a 16:32 indirect jump, the
syntax would be "jmp fword ptr..." or something along those lines.
So what are you really trying to do?
Yang Jiao
2006-04-07 15:07:07 UTC
Permalink
What s ur VC's version number?

I d like to suggest u post this issue in microsoft's newsgroup
Post by Lone Stranger
I have been trying to generate a far jump using inline assembly. However
everytime i try that, the compiler generate a near jump. I am doing
__asm jmp DWORD PTR jumpBuffer
The opcode generated is
FF 25 XX XX XX XX
But this is the opcode for near jump. How do i generate a far jump?
Thanks
Lone
Rod Pemberton
2006-04-07 07:48:51 UTC
Permalink
Post by Lone Stranger
I have been trying to generate a far jump using inline assembly. However
everytime i try that, the compiler generate a near jump. I am doing
__asm jmp DWORD PTR jumpBuffer
The opcode generated is
FF 25 XX XX XX XX
But this is the opcode for near jump. How do i generate a far jump?
The format varies by assembler. I'm not sure for MASM, but it should be
similar to WASM. Could someone else correct or add to this?

NASM:
jmp dword selector:offset

GAS:
ljmp selector,offset

WASM:
jmpf fword ptr selector,offset


Rod Pemberton
Loading...