JMP (x86 instruction)
From Wikipedia, the free encyclopedia
In the x86 assembly language, the JMP instruction is a mnemonic for an unconditional JuMP. Such an instruction transfers the flow of execution by changing the instruction pointer register. The x86 assembly language actually contains a number of different opcodes that perform a jump. Depending on whether the processor is in real mode or protected mode, and an override instruction is used, the instructions may take 16-bit, 32-bit, or segment:offset pointers.
There are many different forms of jumps; Relative jumps, conditional jumps, absolute jumps and register-indirect jumps.
JMP $ is commonly used to hang the computer. The $ is used to refer to the same location where the instruction starts. That means that the instruction will jump to itself and thereby creating an endless loop.
The following examples illustrate the following types of jumps: an absolute jump with a 16-bit pointer, a long jump (inter-segment), an absolute jump with a 32-bit pointer, and a register-indirect jump using the EAX register.
JMP 0x89AB ; loads IP with the new value 0x89AB JMP 0xACDC:0x5578 ; loads CS with 0xACDC and IP with 0x5578
JMP 0x56789AB1 ; loads IP with the value 0x56789AB1 ; only works in protected mode or unreal mode
JMP EAX ; Jumps to the value stored in the register EAX. ; only works in protected mode
[edit] See also
- conditional jump