Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`js` and `jb` instructions in assembly

Tags:

x86

assembly

att

I am having a hard time understanding what exactly js and jb instruction do. I understand that jb is jump if below. But, what would be the difference between jb and jle. And similarly, js seems to me that it is equivalent to jb, as it means jump if signed. Any help would be appreciated.

like image 765
konstant Avatar asked Oct 21 '25 08:10

konstant


1 Answers

There exists a handy table that does explain very well which Jcc instruction to use:

Jump conditions and flags:

Mnemonic        Condition tested  Description  
jo              OF = 1            overflow 
jno             OF = 0            not overflow 
jc, jb, jnae    CF = 1            carry / below / not above nor equal
jnc, jae, jnb   CF = 0            not carry / above or equal / not below
je, jz          ZF = 1            equal / zero
jne, jnz        ZF = 0            not equal / not zero
jbe, jna        CF or ZF = 1      below or equal / not above
ja, jnbe        CF or ZF = 0      above / not below or equal
js              SF = 1            sign 
jns             SF = 0            not sign 
jp, jpe         PF = 1            parity / parity even 
jnp, jpo        PF = 0            not parity / parity odd 
jl, jnge        SF xor OF = 1     less / not greater nor equal
jge, jnl        SF xor OF = 0     greater or equal / not less
jle, jng    (SF xor OF) or ZF = 1 less or equal / not greater
jg, jnle    (SF xor OF) or ZF = 0 greater / not less nor equal 
like image 190
zx485 Avatar answered Oct 24 '25 08:10

zx485