|CSE Home||About Us||Search||Contact Info|
Homework #3: Procedure Call
Out: Wednesday, 1/17/2007
Due: Wednesday, 1/24/2007
FAQConsult this Wiki page to post a question, or to help others out by answering a question.
Optional Extra Credit AssignmentAn 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 OverviewThis 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.)
Detailshw3Files.tar.gz contains the sample application used in lecture (
max.c), as well as the result of compiling those files using Cebollita (
max.s), and finally some "library routines" (
iolib-os.o). There is also a
makefile, with targets
run(to build if necessary, and to run), and
clean. 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 (
.sfiles) so that the call to
main()uses the MIPS convention instead. This involves modifying a small amount of code in
main.s(what the caller does) and in
max.s(what the callee does). When done,
max()can only be called from code that uses the MIPS conventions.
mainis a bit more schizophrenic: it uses the MIPS conventions when invoking
max(), but continues to follow the Cebollita conventions when invoking
printInt()and as a called procedure itself (i.e., in its entry and exit code).
.sfiles 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
.cfiles, 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
.cfiles have been purposefully renamed in a way that makes compiling them by accident very unlikely.
MIPS conventions: Section 2.7 of the text, and specifically Figure 2.16. Section A.6 of the text
TurninIn 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
Seattle, WA 98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to zahorjan]