Homework 12

22C:18, Fall 1996

Due Tuesday Dec. 10, 1996 in discussion

Douglas W. Jones
  1. The notion of a memory map is defined in the notes for lecture 34 (Nov 25). Assuming that there was space inside the memory management unit on a Hawk machine for the entire memory map, and assuming that all map entries are initially set to invalid, what contents must be loaded into which map entries in the MMU to completely describe the legal memory addresses used on the Hawk for RAM, ROM.

  2. Most real MMU hardware cannot hold a complete memory map! Instead, we store the map in some part of main memory, and let the MMU interrupt the system each time a program addresses a map entry that isn't in the MMU. Write a trap service routine for the MMU that handles such traps, assuming a global variable (in common) called MAPBASE that points to the base of the address map (the map entry for page zero of the address space), and a global variable called MAPSIZE that tells how many entries are in the map. This trap service routine does only 2 things: first, it checks to see if the addressed page is outside the map, and if so, jumps to MAPBOMB, which you can assume prints out an error message and halts the system, and second, it gets the required map entry and loads it in the MMU.

  3. Fix KBGETC routine given in the notes for Lecture 35 (Dec. 2) so that it checks the error bit in the keyboard status and discards the input character if this bit is set.

  4. Fix the ENQUEUE routine given in the notes for Lecture 35 so that, if the input queue is full, it discards the typed character instead of adding it to the queue.