Function Prologue/Epilogue

Medium Assembly Architecture
Solve this problem

Write ARM assembly implementing function prologue/epilogue to save registers, allocate stack space, and restore context before return.

Constraints

  • Save r4-r7 and lr.
  • Allocate 16 bytes stack space.
  • Free space on exit.
  • Return using bx lr.
  • Assume r0 contains input and r0 returns output.
Starter codeAssembly
1.global func2func:3    ; TODO