Jump to content

JMP (x86 instruction): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
mNo edit summary
No edit summary
Line 1: Line 1:
{{Out of date|date=February 2017}}
In the [[x86 assembly language]], the '''<code>JMP</code>''' [[instruction (computer science)|instruction]] performs an unconditional jump. Such an instruction transfers the flow of [[execution (computers)|execution]] by changing the [[instruction pointer]] register. There are a number of different [[opcode]]s 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 [[pointer (computer programming)|pointer]]s.<ref>{{cite web |url=http://download.intel.com/design/PentiumII/manuals/24319102.PDF|format = PDF| title=Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual (6.5MB)|accessdate=2009-11-03}}</ref> {{Wiktionary|relative|absolute}}
In the [[x86 assembly language]], the '''<code>JMP</code>''' [[instruction (computer science)|instruction]] performs an unconditional jump. Such an instruction transfers the flow of [[execution (computers)|execution]] by changing the [[instruction pointer]] register. There are a number of different [[opcode]]s 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 [[pointer (computer programming)|pointer]]s.<ref>{{cite web |url=http://download.intel.com/design/PentiumII/manuals/24319102.PDF|format = PDF| title=Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual (6.5MB)|accessdate=2009-11-03}}</ref> {{Wiktionary|relative|absolute}}



Revision as of 21:09, 9 February 2017

In the x86 assembly language, the JMP instruction performs an unconditional jump. Such an instruction transfers the flow of execution by changing the instruction pointer register. There are 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.[1]

There are many different forms of jumps: relative, conditional, absolute and register-indirect jumps.

The following examples illustrate:

  1. a relative jump with a 16-bit pointer;
  2. a long jump (inter-segment), a relative jump with a 32-bit pointer;
  3. and a register-indirect absolute jump using the EAX register.

(Note that although the first and second jumps are relative, commonly the destination address is shown instead of the relative offset as encoded in the opcode.)

Example one: Load IP with the new value 0x89AB, then load CS with 0xACDC and IP with 0x5578.

JMP 0x89AB
JMP 0xACDC:0x5578

Example two: Load IP with the value 0x56789AB1, only in protected mode or unreal mode.

JMP 0x56789AB1

Example three: Jump to the value stored in the EAX register, only in protected mode.

JMP EAX

References

  1. ^ "Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual (6.5MB)" (PDF). Retrieved 2009-11-03.