[MIT 6.S081 Fall 2020] Lab: networking
xv6
https://pdos.csail.mit.edu/6.S081/2020/labs/net.htmlRead in Github/* kernel/e1000.c */// struct spinlock e1000_lock;struct spinlock e1000_tx_lock;struct spinlock e1000_rx_lock;/* kernel/e1000.c */void e1000_init(uint32 *xregs) { int i; // initlock(&e1000_lock, "e1000"); initlock(&e1000_tx_lock, "e1000_tx"); initlock(&e1000_rx_lock, "e1000_rx");...}/* kernel/e1000.c */int e1000_transm..
[MIT 6.S081 Fall 2020] Lab: mmap
xv6
https://pdos.csail.mit.edu/6.S081/2020/labs/mmap.htmlRead in GithubMakefile에 mmaptest를 추가한다.# MakefileUPROGS=\... $U/_mmaptest\mmap과 munmap system call에 필요한 선언과 정의들을 추가한다./* kernel/syscall.h */// System call numbers...#define SYS_mmap 22#define SYS_munmap 23/* kernel/syscall.c */...extern uint64 sys_mmap(void);extern uint64 sys_munmap(void);static uint64 (*syscalls[])(void) = {... [SYS_mma..
[MIT 6.S081 Fall 2020] Lab: file system
xv6
https://pdos.csail.mit.edu/6.S081/2020/labs/fs.htmlRead in GithubLarge filesstruct dinode의 addrs에서 원래 direct block 12개, indirect block 1개였던 것을 direct block 11개, indirect block 2개로 바꿔야 하므로, NDIRECT, struct dinode, struct inode의 정의를 수정한다./* kernel/fs.h */// #define NDIRECT 12#define NDIRECT 11...// On-disk inode structurestruct dinode {... // uint addrs[NDIRECT + 1]; // Data block addresses ..
[MIT 6.S081 Fall 2020] Lab: locks
xv6
https://pdos.csail.mit.edu/6.S081/2020/labs/lock.htmlRead in GithubMemory allocatorkmem을 CPU의 개수(NCPU)만큼의 element들을 갖는 배열로 수정한다./* kernel/kalloc.c */struct { struct spinlock lock; struct run *freelist;} kmem[NCPU];CPU마다 lock name을 다르게 만들어야 하므로, kmem 구조체에 lockname을 추가한다./* kernel/kalloc.c */#define LOCKNAME_MAX 0x10struct { struct spinlock lock; char lockname[LOCKNAME_MAX]; struct ..
[MIT 6.S081 Fall 2020] Lab: Multithreading
xv6
https://pdos.csail.mit.edu/6.S081/2020/labs/thread.htmlRead in GithubUthread: switching between threadsthread 구조체에 레지스터를 저장할 공간과 thread가 참조할 함수 포인터를 추가한다./* user/uthread.c */struct reg { uint64 ra; uint64 sp; uint64 s0; uint64 s1; uint64 s2; uint64 s3; uint64 s4; uint64 s5; uint64 s6; uint64 s7; uint64 s8; uint64 s9; uint64 s10; uint64 s11;};struct threa..
h0meb0dy_
'xv6' 카테고리의 글 목록