if you want to remove an article from website contact us from top.

    which type of jmp is used when jumping to any location within the current code segment?

    Mohammed

    Guys, does anyone know the answer?

    get which type of jmp is used when jumping to any location within the current code segment? from screen.

    JMP — Jump

    JMP — Jump

    Opcode Instruction Op/En 64-Bit Mode Compat/Leg Mode Description

    EB cb JMP rel8 D Valid Valid Jump short, RIP = RIP + 8-bit displacement sign extended to 64-bits

    E9 cw JMP rel16 D N.S. Valid Jump near, relative, displacement relative to next instruction. Not supported in 64-bit mode.

    E9 cd JMP rel32 D Valid Valid Jump near, relative, RIP = RIP + 32-bit displacement sign extended to 64-bits

    FF /4 JMP r/m16 M N.S. Valid Jump near, absolute indirect, address = zero-extended r/m16. Not supported in 64-bit mode.

    FF /4 JMP r/m32 M N.S. Valid Jump near, absolute indirect, address given in r/m32. Not supported in 64-bit mode.

    FF /4 JMP r/m64 M Valid N.E. Jump near, absolute indirect, RIP = 64-Bit offset from register or memory

    EA cd JMP ptr16:16 S Inv. Valid Jump far, absolute, address given in operand

    EA cp JMP ptr16:32 S Inv. Valid Jump far, absolute, address given in operand

    FF /5 JMP m16:16 M Valid Valid Jump far, absolute indirect, address given in m16:16

    FF /5 JMP m16:32 M Valid Valid Jump far, absolute indirect, address given in m16:32.

    REX.W FF /5 JMP m16:64 M Valid N.E. Jump far, absolute indirect, address given in m16:64.

    Instruction Operand Encoding ¶

    Op/En Operand 1 Operand 2 Operand 3 Operand 4

    S Segment + Absolute Address NA NA NA

    D Offset NA NA NA

    M ModRM:r/m (r) NA NA NA

    Description ¶

    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 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.

    Short jump—A near jump where the jump range is limited to –128 to +127 from the current EIP value.

    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.

    Task switch—A jump to an instruction located in a different task.

    A 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).

    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 relative 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, resulting in a maximum instruction pointer size of 16 bits.

    A 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. This value is added to the value in the EIP register. (Here, the EIP register contains the address of the instruction following the JMP instruction). When using relative offsets, the opcode (for short vs. near jumps) and the operand-size attribute (for near relative jumps) determines the size of the target operand (8, 16, or 32 bits).

    Far Jumps in Real-Address or Virtual-8086 Mode. 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. 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). 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. 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. The far address is loaded directly into the CS and EIP registers. If the operand-size attribute is 16, the upper two bytes of the EIP register are cleared.Far Jumps in Protected Mode. When the processor is operating in protected mode, the JMP instruction can be used to perform the following three types of far jumps:

    A far jump to a conforming or non-conforming code segment.

    A far jump through a call gate.

    A task switch.

    (The JMP instruction cannot be used to perform inter-privilege-level far jumps.)

    In protected mode, the processor always uses the segment selector part of the far address to access the corresponding descriptor in the GDT or LDT. The descriptor type (code segment, call gate, task gate, or TSS) and access rights determine the type of jump to be performed.

    स्रोत : www.felixcloutier.com

    Solved 2/ Which type of JMP is used when jumping to any

    Answer to Solved 2/ Which type of JMP is used when jumping to any

    © 2003-2022 Chegg Inc. All rights reserved.

    स्रोत : www.chegg.com

    Answer the Following Questions: Question No. (1) (5 marks)

    Which type of jmp is used when jumping to any location within the current code segment?

    Answer the Following Questions: Question No. (1) (5 marks)

    Yüklə 426 Kb. tarix 07.11.2018 ölçüsü 426 Kb. #78710

    Bu səhifədəki naviqasiya:

    Question No. (2) (5 marks)

    Question No. (3) (10marks)

    Answer the Following Questions:Question No. (1) (5 marks)

    1.1 Which type of JMP is used when jumping to any location within the current code segment?

    Ans. A near JMP instruction

    1.2 Which JMP instruction is 5 bytes long?

    Ans. A far jump

    1.3 Which type of JMP instruction (short, near) assembles for the following:

    (a) if the distance is 0210H bytes

    (b) if the distance is 0020H bytes

    Ans. (a) near (b) short

    1.4 The near jump modifies the program address by changing which register or registers?

    Ans. The IP register

    1.5 Explain what the JMP AX instruction accomplishes. Also identify it as a near or a far jump instruction.

    Ans. The JMP AX instruction jumps to the offset address stored in AX. This can only be a near jump.

    1.6 Describe how the JA instruction operates.

    Ans. JA tests the condition of an arithmetic or logic instruction to determine if the outcome is above. If the outcome is above a jump occurs, otherwise no jump occurs.

    1.7 Which conditional jump instructions follow the comparison of signed numbers?

    Ans. JNE, JE, JG, JGE, JL, or JLE

    1.8 Which conditional jump instructions test both the Z and C flag bits?

    Ans. JA and JBE

    1.9 Name the different flags control instructions, the operations performed by them and also the flags affected.

    Ans. The following table shows the different flags control instructions, their meaning and the flags affected by respective instructions.

    1.10 What are the two basic types of unconditional jumps? Explain.

    Ans. The two basic types of unconditional jumps are intrasegment jump and intersegment jump.

    The intrasegment jump is a jump for which the addresses must lie within the current code segment. It is achieved by only modifying the value of IP.

    The intersegment jump is a jump from one code segment to another. For this jump to be effective, both CS and IP values are to be modified.

    1.11 Distinguish between Short-label and Near-label jump instructions.

    Ans. The distinction between the two is shown in a tabular form.

    Question No. (2) (5 marks)

    2.1 What are the two types of CALL instructions? Discuss.

    Ans. The two types are: intrasegment CALL and intersegment CALL.

    If the operands are Near-proc, Memptr16 and Regptr16, then they specify intrasegment CALL while Far-proc and Memptr32 represent intersegment CALL.

    2.2 List the different LOOP instructions and also the operations they perform.

    Ans. The different loop instructions and the operations they perform are shown in the following Table.

    2.3 List the basic string instructions and the operations they perform.

    Ans. The basic string instructions and the operations they perform are shown in following Table.

    2.4 What is a ‘REP’ instruction? Discuss.

    Ans. ‘REP’ stands for repeat and is used for repeating basic string operations—required for processing arrays of data.

    There are a number of repeat instructions available and are used as a prefix in string instructions. The prefixes for use with the basic string instructions are shown in the following Table.

    2.5 Which registers have their contents changed during an interasegment jump? Intersegment jump?

    Ans. IP; CS and IP.

    2.6 The following program implements a delay loop.

    MOV CX,1000H DLY: DEC CX JNZ DLY NXT: --- ---

    (a) How many times does JNZ DLY instruction is executed?

    (b) Change the program so that JNZ DLY is executed 17 times.

    Ans.

    (a) 100016 = 212 = 4096 times.

    (b) Implement the loop with the counter = 17

    MOV CX,11H DLY: DEC CX JNZ DLY NXT: --- ---

    2.7 What is the function is performed by RET instruction?

    Ans. At the end of the subroutine a RET instruction is used to return control to the main (calling) program. It does this by popping IP from the stack in the case of an intrasegment call and both CS and IP for an intersegment call.

    2.8 What determines the SI and DI registers show an increment or a decrement during string operation?

    Ans. DF.

    2.9 Which segment register is used to form the destination address for a string instruction?

    Ans. ES.

    स्रोत : genderi.org

    Do you want to see answer or more ?
    Mohammed 6 day ago
    5

    Guys, does anyone know the answer?

    Click For Answer