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.hKernel-private definitions for multiprocessor supportkern/mpconfig.cCode to read the multiprocessor configurationkern/mpentry.SAssembly-language entry code for non-boot CPUskern/spinlock.hKernel-private definitions for spin locks, including the big kernel lockkern/spinlock.cKernel code implementing spin lockskern/lapic.cKernel code driving the local APIC unit in each processor
Modifications to be made
inc/syscall.hImplementget_cidkernel/main.cImplementboot_apsandmp_mainto support multiprocessorkernel/task.cImplementtask_init_percpuand modify variable cur_task, functionssys_forksys_killto support multiprocessorkernel/syscall.cImplementget_cidkernel/sched.cModify scheduler to support multiprocessorkernel/timer.cModifytimer_handlerto support multiprocessorkernel/mem.cImplementmmio_boot_region,mem_init_mpand modify page_init to support multiprocessor Modifycheck_page_free_list,check_kern_pgdirandcheck_pageto 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.cimplement the interfaces of system calls for user program to use.kernel/task.hto open interfaces of implementation of system calls forkernel/syscall.ckernel/task.cimplementtask_create,task_free,sys_kill,sys_fork, andtask_initkernel/syscall.cimplement system callskernel/trap_entry.Simplement trap handler interface for system callkernel/mem.cimplementsetupkvmused by each process creationkernel/sched.cimplement schedulerkernel/timer.cimplement 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.cto implement the memory management functions - Modify
kernel/trap.candkernel/trap_entry.Sto 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.Sto setup GDT - Modify
kernel/trap.candkernel/trap_entry.Sto setup IDT for keyboard and timer - Modify
kernel/main.cto uncomment the setup process - Modify
kernel/shell.cto supportkerninfoandchgcolor
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