CMSC 412 Programming Assignment #1 - Checklist

 

This document provides a checklist of things that need to be done as part of project #1.

 

Creating libuser.c

            Start from supplied template

            Add new system calls

            Add Readln

            Add _Entry

 

Adding system calls to kernel

            Create a table of functions to find function to invoke

For each system call

                        Add entry to handler function table

                        Write handler function for that system call

                        Copy and validate parameters as needed

                        Implement functionality

            Write a routine to validate pointers passed into kernel space

                        add basePtr to any address to get kernel address of user location

Enable the supplied filesystem and disk drivers

            Call Init_IDE, Init_Floppy, and Init_PFAT

-         must call in that order

-         put calls in main thread of your OS kernel.

Print System Call

            Just call print after copying string from user space

 

Getkey

            Call Wait_For_Key_Atomic and return value to user space

 

Exit System Call

            Delete user context (including freeing memory)

            Disable Interrupts

Call Detach_Thread

Set g_killCurrentThread and g_needReschedule to TRUE

Wait System Call

            Need to use Join kernel call to wait for a process  (really a kernel thread)

User Mode (this is the implementation of the system call spawn)

Load a program into memory (loadElfProgram)

       Use ReadFileAndAllocate to get the file into memory

    

     Write the function called Create_User_Process

                 See handout for description

 

Context Switch Code (at the .restore label & in RestoreThread in lowlevel.asm)

            Add a call to  Switch_User_Context

 

Write Switch_User_Context

            If (returning to user mode – check rpl of state)

                        Load ldt of user context

                        Fill out

g_theTSS.esp0  = top of kernel thread’s stack

g_theTSS.ss0  = KERNEL_DS

 

Start the first User Mode Process

            Call the routines used in spawn to load the program /a/a.exe and run it

                       This routine is called from the Main of your system.