From 5cc808e77f2a765ee9cea9c264d3208e50174f0f Mon Sep 17 00:00:00 2001 From: David Lee Date: Fri, 14 Jun 2019 13:04:40 +0800 Subject: [PATCH] Add some XV6 notes --- Notes/XV6/XV6FileSystem.md | 21 +++++++++++++++++++ Notes/XV6/XV6InterruptSyscall.md | 36 ++++++++++++++++++++++++++++++++ Notes/XV6/XV6Memory.md | 8 +++++++ Notes/XV6/XV6Synchronization.md | 25 ++++++++++++++++++++++ README.md | 8 +++---- 5 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 Notes/XV6/XV6FileSystem.md create mode 100644 Notes/XV6/XV6InterruptSyscall.md create mode 100644 Notes/XV6/XV6Memory.md create mode 100644 Notes/XV6/XV6Synchronization.md diff --git a/Notes/XV6/XV6FileSystem.md b/Notes/XV6/XV6FileSystem.md new file mode 100644 index 0000000..91627b6 --- /dev/null +++ b/Notes/XV6/XV6FileSystem.md @@ -0,0 +1,21 @@ +# XV6 Source Code Reading -- File System + +## Requirement + +Code to read + +* File system + * [ ] `buf.h` (p.38) + * [ ] `sleeplock.h` (p.39) + * [ ] `fcntl.h` (p.39) + * [ ] `stat.h` (p.40) + * [ ] `fs.h` (p.40) + * [ ] `file.h` (p.41) + * [ ] `ide.c` (p.42) + * [ ] `bio.c` (p.44) + * [ ] `sleeplock.c` (p.46) + * [ ] `log.c` (p.47) + * [ ] `fs.c` (p.49) + * [ ] `file.c` (p.58) + * [ ] `sysfile.c` (p.60) + * [ ] `exec.c` (p.66) diff --git a/Notes/XV6/XV6InterruptSyscall.md b/Notes/XV6/XV6InterruptSyscall.md new file mode 100644 index 0000000..44b6daa --- /dev/null +++ b/Notes/XV6/XV6InterruptSyscall.md @@ -0,0 +1,36 @@ +# XV6 Source Code Reading -- Interrupt and System Call + +## Requirement + +Code to read + +* Bootloader + * [ ] `bootasm.S` (p.91) + * [ ] `bootmain.c` (p.92) +* Entering xv6 + * [ ] `entry.S` (p.10) + * [ ] `entryother.S` (p.11) + * [ ] `main.c` (p.12) +* System calls (and interrupt) + * [ ] `traps.h` (p.32) + * [ ] `vectors.pl` (p.32) + * [ ] `trapasm.S` (p.33) + * [ ] `trap.c` (p.33) + * [ ] `syscall.h` (p.35) + * [ ] `syscall.c` (p.35) + * [ ] `sysproc.c` (p.37) + +## Resources + +### Instruction + +#### Interrupt + +* cli - Clear Interrupt Flag + * [x86 Instruction Set Reference - CLI](https://c9x.me/x86/html/file_module_x86_id_31.html) + * [CLI — Clear Interrupt Flag](https://www.felixcloutier.com/x86/cli) +* sti - Set Interrupt Flag + * [STI — Set Interrupt Flag](https://www.felixcloutier.com/x86/sti) +* int + * [INT n/INTO/INT3/INT1 — Call to Interrupt Procedure](https://www.felixcloutier.com/x86/intn:into:int3:int1) + * [wiki - INT (x86 instruction)](https://en.wikipedia.org/wiki/INT_(x86_instruction)) diff --git a/Notes/XV6/XV6Memory.md b/Notes/XV6/XV6Memory.md new file mode 100644 index 0000000..06934b0 --- /dev/null +++ b/Notes/XV6/XV6Memory.md @@ -0,0 +1,8 @@ +# XV6 Source Code Reading -- Memory + +## Requirement + +Code to read + +* [ ] `kalloc.c` (p.31) +* [ ] `vm.c` (p.17) diff --git a/Notes/XV6/XV6Synchronization.md b/Notes/XV6/XV6Synchronization.md new file mode 100644 index 0000000..28f1b65 --- /dev/null +++ b/Notes/XV6/XV6Synchronization.md @@ -0,0 +1,25 @@ +# XV6 Source Code Reading -- Synchronization + +## Requirement + +Code to read + +* Locks + * [ ] `spinlock.h` (p.15) + * [ ] `spinlock.c` (p.15) + +## Resources + +xchg + +* [XCHG — Exchange Register/Memory with Register](https://www.felixcloutier.com/x86/xchg) +* [X86組合語言/基本指令集/IA32指令:xchg](https://zh.wikibooks.org/zh-tw/X86%E7%B5%84%E5%90%88%E8%AA%9E%E8%A8%80/%E5%9F%BA%E6%9C%AC%E6%8C%87%E4%BB%A4%E9%9B%86/IA32%E6%8C%87%E4%BB%A4:xchg) + +### Implementation + +implement semaphore using spinlock + +implement readers-writer lock using spinlock + +* [Readers–writer lock - Implementation](https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Implementation) +* [How would you implement your own reader/writer lock in C++11?](https://stackoverflow.com/questions/12033188/how-would-you-implement-your-own-reader-writer-lock-in-c11) diff --git a/README.md b/README.md index c2312f7..43faaba 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,10 @@ PKU OS course project and notes based on Nachos and XV6. ### XV6 Source Code Reading 1. [Process and Thread (with Scheduling)](Notes/XV6/XV6ProcessThread.md) -2. Synchronization Mechanism -3. Interrupt and System Call -4. Memory Management -5. File System +2. [Synchronization Mechanism](Notes/XV6/XV6Synchronization.md) +3. [Interrupt and System Call](Notes/XV6/XV6InterruptSyscall.md) +4. [Memory Management](Notes/XV6/XV6Memory.md) +5. [File System](Notes/XV6/XV6FileSystem.md) ### Additional Task