Rev 532 | Rev 602 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 532 | Rev 534 | ||
---|---|---|---|
1 | /** AMD64 linker script |
1 | /** AMD64 linker script |
2 | * |
2 | * |
3 | * umapped section: |
3 | * umapped section: |
4 | * kernel text |
4 | * kernel text |
5 | * kernel data |
5 | * kernel data |
6 | * mapped section: |
6 | * mapped section: |
7 | * kernel text |
7 | * kernel text |
8 | * kernel data |
8 | * kernel data |
9 | */ |
9 | */ |
10 | 10 | ||
11 | #define __ASM__ |
11 | #define __ASM__ |
12 | #include <arch/boot/boot.h> |
12 | #include <arch/boot/boot.h> |
13 | #include <arch/mm/page.h> |
13 | #include <arch/mm/page.h> |
14 | 14 | ||
15 | ENTRY(kernel_image_start) |
15 | ENTRY(kernel_image_start) |
16 | 16 | ||
17 | SECTIONS { |
17 | SECTIONS { |
18 | .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) { |
18 | .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) { |
19 | unmapped_ktext_start = .; |
19 | unmapped_ktext_start = .; |
20 | *(K_TEXT_START); |
20 | *(K_TEXT_START); |
21 | *(K_TEXT_START_2); |
21 | *(K_TEXT_START_2); |
22 | unmapped_ktext_end = .; |
22 | unmapped_ktext_end = .; |
23 | 23 | ||
24 | unmapped_kdata_start = .; |
24 | unmapped_kdata_start = .; |
25 | *(K_DATA_START); |
25 | *(K_DATA_START); |
26 | unmapped_kdata_end = .; |
26 | unmapped_kdata_end = .; |
27 | } |
27 | } |
28 | 28 | ||
29 | .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)) : AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { |
29 | .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)) : AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { |
30 | ktext_start = .; |
30 | ktext_start = .; |
31 | *(BOOT_DATA); |
31 | *(BOOT_DATA); |
32 | *(.text); |
32 | *(.text); |
33 | ktext_end = .; |
33 | ktext_end = .; |
34 | 34 | ||
35 | kdata_start = .; |
35 | kdata_start = .; |
36 | *(.data); /* initialized data */ |
36 | *(.data); /* initialized data */ |
37 | *(.rodata*); /* string literals */ |
37 | *(.rodata*); /* string literals */ |
38 | hardcoded_load_address = .; |
38 | hardcoded_load_address = .; |
39 | QUAD(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)); |
39 | QUAD(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)); |
40 | hardcoded_ktext_size = .; |
40 | hardcoded_ktext_size = .; |
41 | QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start)); |
41 | QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start)); |
42 | hardcoded_kdata_size = .; |
42 | hardcoded_kdata_size = .; |
43 | QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start)); |
43 | QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start)); |
44 | hardcoded_unmapped_ktext_size = .; |
44 | hardcoded_unmapped_ktext_size = .; |
45 | LONG(unmapped_ktext_end - unmapped_ktext_start); |
45 | LONG(unmapped_ktext_end - unmapped_ktext_start); |
46 | hardcoded_unmapped_kdata_size = .; |
46 | hardcoded_unmapped_kdata_size = .; |
47 | LONG(unmapped_kdata_end - unmapped_kdata_start); |
47 | LONG(unmapped_kdata_end - unmapped_kdata_start); |
48 | *(COMMON); /* global variables */ |
48 | *(COMMON); /* global variables */ |
49 | 49 | ||
50 | *(.eh_frame); |
50 | *(.eh_frame); |
51 | *(.bss); /* uninitialized static variables */ |
51 | *(.bss); /* uninitialized static variables */ |
52 | 52 | ||
53 | symbol_table = .; |
53 | symbol_table = .; |
54 | *(symtab.*); /* Symbol table, must be LAST symbol!*/ |
54 | *(symtab.*); /* Symbol table, must be LAST symbol!*/ |
55 | 55 | ||
56 | kdata_end = .; |
56 | kdata_end = .; |
57 | } |
57 | } |
58 | 58 | ||
59 | _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); |
59 | _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); |
60 | 60 | ||
61 | /* Symbols that need to be accessed both from real mode & long mode */ |
61 | /* Symbols that need to be accessed both from real mode & long mode */ |
62 | /* e820*_boot is real mode (pre-above-1MB-move), e820* is */ |
62 | /* e820*_boot is real mode (pre-above-1MB-move), e820* is */ |
63 | /* kernel mapped above-1MB-physical copied symbol */ |
63 | /* kernel mapped above-1MB-physical copied symbol */ |
64 | e820table_boot = KA2PA(e820table) - BOOT_OFFSET; |
64 | e820table_boot = KA2PA(e820table) - BOOT_OFFSET; |
65 | e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; |
65 | e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; |
66 | 66 | ||
67 | /* real_bootstrap_gdtr is mapped real_bootstrap_gdtr_boot */ |
67 | /* real_bootstrap_gdtr is mapped real_bootstrap_gdtr_boot */ |
68 | /* It is physically outside of kernel area, we have to access */ |
68 | /* It is physically outside of kernel area, we have to access */ |
69 | /* it after modification from long mode for booting */ |
69 | /* it after modification from long mode for booting */ |
70 | /* SMP slave processors */ |
70 | /* SMP slave processors */ |
71 | real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); |
71 | real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); |
72 | } |
72 | } |
73 | 73 |