6/5/2023 0 Comments Jmp add inA far jump to a conforming or non-conforming code segment.When the processor is operating in protected mode, the JMP instruction can be used to perform the following three types of far jumps: If the operand-size attribute is 16, the upper two bytes of the EIP register are cleared.įar Jumps in Protected Mode. The far address is loaded directly into the CS and EIP registers. With the indirect method, the target operand specifies a memory location that contains a 4-byte (16-bit operand size) or 6-byte (32-bit operand size) far address. With the pointer method, the segment and address of the called procedure is encoded in the instruction, using a 4-byte (16-bit operand size) or 6-byte (32-bit operand size) far address immediate. Here the target operand specifies an absolute far address either directly with a pointer ( ptr16:16 or ptr16:32) or indirectly with a memory location ( m16:16 or m16:32). When executing a far jump in real-address or virtual-8086 mode, the processor jumps to the code segment and offset specified with the target operand. near jumps) and the operand-size attribute (for near relative jumps) determines the size of the target operand (8, 16, or 32 bits).įar Jumps in Real-Address or Virtual-8086 Mode. When using relative offsets, the opcode (for short vs. (Here, the EIP register contains the address of the instruction following the JMP instruction). This value is added to the value in the EIP register. If the operand-size attribute is 16, the upper two bytes of the EIP register are cleared, resulting in a maximum instruction pointer size of 16 bits.Ī relative offset ( rel8, rel16, or rel32) is generally specified as a label in assembly code, but at the machine code level, it is encoded as a signed 8-, 16-, or 32-bit immediate value. Absolute offsets are loaded directly into the EIP register. The operand-size attribute determines the size of the target operand (16 or 32 bits). The CS register is not changed on near and short jumps.Īn absolute offset is specified indirectly in a general-purpose register or a memory location ( r/m16 or r/m32). A near jump to a relative offset of 8-bits ( rel8) is referred to as a short jump. Value of the instruction pointer in the EIP register). The target operand specifies either an absolute offset (that is an offset from the base of the code segment) or a relative offset (a signed displacement relative to the current When executing a near jump, the processor jumps to the address (within the current code segment) that is specified with the target operand. Task switch-A jump to an instruction located in a different task.Ī task switch can only be executed in protected mode (see Chapter 7, in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A, for information on performing task switches with the JMP instruction).Far jump-A 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.Short jump-A near jump where the jump range is limited to –128 to +127 from the current EIP value.Near jump-A 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.This instruction can be used to execute four different types of jumps: This operand can be an immediate value, a general-purpose register, or a memory location. The destination (target) operand specifies the address of the instruction being jumped to. Transfers program control to a different point in the instruction stream without recording return information. Jump far, absolute indirect, address given in m16:64. Jump far, absolute indirect, address given in m16:32. Jump far, absolute indirect, address given in m16:16 Jump far, absolute, address given in operand Jump near, absolute indirect, RIP = 64-Bit offset from register or memory Jump near, absolute indirect, address given in r/m32. Jump near, absolute indirect, address = zero-extended r/m16. Jump near, relative, RIP = RIP + 32-bit displacement sign extended to 64-bits Jump near, relative, displacement relative to next instruction. Jump short, RIP = RIP + 8-bit displacement sign extended to 64-bits
0 Comments
Leave a Reply. |