





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Computer Systems Architecture; Subject: Computer Science; University: George Mason University; Term: Unknown 1989;
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






CS 365 1
CS 365 2
CS 365 3
Procedure Call Conventions
Passing arguments/parameters
Returning results
Those are conventions.
CS 365 4
Procedure Frames
A procedure frame contains all data pertaining to “one instance” of a procedure (one clone, one procedure frame).
Register $29 ($sp, for stack pointer) points to the top location of the stack
CS 365 7
Procedure Frames on MIPS
Argument 6 Argument 5
Saved registers
Local variables
Higher memory addresses
Lower memory addresses
Stack grows
$fp
$sp
CS 365 8
Duties of a MIPS Caller
$t0-$t9 (they are called caller-saved registers)
Remaining are pushed on to stack and
appear at the beginning of called procedure’s stack frame
CS 365 9
Duties of a MIPS Callee
Before it starts running
CS 365 10
saved fp
Example:
The Frame of G() on
the MIPS Platform
G() has
$ra $s xx
-4($fp) -8($fp) -12($fp) -16($fp)
High Memory
Low Memory
yy -20($fp) zz $sp
$fp
CS 365 13
0($fp) saved fp $ra $s xx
-4($fp) -8($fp) -12($fp) -16($fp) yy -20($fp) zz Default $sp in G (^) $t $t
p p p $sp when G calls F
Caller saved registers of G()
My $fp
$a
When G()
Calls F()
Arguments to F()
CS 365 14
The Code for G() to Call F()
CS 365 15
y
$s3 of G’s caller $ra of G’s caller $fp of G’s caller
zz yy xx
$s3 of G $ra of G $fp of G P5 of F P6 of F P7 of F $a0 of G $t2 of G $t1 of G x
calling Fwhen $sp of G $sp of G $fp of G
$sp of F $fp of F
Grows Stack
CS 365 16
Exercise: Give the Entrance Code of F()