What is the meaning of the testb instruction?

Can someone tell me the meaning of the following:

gdb> disas 0x080ed5af 0x080ed5ac <func1+205>: mov 0x8(%eax),%eax 0x080ed5af <func1+208>: testb $0x10,0x8(%eax) 0x080ed5b3 <func1+212>: jne 0x80ed604 <dapriv_disk_op+293> 0x080ed5b5 <func1+214>: mov %edi,(%esp) 

What is the meaning of testb $0x10,0x8(%eax) ?

+4
source share
1 answer

It performs bitwise AND of two operands ( 0x10 AND 0x8(%eax) (this is the value of the byte located at the address pointed to by %eax + 0x8). None of the operands changes, however, the command changes the flags, and most importantly, the flag ZF or 1 if the result of AND is zero, or 0. Otherwise, the next jne will jump if ZF is 0.

+8
source

Source: https://habr.com/ru/post/1491847/


All Articles