benlaug
benlaug

Reputation: 2761

ASM x86 relative JMP

I'm doing some ASM code in a C code with the asm function.

My environment is DVL with gcc version 3.

Hi need to make a JMP to a relative address like %eip+0x1f.

How can I do this ?

Thanks

Upvotes: 2

Views: 2226

Answers (1)

CB Bailey
CB Bailey

Reputation: 791699

x86 supports a short jump (JMP, opcode EB + 1 byte relative address) which should do what you want.

In most assemblers (including gcc's inline asm IIRC) you can just put a label where you want to jump to, and use jmp mylabel and let the assember figure out the correct opcode and relative address for the jump.

Upvotes: 7

Related Questions