Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Source files

Here is an overview of the source files for Project Userprog:


Contains the struct thread definition, which is the Pintos thread control block. The fields in #ifdef USERPROG ... #endif are collectively the process control block. We expect that you will add fields to the process control block in this project. The comments in this file may prove useful if you experience a kernel panic in thread_current().


Contains the struct process definition, and thus that of the Pintos process control block.


Contains implementations for the definitions in process.h. Also handles the loading of ELF binaries, starts processes, and switches page tables on context switch. You will likely need to modify this component in order to complete the project.


Manages the page tables. You probably won’t need to modify this code, but you may want to call some of these functions.


This is a skeleton system call handler. Currently, it only supports the exit syscall. Much of your work in Project 1 will take place here.


Provides library functions for user programs to invoke system calls from a C program. Each function uses inline assembly code to prepare the syscall arguments and invoke the system call. We do expect you to understand the calling conventions used for syscalls (also in Reference).


This file defines the syscall numbers for each syscall.


Manages the hardware FPU. May be useful for reference during the relevant part of Project 1.


Handle exceptions. Currently all exceptions simply print a message and terminate the process. Some, but not all, solutions to Project Userprog involve modifying page_fault() in this file.


80x86 is a segmented architecture. The Global Descriptor Table (GDT) is a table that describes the segments in use. These files set up the GDT. You should not need to modify these files for any of the projects. You can read the code if you’re interested in how the GDT works.


This file manages one particular segment, the Task-State Segment (TSS), which is used for 80x86 architectural task switching. Pintos uses the TSS only for switching stacks when a user process enters an interrupt handler, as does Linux. You should not need to modify these files for any of the projects. You can read the code if you’re interested in how the TSS works.