Skip to content

Commit e77b0a1

Browse files
committed
2 parents 07b35a2 + 79472f1 commit e77b0a1

File tree

5 files changed

+240
-231
lines changed

5 files changed

+240
-231
lines changed

Booting/linux-bootstrap-1.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,27 @@ PhysicalAddress = Segment * 16 + Offset
7272
得到的 `0xfffffff0` 是 4GB - 16 字节。 这个地方是 [复位向量(Reset vector)](http://en.wikipedia.org/wiki/Reset_vector) 。 这是CPU在重置后期望执行的第一条指令的内存地址。它包含一个 [jump](http://en.wikipedia.org/wiki/JMP_%28x86_instruction%29) 指令,这个指令通常指向BIOS入口点。举个例子,如果访问 [coreboot](http://www.coreboot.org/) 源代码,将看到:
7373

7474
```assembly
75-
.section ".reset"
75+
.section ".reset", "ax", %progbits
7676
.code16
77-
.globl reset_vector
78-
reset_vector:
77+
.globl _start
78+
_start:
7979
.byte 0xe9
80-
.int _start - ( . + 2 )
80+
.int _start16bit - ( . + 2 )
8181
...
8282
```
8383

84-
上面的跳转指令( [opcode](http://ref.x86asm.net/coder32.html#xE9) - 0xe9)跳转到地址 `_start - ( . + 2)` 去执行代码。 `reset` 段是16字节代码段, 起始于地址
85-
`0xfffffff0`,因此 CPU 复位之后,就会跳到这个地址来执行相应的代码 :
84+
上面的跳转指令( [opcode](http://ref.x86asm.net/coder32.html#xE9) - 0xe9)跳转到地址  `_start16bit - ( . + 2)` 去执行代码。 `reset` 段是 `16` 字节代码段, 起始于地址
85+
`0xfffffff0`(`src/cpu/x86/16bit/reset16.ld`),因此 CPU 复位之后,就会跳到这个地址来执行相应的代码 :
8686

8787
```
8888
SECTIONS {
89+
/* Trigger an error if I have an unuseable start address */
90+
_bogus = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report.");
8991
_ROMTOP = 0xfffffff0;
9092
. = _ROMTOP;
9193
.reset . : {
92-
*(.reset)
93-
. = 15 ;
94+
*(.reset);
95+
. = 15;
9496
BYTE(0x00);
9597
}
9698
}

0 commit comments

Comments
 (0)