pintos学习笔记0
今天看了一点点的pintos,做了半道网易的运营的题目
打算写一点计划出来:
- 每天三道lintcode上面的题目
- 要看书(网络)
Loading
Loader
- BIOS加载Loader(MBR)
- 预留64字节给分区表
- 128字节给内核命令行参数
- Loader读分区表找到内核
- 找到可启动内核分区
- 从分区读入内存128kB(或许更多,但是BIOS不提供超过1MB的大小)
- 找到入口(内核的BLF header有个指针指向入口)
- Loader跳去入口
- 每次运行内核时插入参数
Low-Level Kernel Initialization
入口 start() in threads/start.S
start()
- 获取机器的内存
- 启用A20 line,做64M的内存映射(看不太懂)
- call main()
High-Level Kernel Initialization
调用main()
- call bss_init() - 清理BSS(被清为0的字段的传统名:在函数外未提供初始化的变量声明,variable goes into the BSS?)
- call read_command_line() - break the kernel command line into arguments
- call parse_options() - read any options at the beginning of the command line
- call thread_init() - 因为要用锁,所以就初始化
- initialize the console and print a startup message to the console
- call palloc_init() - initialize memory system by setting up the kernel page allocator
- call molloc_init() - sets up the allocator that handles allocations of arbitrary-size blocks of memory
- call paging_init() - sets up a page table for the kernel
- 在第二节后面还有tss和gdt的初始化
- call intr_init() - sets up the CPU’s interrupt descriptor table (IDT) to ready it for interrupt handling
- call timer_init() - handling timer interrupt
- call kbd_init() - handling keyboard interrupt
- call input_init() - sets up to merge serial and keyboard input into one stream
- 在第二节后面还有用户程序的初始化exception_init() and syscall_init().
- start the scheduler with thread_start(),call serial_init_queue() to switch to interrupt-driven serial port I/O
- call timer_calibrate()
- call ide_init() and filesys_init() to initialize the IDE disks and file system
Boot is complete.