How does "mov (% ebx,% eax, 4),% eax" work?

Worked on build assignment and for the most part I am good at build. Or at least good enough for the job. But this mov statement turns me off. I would really appreciate it if someone could just explain how this mov operator manipulates register values.

mov (% ebx,% eax, 4),% eax

PS I was unable to find this particular type of mov expression on basic searches, so I apologize if I just skipped it and ask questions.

+3


source to share


1 answer


Full format of memory addressing in AT&T assembly:

offset(base, index, width)

      

So for your case:

offset = 0
base = ebx
index = eax
width = 4

      



The point is that the instruction looks something like this:

eax = *(uint32_t *)((uint8_t *)ebx + eax * 4 + 0)

      

In C-like pseudocode.

+5


source







All Articles