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

Info icon This 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 S i 2009 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 Due 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 • Read 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 – 3.1 through 3.2 ECE3140/CS3420 3.1 through 3.2 Read Appendix C (for Tuesday) – C.1-C.6 4
Image of page 1

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

View Full Document Right Arrow Icon
2 Procedures, Recap • A stack frame holds information about each procedure call – 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 – Have 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: – The 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 stack to $31 ($ra) in the epilogue ECE3140/CS3420 A pad may be required above the return address slot to keep the Local Data doubleword aligned.
Image of page 2