점프 할때의 플래그들 정리
비슷한 의미 별로 그룹화 시켜놓은것들, 필요 할 때 참고삼아
Getting the sense for jumps and flags has long been a troublesome area for me, especially since the Intel assembler book shows 32 of these, all with similar-sounding names. Looking more closely I found that many of the instructions were synonyms for each other, and in practice the whole gamut is not needed, and in the process found that my copy of Intel's 80386 Programmer's Reference Manual gave an incorrect description for one of the instructions.
So I have grouped these functionally, with all instruction synonyms in the same row.
Instruction | Description | signed-ness | Flags | short jump opcodes | near jump opcodes |
---|---|---|---|---|---|
JO | Jump if overflow | OF = 1 | 70 | 0F 80 | |
JNO | Jump if not overflow | OF = 0 | 71 | 0F 81 | |
JS | Jump if sign | SF = 1 | 78 | 0F 88 | |
JNS | Jump if not sign | SF = 0 | 79 | 0F 89 | |
JE JZ | Jump if equal Jump if zero | ZF = 1 | 74 | 0F 84 | |
JNE JNZ | Jump if not equal Jump if not zero | ZF = 0 | 75 | 0F 85 | |
JB JNAE JC | Jump if below Jump if not above or equal Jump if carry | unsigned | CF = 1 | 72 | 0F 82 |
JNB JAE JNC | Jump if not below Jump if above or equal Jump if not carry | unsigned | CF = 0 | 73 | 0F 83 |
JBE JNA | Jump if below or equal Jump if not above | unsigned | CF = 1 or ZF = 1 | 76 | 0F 86 |
JA JNBE | Jump if above Jump if not below or equal | unsigned | CF = 0 and ZF = 0 | 77 | 0F 87 |
JL JNGE | Jump if less Jump if not greater or equal | signed | SF <> OF | 7C | 0F 8C |
JGE JNL | Jump if greater or equal Jump if not less | signed | SF = OF | 7D | 0F 8D |
JLE JNG | Jump if less or equal Jump if not greater | signed | ZF = 1 or SF <> OF | 7E | 0F 8E |
JG JNLE | Jump if greater Jump if not less or equal | signed | ZF = 0 and SF = OF | 7F | 0F 8F |
JP JPE | Jump if parity Jump if parity even | PF = 1 | 7A | 0F 8A | |
JNP JPO | Jump if not parity Jump if parity odd | PF = 0 | 7B | 0F 8B | |
JCXZ JECXZ | Jump if %CX register is 0 Jump if %ECX register is 0 | %CX = 0 %ECX = 0 | E3 |
Processor Flags
The x86 processors have a large set of flags that represent the state of the processor, and the conditional jump instructions can key off of them in combination.
- CF - carry flag(c에서는 CY)
- Set on high-order bit carry or borrow; cleared otherwise
- PF - parity flag(c에서는 PE)
- Set if low-order eight bits of result contain an even number of "1" bits; cleared otherwise
- ZF - zero flags(c에서는 ZR)
- Set if result is zero; cleared otherwise
- SF - sign flag(c에서는 PL이던디)
- Set equal to high-order bit of result (0 if positive 1 if negative)
- OF - overflow flag(c에서는 OV)
- Set if result is too large a positive number or too small a negative number (excluding sign bit) to fit in destination operand; cleared otherwise
http://unixwiz.net/techtips/x86-jumps.html
'프로그래밍(Programming) > 어셈블리어(asm)' 카테고리의 다른 글
어셈블리어단에서의 스텍프레임과 함수 호출 call, ret, ebp, esp, eip (0) | 2017.02.26 |
---|---|
loop 명령어 조건 정리 ECX (0) | 2017.02.25 |
상태 레지스터 플래그 (0) | 2017.02.24 |
cmp 에 의한 점프 명령어와 플래그 jmp, je==jz, ja, jb, jna, jnb, jbe , 비트 플래그 (0) | 2017.02.21 |
[어셈블리어 기초] CMP JMP CALL RET NOP (1) | 2013.02.06 |