A tiny OS that used for course OSDI in National Chiao Tung University, Computer Science Dept.
This OS only supports x86
In this lab, you will learn about how to make os support symmertric multiprocessing (SMP) and simple scheduling policy for SMP.
Source Tree
kernel/*
: Includes all the file implementation needed by kernel only.
lib/*
: Includes libraries that should be in user space.
inc/*
: Header files for user.
user/*
: Files for user program.
boot/*
: Files for booting the kernel.
You can leverage grep
to find out where to fill up to finish this lab.
$ grep -R TODO .
To run this kernel
$ make
$ make qemu
To debug
$ make debug
New source to be added
kern/cpu.h
Kernel-private definitions for multiprocessor supportkern/mpconfig.c
Code to read the multiprocessor configurationkern/mpentry.S
Assembly-language entry code for non-boot CPUskern/spinlock.h
Kernel-private definitions for spin locks, including the big kernel lockkern/spinlock.c
Kernel code implementing spin lockskern/lapic.c
Kernel code driving the local APIC unit in each processor
Modifications to be made
inc/syscall.h
Implementget_cid
kernel/main.c
Implementboot_aps
andmp_main
to support multiprocessorkernel/task.c
Implementtask_init_percpu
and modify variable cur_task, functionssys_fork
sys_kill
to support multiprocessorkernel/syscall.c
Implementget_cid
kernel/sched.c
Modify scheduler to support multiprocessorkernel/timer.c
Modifytimer_handler
to support multiprocessorkernel/mem.c
Implementmmio_boot_region
,mem_init_mp
and modify page_init to support multiprocessor Modifycheck_page_free_list
,check_kern_pgdir
andcheck_page
to check new feature
In this lab, you will learn about process management, basic scheduling and system calls.
In our design, each process contains a page directory so that each of them can have full memory addressing space.
For each process, there are several attributes that are necessary for kernel to manage the process easily, you can reference kernel/task.h
for more detail.
Source Tree
kernel/*
: Includes all the file implementation needed by kernel only.
lib/*
: Includes libraries that should be in user space.
inc/*
: Header files for user.
user/*
: Files for user program.
boot/*
: Files for booting the kernel.
You can leverage grep
to find out where to fill up to finish this lab.
$ grep -R TODO .
To run this kernel
$ make
$ make qemu
To debug
$ make debug
Modifications to be made
lib/syscall.c
implement the interfaces of system calls for user program to use.kernel/task.h
to open interfaces of implementation of system calls forkernel/syscall.c
kernel/task.c
implementtask_create
,task_free
,sys_kill
,sys_fork
, andtask_init
kernel/syscall.c
implement system callskernel/trap_entry.S
implement trap handler interface for system callkernel/mem.c
implementsetupkvm
used by each process creationkernel/sched.c
implement schedulerkernel/timer.c
implement timer_handler to support sleep
In this lab, you will learn about memory management in x86.
You can leverage grep
to find out where to fill up to finish this lab.
$ grep -R TODO .
To run this kernel
$ make
$ qemu -hda kernel.img -monitor stdio
- Modify
kernel/mem.c
to implement the memory management functions - Modify
kernel/trap.c
andkernel/trap_entry.S
to setup IDT for pagefault
In this lab, you will learn about interrupt and segmentation mechanism in x86.
We provided you with keyboard handler, timer handler, and simple VGA driver.
You can leverage grep
to find out where to fill up to finish this lab.
$ grep -R TODO .
To run this kernel
$ make
$ qemu -hda kernel.img -monitor stdio
- Modify
boot/boot.S
to setup GDT - Modify
kernel/trap.c
andkernel/trap_entry.S
to setup IDT for keyboard and timer - Modify
kernel/main.c
to uncomment the setup process - Modify
kernel/shell.c
to supportkerninfo
andchgcolor
After this lab, you should know about how interrupt works and the working flow of GDT & IDT
This is forked and modified from MIT's Xv6