forked from Dahuage/Grenouille
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestions
52 lines (39 loc) · 1.95 KB
/
questions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#1. cons_init中分别初始化键盘,cga,com1.对于com1与键盘,初始化工作完成后分别调用了
pic_enable(IRQ_KBD), pic_enable(IRP_COM1).但是此时pic本身尚未初始化。如
代码所示。
```C
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static void
pic_setmask(uint16_t mask) {
irq_mask = mask;
//did_init == 0!!!!!
if (did_init) {
outb(IO_PIC1 + 1, mask);
outb(IO_PIC2 + 1, mask >> 8);
}
}
void
pic_enable(unsigned int irq) {
pic_setmask(irq_mask & ~(1 << irq));
}
```
那么问题来了。这个初始化是成功的还是失败的?若是成功的?为什么。若是失败的?在什么
地方做了补救?
答: 初始化是成功。
因为,仔细观察picirq.c代码。代码巧妙的一逼!
各种硬件初始化中注册irq的代码,并没有实际进行注册。
而是修改了静态数据区中iqr的掩码。
在irq_init中,载入了最终的掩码。mission success!
#2. vag与键盘is necessary。com1、lpt及串口什么鬼?necessary?
重构时处理
#3. ucore 用bios int 0x15探测到物理内存空间大小
```shell dmesg可得到物理内存可用状况。
1 [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
2 [ 0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009ffff] reserved
3 [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
4 [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000efffffff] usable
5 [ 0.000000] BIOS-e820: [mem 0x00000000fc000000-0x00000000ffffffff] reserved
6 [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000040fffffff] usable
---------------------------------------------------------------------------------
```
#4. 为什么把要把虚拟空间的0-4M, KERNEL_BASE-KERNELBASE+4M映射到物理地址的0-4M?