Question

In x86 assembly, how can I perform an unconditional jump from one section another?

Eg:

.section .text
main:    ...
         jmp here
         ...

.section .another
here:    ...

I guess this is a far jump. I get a segfault when trying to run this. Any workaround?

Was it helpful?

Solution

Since you did not specify what assembler type (nasm, gas, masm, tasm)

If you know what segment is the the here part is, for example, if the .section part is in code segment 0x8, then you could do this:

jmp 0x8:here

You could define the constant to specify the segment and use that also...again your mileage will vary depending on the assembler..

Hope this helps, Best regards, Tom.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top