l6_handouts_2up - 1 ECE 3140/CS 3420 Computer Organization...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 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 2 Announcements Homework 2 to be posted today Project 1 Due TODAY Feb 10 at 10:00pm Due TODAY, Feb 10 at 10:00pm Dont 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 Read Appendix C (for Tuesday) C.1-C.6 4 3 Procedures, Recap A stack frame holds information about each procedure call Each 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 4 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 stack to $31 ($ra) in the epilogue A pad may be required above the return address slot to keep the Local Data doubleword aligned. 5 Saved Registers Section You must include a Saved Registers Section in the stack frame for a procedure if: The 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...
View Full Document

Page1 / 15

l6_handouts_2up - 1 ECE 3140/CS 3420 Computer Organization...

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

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