NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: paml27 on March 20, 2020, 01:09:02 AM
-
I just used ndisasm to disassemble code I compiled with the NASM compiler. I see several instances of long blocks where the instruction add [rax],al is repeated, like this:
00000425 0000 add [rax],al
00000427 0000 add [rax],al
00000429 0000 add [rax],al
0000042B 0000 add [rax],al
0000042D 0000 add [rax],al
0000042F 0000 add [rax],al
00000431 0000 add [rax],al
00000433 0000 add [rax],al
00000435 0000 add [rax],al
What do these sequences mean? Wouldn't this be best reduced to fewer instructions?
-
Hi pam127,
As you can see in the second column, those are zeros. I think you will see that they are not executed. I hope not!
Best,
Frank
-
Hi, Frank,
Yes, I see. Thanks for clearing that up. Do those function like no-ops?
-
Not really. They are a block of "data" that shouldn't be executed at all. To be clear... Nasm does not emit a long string of "add"s. Nasm does not emit any instruction mnemonics at all. You and I provide those. Nasm converts them to nimbers. Ndisasm converts the numbers to mnemonics. But Ndisasm isn't very bright. Doesn't try to be. It attempts to disassemble everything - executable header, data, padding...
Agner Fog's "objconv" is much brighter! Look for it around "agner.org". I think you'll like it!
Best,
Frank