终于又开始了,不求速度,但求理解的透彻。目标成为内核 hanker
http://pdos.csail.mit.edu/6.828/2009/
Part 1: PC Bootstrap
Getting Started with x86 assembly
reference:Computer Systems A Programmer's Perspective Chapter 3 (19:32--14:51)
Inline Assembly
在没有 overwrite-list 是 编译器默认使用%eax存储 a;
当overwrite-list 显示说明%eax时,说明%eax 会再嵌入式汇编这段代码改写。说以编译器不会采用eax 来存放a 的值。
"you can no longer count on the valuesyou loaded into eax to be valid."
以上输出均为 “2”
Simulating the x86
1.QEMU 安装成功
Exercise 2.
初始化顺序:
Slave DMA controller Master DMA controller NMI Enable / Real Time Clock 关中断 拷贝中断向量表 (不能确定) it sets up an interrupt descriptor table initializes various devices such as the VGA display initializing the PCI bus and all the important devices the BIOS knows about it searches for a bootable device Eventually, when it finds a bootable disk, the BIOS reads the boot loader from the disk and transfers control to i BootLoader QUESTION 1: bootloader 做什么? //myself 内核放到启动位置 real mod -> protection mod Because it is only in this mode that software can access all the memory above 1MB in the processor's physical address space. 1: real mod -> protection mod 为什么 Segment limit 共20 位? 如果G设为1时,limit scaled by 4k when set . 假如 base 为0x00000000 ,limit 为 0x00000 那么段地址空间为:0x0000000~0x00000FFF 不为空。