Difference between revisions of "Assembler:Commands:JNB"
(Replaced content with '<span style="font-size:25px;color:red">Sorry! Content not available.</span>') |
m (Reverted edits by This content is not available (Talk) to last revision by TheyCallMeTim13) |
||
Line 1: | Line 1: | ||
− | < | + | [[Category:Assembler]] |
+ | '''command''' jnb ''size'' ''operand'' | ||
+ | |||
+ | Jumps if not below (CF=0) to the given operand (address). | ||
+ | |||
+ | |||
+ | <div style="padding:2px;border:1px dashed #2f6fab;background-color:#f4f4f4;"> | ||
+ | '''Jcc''' | ||
+ | Checks the state of one or more of the status flags in the EFLAGS register (CF, OF, PF, SF, and ZF) and, if the flags are in the specified state (condition), performs a jump to the target instruction specified by the destination operand. A condition code (cc) is associated with each instruction to indicate the condition being tested for. If the condition is not satisfied, the jump is not performed and execution continues with the instruction following the Jcc instruction. | ||
+ | |||
+ | The target instruction is specified with a relative offset (a signed offset relative to the current value of the instruction pointer in the EIP register). 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-bit or 32-bit immediate value, which is added to the instruction pointer. Instruction coding is most efficient for offsets of -128 to +127. 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. | ||
+ | |||
+ | The conditions for each Jcc mnemonic are given in the "{description}" column of the table on the preceding page. The terms "less" and "greater" are used for comparisons of signed integers and the terms "above" and "below" are used for unsigned integers. | ||
+ | |||
+ | Because a particular state of the status flags can sometimes be interpreted in two ways, two mnemonics are defined for some opcodes. For example, the JA (jump if above) instruction and the JNBE (jump if not below or equal) instruction are alternate mnemonics for the opcode 77H. | ||
+ | |||
+ | The Jcc instruction does not support far jumps (jumps to other code segments). When the target for the conditional jump is in a different segment, use the opposite condition from the condition being tested for the Jcc instruction, and then access the target with an unconditional far jump (JMP instruction) to the other segment. For example, the following conditional far jump is illegal: JZ FARLABEL; To accomplish this far jump, use the following two instructions: JNZ BEYOND; JMP FARLABEL; BEYOND: The JECXZ and JCXZ instructions differ from the other Jcc instructions because they do not check the status flags. Instead they check the contents of the ECX and CX registers, respectively, for 0. Either the CX or ECX register is chosen according to the address-size attribute. | ||
+ | |||
+ | These instructions are useful at the beginning of a conditional loop that terminates with a conditional loop instruction (such as LOOPNE). They prevent entering the loop when the ECX or CX register is equal to 0, which would cause the loop to execute 232 or 64K times, respectively, instead of zero times. | ||
+ | |||
+ | All conditional jumps are converted to code fetches of one or two cache lines, regardless of jump address or cacheability. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | [http://c9x.me/x86/html/file_module_x86_id_146.html c9x.me/x86/html/file_module_x86_id_146.html] | ||
+ | </div> | ||
+ | |||
+ | |||
+ | === Command Parameters === | ||
+ | {|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0" | ||
+ | !align="left"|Parameter | ||
+ | !style="width: 80%;background-color:white;" align="left"|Description | ||
+ | |- | ||
+ | |size '''OPTIONAL''' | ||
+ | |The preferred size of the assembled address | ||
+ | |- | ||
+ | |operand | ||
+ | |The address or symbol to jump to | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Examples == | ||
+ | jnb +1A // Jump from end of command to +1A (hex). | ||
+ | |||
+ | jnb 00123ABC // Jump to address. | ||
+ | |||
+ | jnb 0000123456ABCDEF // Jump to address. | ||
+ | |||
+ | jnb eax // Jump to value of eax. | ||
+ | |||
+ | jnb rax // Jump to value of rax. | ||
+ | |||
+ | jnb someSymbol // Jump to user defined symbol. | ||
+ | |||
+ | jnb someLabel // Jump to label. | ||
+ | |||
+ | jnb short someLabel // Jump to label with short byte code. | ||
+ | |||
+ | jnb long someLabel // Jump to label with full address. | ||
+ | |||
+ | jnb @b // Jump back to closest label | ||
+ | |||
+ | jnb @f // Jump forward to closest label | ||
+ | |||
+ | |||
+ | {{AssemblerCommandSeeAlso}} | ||
+ | |||
+ | {{Template:AssemblerCommandExternalLinks}} |
Latest revision as of 19:08, 18 March 2019
command jnb size operand
Jumps if not below (CF=0) to the given operand (address).
Jcc Checks the state of one or more of the status flags in the EFLAGS register (CF, OF, PF, SF, and ZF) and, if the flags are in the specified state (condition), performs a jump to the target instruction specified by the destination operand. A condition code (cc) is associated with each instruction to indicate the condition being tested for. If the condition is not satisfied, the jump is not performed and execution continues with the instruction following the Jcc instruction.
The target instruction is specified with a relative offset (a signed offset relative to the current value of the instruction pointer in the EIP register). 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-bit or 32-bit immediate value, which is added to the instruction pointer. Instruction coding is most efficient for offsets of -128 to +127. 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.
The conditions for each Jcc mnemonic are given in the "{description}" column of the table on the preceding page. The terms "less" and "greater" are used for comparisons of signed integers and the terms "above" and "below" are used for unsigned integers.
Because a particular state of the status flags can sometimes be interpreted in two ways, two mnemonics are defined for some opcodes. For example, the JA (jump if above) instruction and the JNBE (jump if not below or equal) instruction are alternate mnemonics for the opcode 77H.
The Jcc instruction does not support far jumps (jumps to other code segments). When the target for the conditional jump is in a different segment, use the opposite condition from the condition being tested for the Jcc instruction, and then access the target with an unconditional far jump (JMP instruction) to the other segment. For example, the following conditional far jump is illegal: JZ FARLABEL; To accomplish this far jump, use the following two instructions: JNZ BEYOND; JMP FARLABEL; BEYOND: The JECXZ and JCXZ instructions differ from the other Jcc instructions because they do not check the status flags. Instead they check the contents of the ECX and CX registers, respectively, for 0. Either the CX or ECX register is chosen according to the address-size attribute.
These instructions are useful at the beginning of a conditional loop that terminates with a conditional loop instruction (such as LOOPNE). They prevent entering the loop when the ECX or CX register is equal to 0, which would cause the loop to execute 232 or 64K times, respectively, instead of zero times.
All conditional jumps are converted to code fetches of one or two cache lines, regardless of jump address or cacheability.
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.
Command Parameters[edit]
Parameter | Description |
---|---|
size OPTIONAL | The preferred size of the assembled address |
operand | The address or symbol to jump to |
Examples[edit]
jnb +1A // Jump from end of command to +1A (hex).
jnb 00123ABC // Jump to address.
jnb 0000123456ABCDEF // Jump to address.
jnb eax // Jump to value of eax.
jnb rax // Jump to value of rax.
jnb someSymbol // Jump to user defined symbol.
jnb someLabel // Jump to label.
jnb short someLabel // Jump to label with short byte code.
jnb long someLabel // Jump to label with full address.
jnb @b // Jump back to closest label
jnb @f // Jump forward to closest label