Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of testb instruction?

Tags:

gdb

Can any one 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)?

like image 416
vik123 Avatar asked Jul 17 '13 11:07

vik123


People also ask

What is Testb?

The TESTB operation compares the bits identified in factor 2 with the corresponding bits in the field named as the result field. The result field must be a one-position character field. Resulting indicators in positions 71 through 76 reflect the status of the result field bits.

What does x86 test do?

In the x86 assembly language, the TEST instruction performs a bitwise AND on two operands. The flags SF , ZF , PF are modified while the result of the AND is discarded. The OF and CF flags are set to 0 , while AF flag is undefined.

What does Movzbl do in assembly?

For MOVZBL, the low 8 bits of the destination are replaced by the source operand. the top 24 bits are set to 0. The source operand is unaffected. For MOVZBW, the low 16 bits of the destination are replaced by the source operand.

What is the AL register?

The least significant byte of AX can be used as a single 8-bit register called AL, while the most significant byte of AX can be used as a single 8-bit register called AH. These names refer to the same physical register. When a two-byte quantity is placed into DX, the update affects the value of DH, DL, and EDX.


1 Answers

It performs a bitwise AND of the two operands (0x10 AND 0x8(%eax) (this is, the value of the byte located at the address pointed to by %eax + 0x8). Neither of the operands is altered, however, the instruction alters the flags, most importantly the ZF flag to either 1 if the result of the AND is zero, or 0 otherwise. The following jne performs a jump if ZF is equal to 0.

like image 101
JustSid Avatar answered Oct 27 '22 10:10

JustSid