forked from rust-osdev/bootloader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
linker.ld
53 lines (47 loc) · 1 KB
/
linker.ld
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
53
ENTRY(_start)
SECTIONS {
. = 0x500;
/* buffer for loading the kernel */
_kernel_buffer = .;
. += 512;
/* page tables */
. = ALIGN(0x1000);
__page_table_start = .;
_p4 = .;
. += 0x1000;
_p3 = .;
. += 0x1000;
_p2 = .;
. += 0x1000;
_p1 = .;
. += 0x1000;
__page_table_end = .;
__bootloader_start = .;
_memory_map = .;
. += 0x1000;
_stack_start = .;
. = 0x7c00;
_stack_end = .;
.bootloader :
{
/* first stage */
*(.boot)
/* second stage */
_second_stage_start_addr = .;
*(.second_stage)
*(.context_switch)
*(.text .text.*)
*(.rodata .rodata.*)
*(.data .data.*)
. = ALIGN(512);
_second_stage_end_addr = .;
}
_kernel_info_block_start = .;
_kib_kernel_size = .;
. += 8;
_kib_package_size = .;
. += 512 - 8; /* kernel info block */
_kernel_info_block_end = .;
__bootloader_end = .;
_kernel_start_addr = .;
}