TripShock
TripShock

Reputation: 4249

Assembly: Jump from one section to another

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?

Upvotes: 2

Views: 3538

Answers (1)

t0mm13b
t0mm13b

Reputation: 34592

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.

Upvotes: 1

Related Questions