Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Will this call be executed in assembly?

Am I correct to assume that call to 18222E214 will be never executed?

sub     rsp, 28h
mov     byte ptr [rsp+27h], 0
mov     al, [rsp+27h]
test    al, 1
jz      short loc_182C60C26
call    loc_18222E214

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

It shouldn’t be. You’re loading the value 0 into the al register. test al,1 sets the Sign, Zero, and Parity flags as though an and instruction had been executed. If you do an and al,1 when al contains 0, the Zero flag is set.

In your example, the Zero flag will be set by the test instruction, so the short jump will be taken and the call instruction following the jz will not be executed.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading