[CSE]  Advanced Operating Systems 
 COMP9242 2006/S2 
CRICOS Provider
Number: 00098G

PRINTER Printer-Friendly Version
- Notices
- Course Intro
- Consultations
- Survey Results
- Lectures
- Selected Papers
- Project Spec
- Exam
2006 Patchlist
Project Resources
Slug Lab
L4 Debugging Guide
Developing on a Mac
Developing on Linux
SOS source browser

L4Ka::Pistachio FAQ
L4 reference manual
L4 user manual
IXP42X hardware manual 
NSLU2-Linux HomePage
Intel IXP400 Software

Related Info
Aurema OS Prize
OS Hall of Fame
- 1997
- Gernot Heiser (LiC)
- Kevin Elphinstone
- Guest Lecturers (TBA)
- Student Reps

Valid HTML 4.0!

M2: A pager

Use your memory manager from M1 to write a simple pager. The pager should allow ELF files to run from the boot file, however rather than having their stack allocated in physical memory, it should just use virtual memory. This should allow you to execute user processes in place, i.e. from the boot image. Note that in general a program can only be executed in-place once, afterwards global variables may have incorrect values.

process layout

Note: In this milestone you will most likely be creating virtual address aliases. It will be necessary for you to be aware of the caching issues involved with the ARM processor in the NSLU2.

Design alternatives

Probably the main thing that you should consider here is the layout of your processes address space. Some things you will want to consider is where you place various parts of memory such as the stack, heap and code segments. You may also have some other regions in your process address space, one of these is the UTCBs.

You should also think about if you want to make different ranges of the address space have different permissions, eg: you may want to make code read-only to prevent bugs, or have a guard page at the end of your stack to prevent overflow.


The main demonstration here will be to show a user process running with a high stack pointer (> 0x2000000). You should also demonstrate a user process using malloc() from a heap.

Note that L4 manages pagetables internally. To test your pagetable properly it is necessary to flush L4's mappings. This example user code should test some simple functions of your page table and VM system. To use it you will need to add a debug flush system call to SOS.

#define NPAGES 128

/* called from pt_test */
static void
do_pt_test( char *buf )
    int i;
    L4_Fpage_t fp;

    /* set */
    for(i = 0; i < NPAGES; i += 4)
	buf[i * 1024] = i;

    /* flush */
    assert(!"make a syscall to flush the user address space");
    // sos_debug_flush();

    /* check */
    for(i = 0; i < NPAGES; i += 4)
	assert(buf[i*1024] == i);

static void
pt_test( void )
    /* need a decent sized stack */
    char buf1[NPAGES * 1024], *buf2 = NULL;

    /* check the stack is above phys mem */
    assert((void *) buf1 > (void *) 0x2000000);

    /* stack test */

    /* heap test */
    buf2 = malloc(NPAGES * 1024);

You should also be able to explain to the tutor how your code works and any design decisions you took.

Last modified: 27 Jul 2006.