5.96 · exercise

Predict: memory and the stack

Trace the memory addresses and register values through these snippets. Write hex answers as 0x followed by the digits, and decimal answers as plain integers.

0 of 10 correct

Predict the result

mov x20, 0x1000
ldr x21, [x20, 16]!

Predict the result

mov x28, 0x2000
str w20, [x28], 8

Predict the result

mov x28, 0x2000
str w20, [x28], 8

Predict the result

mov x21, 5
ldr x22, [x29, x21, lsl 3]

Predict the result

add sp, sp, -28 & -16

Predict the result

fp .req x29
c_s = -4
mov fp, 0x8000
mov w21, 10
str w21, [fp, c_s]

Predict the result

main: stp x29, x30, [sp, -(16 + 12) & -16]!

Predict the result

main: stp x29, x30, [sp, -32]!

Predict the result

ldrsb w20, [x29]
// address holds the byte 0xff

Predict the result

ldrb w20, [x29]
// address holds the byte 0xff