I was looking in to some compiler generated assembly code(x86_64) and found few instructions which have a zero displacement as following..
movzbl 0x0(%rbp),%eax
What could be the reason behind such 0x0 displacement? (I am new to assembly, please point me to the links if its already a discussed issue.) From my understanding, the above instruction copies the zero extended rbp+(0x0) to eax.
EDIT: I found a link which explains it for leal though
what-does-0x0-indicate-in-the-instruction
Thank you..!
It means
movzx eax, byte [rbp + 0].There’s no encoding for memory operands at address contained in
(e|r)bp, but there is for(e|r)bp + constant. So, you have 0 for that constant to extract a byte from the address inrbp.