Enabling user-mode processes in the target OS for CSC 159 operating system pragmatics

One of the main responsibilities of an Operating System (OS) is to ensure system stability and security. Most OSes utilize mechanisms built into the CPU hardware to prevent user-mode processes from altering the state of the system or accessing protected spaces and hardware I/O ports. A process should only read from or write to memory addresses in its address space. In order to accomplish the above, the CPU is typically designed to operate in two or more modes with different privilege levels. The OS typically runs in the mode with highest privilege level, which enables it to execute any instruction and gives it access to all the memory in the system. To improve system reliability, security and stability, applications usually run in the mode with the lowest privilege level. At Sacramento State University, CSC 159 (Operating System Pragmatics) students learn to develop an OS using the SPEDE (System Programmer’s Educational Development Environment) framework. SPEDE provides an environment to build an OS executable image and download it to a target system where it is executed as the local OS. While SPEDE provides an excellent development environment for students to learn how to develop an OS, one limitation is it does not currently support running processes in user-mode (only kernel-mode is supported). In order to give students a better understanding of how an OS can provide security and protection, it is necessary to enable the support for user-mode processes. The goals of this project are to establish a supportive software component for the creation of user-mode processes, enabling and enforcing memory protection for the process runtime and handling of runtime exceptions in a virtual memory paging system, such as page faults and general protection faults in the OS kernel. In order to achieve these goals, additional kernel data structures must be implemented (e.g. paging table structures, a Task State Segment, modified process trap frame, etc.) along with handlers for page faults and general protection faults.