This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
forked from swetland/xv6
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
tyfkda edited this page Sep 9, 2018
·
18 revisions
- Block size(
BSIZE
): 512B - inodestart = 32, ninodes = 200
- inode info: 0x4000~ (= inodestart * BSIZE)
- bmapstart: 57, size=1 (= FSSIZE / (BSIZE * 8) + 1)
- freeblock: 58~
- bootasm.S
- bootmain.c: bootmain()
- entry.S
- main.c: main()
- proc.c: userinit() -> Spawn "initcode" proc
- main.c: mpmain()
- proc.c: scheduler()
- initcode.S
- init.c: main() -> Exec "sh" (Loop forever)
- sh.c: main() : Shell process
- Timer interrupt (100ms)
- trap.c
trap()
,case T_IRQ0 + IRQ_TIMER:
- proc.c
yield()
- proc.c
shed()
- swtch.S
swtch
Kernel:
- sysfile.c: sys_write()
- file.c: filewrite()
- fs.c: writei() =>
return devsw[ip->major].write(ip, src, n);
- console.c: consoleinit() =>
devsw[1].write = consolewrite
- console.c: consoleinit() =>
- console.c: consolewrite()
- console.c: consputc()
- uart.c: uartputc()
- console.c: cgaputc()
Creation:
- User space:
- usys.S: pipe(int*)
- Kernel space:
- vectors.S: vector64 (T_SYSCALL=64)
- trapasm.S: alltraps
- trap.c: trap()
- syscall.c: syscall()
- sysfile.c: sys_pipe()
- pipe.c: pipealloc()
- filealloc x 2, 1 for read, 1 for write
- kalloc x 1, used to keep pipe struct.
Write:
- sysfile.c: sys_write()
- file.c: filewrite()
- pipe.c: pipewrite()
Read:
- sysfile.c: sys_read()
- file.c: fileread()
- pipe.c: piperead()
- Sleep/wakeup mechanism
- Fork/exec mechanism
- Support
>>
in shell- Add file append mode
- Add mtime to file info
- RTC
- Analyze ELF execution sequence (How to allocate memory, etc.)
- Use .text, .rodata, .data, .bss sections
- POSIX
$ memmap
execelf: /bin/memmap
vaddr=0, memsz=2908, filesz=18d1, sz=2908
sz=2908
sp=5000
main: 0x0
bss: 0x18e0
const_data: 0x1800
rw_data: 0x13e0
stack: 0x4f6c
sbrk: 0x5000
Address | Entity |
---|---|
0x80100000- | Kernel program |
.