冯诺伊曼模型
CPU 循环
Mainmemory 寻址
- EIP
- 寻址模式:
- Real mode 物理地址
- Protected mode 虚拟地址
- SMM (system management mode) 任何crash下都能运行
- IA-32 扩展更大内存
- Virtual-8086 兼容
- System flags
- Control registers
- CR3 物理地址
- CR2 page fault 出现的地址 linear address
- CR0
- PA -seg-> Logical address -page table-> linear address
- MMR (memory management register)
- GDTR
- IDTR
Memory
Memory model
- 8086 16-bit
- real mode
- Space: 64KB
- External address to 20-bit
- CS 16bit + IP 16bit
- CS code segment for EIP (CPU 只看CS)
- SS stack segment for SP and BP
- DS data segment for load/store
- ES data segment
- Space: 1MB
- CS 16bit + IP 16bit
- 80386 32-bit
- Now 64-bit
- Protected mode
- Boots in 16-bit real mode, switch to 32-bit protected mode
- 36-bit
- 物理地址 2^36 = 64G
- OS 4G 可以为不同的 application 映射不同的窗口
- Application 不能超过4G
- 64-bit
Physical address space layout
Memory-mapped I/O
I/O space 映射 memory space
Execution
XV6 booting code
PC emulation
Emulation of devices
- Hard disk -> file
- VGA -> host window
- Keyboard: keyboard API
- Clock chip: host's clock