| Jump: subroutine calls | |||||||||||||||||
| main: | subroutine: | ||||||||||||||||
| jal offset |
|
addi . . . | |||||||||||||||
| sll $0, $0, 0 | ori . . . | ||||||||||||||||
| next |
|
blah | |||||||||||||||
| . . . | |||||||||||||||||
| jr $r31 | |||||||||||||||||
| What happens if a jal call is made while in a subroutine? | |||||||||||||||||
| return address overwritten with a new return address | |||||||||||||||||
| must place the return address onto the stack (memory) | |||||||||||||||||
| It turns out that the return address is PC + 8, not PC + 4 | |||||||||||||||||
| jump instructions have to be followed by a branch delay slot instruction | |||||||||||||||||
| purpose of avoiding stalling in pipelines | |||||||||||||||||