diff --git a/seminaries/qtmips/call-syscall/l10-05-call-6args.S b/seminaries/qtmips/call-syscall/l10-05-call-6args.S index 2f6502c48132b829bf5de97fd5682670b5cba94d..4169dffa67f839d637790faae96337445a407c4d 100644 --- a/seminaries/qtmips/call-syscall/l10-05-call-6args.S +++ b/seminaries/qtmips/call-syscall/l10-05-call-6args.S @@ -35,6 +35,11 @@ final: main: addiu $sp, $sp, -32 // allocate space for save and arguments sw $ra, 28($sp) // store return address from main + + sw $s8, 24($sp) // store farme pointer, not required there + or $s8, $sp, $zero // set fp to point to top of the stack, not required + // see -fomit-frame-pointer/-fno-omit-frame-pointer + addiu $v0, $zero, 6 // 6-th argument value sw $v0, 20($sp) // 6-th argument to the stack addiu $v0, $zero, 5 // 5-th argument value @@ -44,6 +49,10 @@ main: addiu $a1, $zero, 2 // 2-nd argument value jal complex // call complex function addiu $a0, $zero, 1 // store 1-st argument, run in delay slot + + or $sp, $s8, $zero // restore stack from frame pointer + lw $s8, 24($sp) // restore frame pointer, not required there + lw $ra, 28($sp) // restore return address nop // on MIPS1 lw result not available directly jr $ra // return from main, result in v0