Link Search Menu Expand Document

Source files

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

threads/thread.h

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().

userprog/process.h

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

userprog/process.c

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.

userprog/pagedir.c

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

userprog/syscall.c

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.

lib/user/syscall.c

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).

lib/syscall-nr.h

This file defines the syscall numbers for each syscall.

lib/float.h

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

userprog/exception.c

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.

userprog/gdt.c

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.

userprog/tss.c

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.