LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Jumping in asm (https://www.linuxquestions.org/questions/programming-9/jumping-in-asm-223995/)

LongName 08-29-2004 02:59 PM

Jumping in asm
 
Is it possible without labels to jump over 1 or more instructions?

Thanks in advance!

Vookimedlo 08-29-2004 03:28 PM

I don't think it's possible. You cannot know how compiler (nasm, gas, ...) do binary elf format. That means one instruction could be replaced with 2 others. So label are needed.

Maybe you can predicate this behavior and increase your IP register somehow to skip some instruction.

LongName 08-29-2004 03:58 PM

Thanks for the details! I alway's thought that each line (not empty) is one instruction.

LongName 08-31-2004 07:27 PM

From NASM Documents
Quote:

JMP jumps to a given address. The address may be specified as an absolute segment and offset, or as a relative jump within the current segment.
Yepi, relative jumps are possible :).

From what I have been testing, each instruction becomes 5 instructions thus to do a relative jump its 5*n where n is the number of instructiosn to jump.

Are all instructions come out as 5 instructions when compiled?

I didn't test all instructions but the ones I have tested become 5 instructions when compiled.

Thanks in advance!


All times are GMT -5. The time now is 08:08 PM.