Question: The following RISC - V procedure is intended to reverse a string. We have deliberately omitted the code that saves and restores registers from the
The following RISCV procedure is intended to reverse a string. We have deliberately omitted the code that saves and restores registers from the stack. Inspect the code and select which registers, if any, must be saved in the stack.
section text
global strrev
strrevi
s str
a sz
# ttheta sz
#Enter stack frame
#What registers should we push to the stack?
#Get the size of the string
mv $ ao #this is the same as add si ae zero
jal strlen
srai to ab # Divide sz by
tl #
matrix L&g& for oop matrix
bget te L add tst str subt atheta t forall sz a dd tt sz add tts forall str sz bt thetatstrb t thetat forall strsz
sbt thetat ne swap
sbt thetat
addi t t
JL
L:
#Leave stack frame
#what registers should we pop from the stack?
jr rab
which ones from below is correct:
ra
t
No register needs saving
t
t
t
t
t
a
s
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
