Question

I am very confused regarding the indirect addressing mode for this instruction:

and $0x0000FF00, 4(%esp)

If this is the current top of stack:

0xBF8DB0B8: 0xDEADBEEF <--- ESP + 4
0xBF8DB0B4: 0xDEADBEEF <--- ESP

and this is the content of memory at 0xDEADBEEF:

0xDEADBEEF: 0x1234ABCD

Which of the following will be performed?

  1. AND 0x0000FF00, 0xDEADBEEF with result: 0x0000BE00 stored in 0xBF8DB0B8.

  2. AND 0x0000FF00, 0x1234ABCD, with result: 0x0000AB00 stored in 0x0000AB00.

  3. AND 0x0000FF00, 0xDEADBEF3. with result: 0x0000BE00 stored in 0xDEADBEF3.

Was it helpful?

Solution

AND 0x0000FF00, 0xDEADBEEF with result: 0x0000BE00 stored in 0xBF8DB0B8:

Since %esp contains the address 0xBF8DB0B4, 4(%esp) is the address 0xBF8DB0B8 and 0xDEADBEEF is what in that address.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top