3-333
INSTRUCTION SET REFERENCE
JMPJump
Description
This instruction transfers program control to a different point in the instruction stream without
recording return information. The destination (target) operand specifies the address of the
instruction being jumped to. This operand can be an immediate value, a general-purpose
register, or a memory location.
This instruction can be used to execute four different types of jumps:
Near jumpA jump to an instruction within the current code segment (the segment
currently pointed to by the CS register), sometimes referred to as an intrasegment jump.
Short jumpA near jump where the jump range is limited to 128 to +127 from the
current EIP value.
Far jumpA jump to an instruction located in a different segment than the current code
segment but at the same privilege level, sometimes referred to as an intersegment jump.
Task switchA jump to an instruction located in a different task.
A task switch can only be executed in protected mode. Refer to Chapter 6, Task Management,
of the Intel Architecture Software Developers Manual, Volume 3, for information on
performing task switches with the JMP instruction.
Near and Short Jumps.
When executing a near jump, the processor jumps to the address
(within the current code segment) that is specified with the target operand. The target operand
specifies either an absolute offset (that is an offset from the base of the code segment) or a rela-
tive offset (a signed displacement relative to the current value of the instruction pointer in the
EIP register). A near jump to a relative offset of 8-bits (rel8) is referred to as a short jump. The
CS register is not changed on near and short jumps.
An absolute offset is specified indirectly in a general-purpose register or a memory location
(r/m16 or r/m32). The operand-size attribute determines the size of the target operand (16 or 32
bits). Absolute offsets are loaded directly into the EIP register. If the operand-size attribute is
16, the upper two bytes of the EIP register are cleared to 0s, resulting in a maximum instruction
pointer size of 16 bits.
Opcode
Instruction
Description
EB cb
JMP rel8
Jump short, relative, displacement relative to next instruction
E9 cw
JMP rel16
Jump near, relative, displacement relative to next instruction
E9 cd
JMP rel32
Jump near, relative, displacement relative to next instruction
FF /4
JMP r/m16
Jump near, absolute indirect, address given in r/m16
FF /4
JMP r/m32
Jump near, absolute indirect, address given in r/m32
EA cd
JMP ptr16:16
Jump far, absolute, address given in operand
EA cp
JMP ptr16:32
Jump far, absolute, address given in operand
FF /5
JMP m16:16
Jump far, absolute indirect, address given in m16:16
FF /5
JMP m16:32
Jump far, absolute indirect, address given in m16:32