Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

x86 jmp to register

Tags:

x86

assembly

So I have a address in %eax I would like to jmp to but the code will not compile, is there a way around this?

movl 0xdeadbeef, %eax

jmp %eax ; <--- compile error: type mismatch for 'jmp'
like image 981
broody Avatar asked Apr 22 '12 20:04

broody


People also ask

What is the purpose of the x86 assembly language jmp instruction?

In the x86 assembly language, the JMP instruction performs an unconditional jump. Such an instruction transfers the flow of execution by changing the program counter.

How does jmp instruction work?

The jmp instruction transfers execution control to a different point in the instruction stream; records no return information. Jumps with destinations of disp[8|16|32] or r/m[16|32] are near jumps and do not require changes to the segment register value.

What does jmp EAX do?

jmp *%eax is AT&T syntax for jmp eax , which is one form of jmp r/m32 . It will jump to the address contained in register eax : Jump near, absolute indirect, address given in r/m32. Another form of the same type of jump instruction is jmp *(%eax) which corresponds to jmp [eax] in Intel syntax.


Video Answer


1 Answers

Since nobody was able to provide you with the correct answer, here it is:

jmp   *%eax
like image 130
Gunther Piez Avatar answered Oct 03 '22 11:10

Gunther Piez