Question: Assume the CPU is executing a function that has local variables x , y , and z allocated on the stack, and that x is

Assume the CPU is executing a function that has local variables x,y, and z allocated
on the stack, and that x is allocated at the memory address that is 16 bytes from the
address value stored in register sp, or [sp, #16]. Assume y is stored at [sp, #8], and
z is at sp. For the assembly code and register values listed below:
(1) Show the values that will be stored in the registers and in memory when
execution of these instructions is complete. If the value is unknown, write "?".
(2) Write a C code translation of the assembly code sequence. You may assume
that x,y, and z have already been declared as long variables in the C code. You do
not need to write the entire function, just the lines of C that might have generated
the ARM64 instructions. Hint: one solution is 4 lines of C code.
C Code Translation
mov x0, #2
mov x1, #3
str x0,[sp, #16]
str x1,[sp, #8]
add x0, x0, x1
str x0,[sp]
lsl x1, x1, #1
str x1,[sp, #8]
Assume the CPU is executing a function that has

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!