l6_handouts_4up - ECE 3140/CS 3420 Computer Organization...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE 3140/CS 3420 Computer Organization Spring 2009 Procedures Assemblers ECE3140/CS3420 There are 10 types of people in the world. Those who understand binary . .. ... and those who don`t. ECE3140/CS3420 Announcements • Homework 2 to be posted today • Project 1 ue TODAY Feb 10 at 10:00pm – Due TODAY, Feb 10 at 10:00pm – Don’t wait until the last minute to post to CMS! – Problems in convert.s have been fixed – Your programs MUST follow the calling convention as described in class ECE3140/CS3420 3 Hennessy and Patterson • Read Chapter 1 – 1.1-1.9 ead Chapter 2 Read Chapter 2 – 2.1 through 2.14, – B.1-B.6, B.10 – MIPS Calling Convention Document (website) – Notes on Programming in C (website) • Read Chapter 3 .1 through 3.2 ECE3140/CS3420 3.1 through 3.2 • Read Appendix C (for Tuesday) – C.1-C.6 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Procedures, Recap •A stack frame holds information about each procedure call ach call pushes a new stack frame onto the stack – Each call pushes a new stack frame onto the stack – Each return pops the stack frame off the stack • This information may include local data, return address, saved variables, and arguments • Registers used by procedure calls/returns are a0 $a1 $a2 $a3 $ra and $sp ECE3140/CS3420 $a0,$a1,$a2,$a3,$ra, and $sp • Stack frames must always be double word aligned Our Stack Frames ECE3140/CS3420 Top of stack Local Data Section • You must include a Local Data Section in the stack frame for a procedure if: – The procedure requires more storage than can fit in available registers • The Local Data Section must always be – Double word aligned ave a size that is a multiple of 8 ECE3140/CS3420 Have a size that is a multiple of 8 Return Address Slot • You must include a Return Address Slot in the stack frame for a procedure if: he procedure calls another procedure (i e is a non – The procedure calls another procedure (i.e., is a non- leaf procedure) • The return address must be copied from $31 ($ra) to the stack in the prologue • The return address must be copied from the tack to $31 ($ra) in the epilogue ECE3140/CS3420 stack to $31 ($ra) in the epilogue • A pad may be required above the return address slot to keep the Local Data doubleword aligned.
Background image of page 2
3 Saved Registers Section • You must include a Saved Registers Section in the stack frame for a procedure if: he procedure body uses (i e changes the – The procedure body uses (i.e., changes the value of) registers $s0 to $s7 • The values of saved registers must be copied to the stack in the prologue • The values of saved registers must be copied om the stack in the epilogue
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2009 for the course ECE 3140 taught by Professor Mckee/long during the Spring '07 term at Cornell University (Engineering School).

Page1 / 8

l6_handouts_4up - ECE 3140/CS 3420 Computer Organization...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online