|
CSE Home | About Us | Search | Contact Info |
Homework #3: Procedure Call
Out: Wednesday, 1/17/2007
Due: Wednesday, 1/24/2007
FAQ
Consult this Wiki page to post a question, or to help others out by answering a question.
Optional Extra Credit Assignment
An additional assignment can be done for small extra credit, once the assignment described on this page has been completed. The extra credit assignment is described here.
Assignment Overview
This assignment makes sure that you understand the purpose and implementation of procedure call linkage mechanisms, and tries to help bridge from understanding the details of one specific convention to understanding the fundamental issues all must face, but making you familiar with two conventions. (0 is 0, 1 is 1, and 2 is infinity, in some cases.) Specifically, it asks you to replace the subroutine linkage used by the Cebollita compiler with the MIPS convention, as described in Section 2.7 of the text. (In particular, we will use the specific MIPS linkage depicted in Figure 2.16.)Details
hw3Files.tar.gz contains the sample application used in lecture (main.c
andmax.c
), as well as the result of compiling those files using Cebollita (main.s
, andmax.s
), and finally some "library routines" (prologue-os.o
andiolib-os.o
). There is also amakefile
, with targetsa.exe
(to build),run
(to build if necessary, and to run), andclean
. To extract these files:$ tar xzf hw3Files.tar.gz
Cebollita of course uses the Cebollita subroutine linkage conventions when compiling. Your task is to modify the assembler files (
.s
files) so that the call tomax()
frommain()
uses the MIPS convention instead. This involves modifying a small amount of code inmain.s
(what the caller does) and inmax.s
(what the callee does). When done,max()
can only be called from code that uses the MIPS conventions.main
is a bit more schizophrenic: it uses the MIPS conventions when invokingmax()
, but continues to follow the Cebollita conventions when invokingprintInt()
and as a called procedure itself (i.e., in its entry and exit code).The
.s
files you start from have been hand commented, to make the sometimes murky code emitted by the compiler a little easier to deal with.Note that it would be a mistake to compile the.c
files, since that would overwrite the assembler code files with uncommented versions of the same instructions, and would obliterate any work you had done on a solution. To help prevent this from happening accidently, the.c
files have been purposefully renamed in a way that makes compiling them by accident very unlikely.Documentation
Cebollita conventions
MIPS conventions: Section 2.7 of the text, and specifically Figure 2.16. Section A.6 of the text Turnin
In the directory containing main.s and max.s, use the command 'turnin -ccse378 main.s max.s' to submit the assignment.
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 License.Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA 98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to zahorjan]