Computer Science 2208A/B Chapter Notes - Chapter 3,4,6: Memory Management, Exception Handling, Subroutine
Document Summary
Bsr proc_a = instruction to call subroutine proc_a. Processor saves address of next instruction to be executed & loads pc with address of 1st instruction in subroutine. Rts = return from subroutine instruction, occurs at end of subroutine & causes the processor to return the point immediately following subroutine call. Bl = branch with link instruction, automatically saves return address & copies pc into r14. At end of subroutine, return by transferring return address in r14 to pc. Bllt = branch with link, execution on condition less than. Implemented in microprocessors by using stack pointer to point to top of stack (tos) in memory. Two design decisions must be made when stack is implemented. Whether stack grows up toward low or down toward high memory addresses as items are pushed. Whether stack pointer points to top item on stack or first free empty space. Risc processors (like arm) require programmer to maintain the stack.