The purpose of this homework is to explore what needs to be done to add support in CalOS for programs being written using logical addresses instead of hard-coded physical addresses.

Current State of the OS

Download the files from here. You should have 5 python files:,,,, and; and 2 assumbly language files: mult.asm and fib.asm.

CalOS has changed a bit since homework05:

The MMU, as you recall from class, is a device that sits between the CPU and RAM. It is responsible for checking if address accesses are legal, and can be used to translate addresses. Using the MMU we can begin to treat addresses in code as logical addresses instead of physical addresses and we can thus load a program in to any memory location in RAM.

Step 1: Add the MMU class, but don't have it do any address translation

Create an MMU class in the file

Now, update to use the MMU and not use RAM directly.

Verify that you can still run programs successfully. See homework05 for examples on loading and running mult.asm and fib.asm.

Step 2: "Fix" mult.asm to use contiguous memory

One problem with our assembly language programs is that they are written with hard-coded physical addresses in them, not only for places to jump to in the code, but also addresses which data is read from and written to.

Update mult.asm to use contiguous memory.

Step 3: Update and asm files to note the area in a file for data storage

Our assembly language files now store data in the locations following the text of the code. But, the files do not indicate the location or size of the data.

To solve this problem, we are going to make one assumption: code always uses the area right after the text as a data area. That solves the problem of where the data will be stored in memory. However, we still need to indicate to the operating system how large the data area is. If we don't do this, the operating system cannot properly check if memory accesses go out of range. To fix this, we'll introduce another special label in the assembly language, __data: value, which will indicate to the OS how much space must be reserved for the program to store data.

We are still not doing any address translation or address checking yet. In fact, our MMU object doesn't do anything yet, except pass memory accesses on through to the RAM object. It is time to take care of that. We are going to have our MMU object implement figure 7.6 from the book, where low and high addresses are checked and addresses are translated from logical to physical.

Step 4: Implement Address Translation and Checking

Add registers to the MMU

Checking In

Submit all the code and supporting files for this homework to /home/cs/232/current/<yourid>/homework07/.
We will grade this exercise according to the following criteria: (15 pts total)