Rev 381 | Rev 457 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 381 | Rev 406 | ||
---|---|---|---|
1 | /** IA-32 linker script |
1 | /** IA-32 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 | OUTPUT_FORMAT(binary) |
15 | OUTPUT_FORMAT(binary) |
16 | ENTRY(kernel_image_start) |
16 | ENTRY(kernel_image_start) |
17 | 17 | ||
18 | SECTIONS { |
18 | SECTIONS { |
19 | .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) { |
19 | .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) { |
20 | unmapped_ktext_start = .; |
20 | unmapped_ktext_start = .; |
21 | *(K_TEXT_START); |
21 | *(K_TEXT_START); |
22 | *(K_TEXT_START_2); |
22 | *(K_TEXT_START_2); |
23 | unmapped_ktext_end = .; |
23 | unmapped_ktext_end = .; |
24 | 24 | ||
25 | unmapped_kdata_start = .; |
25 | unmapped_kdata_start = .; |
26 | *(K_DATA_START); |
26 | *(K_DATA_START); |
27 | unmapped_kdata_end = .; |
27 | unmapped_kdata_end = .; |
28 | - | ||
29 | LONG(0xdeadbeaf); /* TODO: remove 0xdeadbeaf */ |
- | |
30 | } |
28 | } |
31 | 29 | ||
32 | .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { |
30 | .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { |
33 | ktext_start = .; |
31 | ktext_start = .; |
34 | *(BOOT_DATA); |
32 | *(BOOT_DATA); |
35 | *(.text); |
33 | *(.text); |
36 | ktext_end = .; |
34 | ktext_end = .; |
37 | 35 | ||
38 | kdata_start = .; |
36 | kdata_start = .; |
39 | *(.data); /* initialized data */ |
37 | *(.data); /* initialized data */ |
40 | *(.rodata*); /* string literals */ |
38 | *(.rodata*); /* string literals */ |
41 | *(COMMON); /* global variables */ |
39 | *(COMMON); /* global variables */ |
42 | hardcoded_load_address = .; |
40 | hardcoded_load_address = .; |
43 | LONG(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)); |
41 | LONG(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)); |
44 | hardcoded_ktext_size = .; |
42 | hardcoded_ktext_size = .; |
45 | LONG((ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start)); |
43 | LONG((ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start)); |
46 | hardcoded_kdata_size = .; |
44 | hardcoded_kdata_size = .; |
47 | LONG((kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start)); |
45 | LONG((kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start)); |
48 | hardcoded_unmapped_ktext_size = .; |
46 | hardcoded_unmapped_ktext_size = .; |
49 | LONG(unmapped_ktext_end - unmapped_ktext_start); |
47 | LONG(unmapped_ktext_end - unmapped_ktext_start); |
50 | hardcoded_unmapped_kdata_size = .; |
48 | hardcoded_unmapped_kdata_size = .; |
51 | LONG(unmapped_kdata_end - unmapped_kdata_start); |
49 | LONG(unmapped_kdata_end - unmapped_kdata_start); |
52 | *(.bss); /* uninitialized static variables */ |
50 | *(.bss); /* uninitialized static variables */ |
53 | symbol_table = .; |
51 | symbol_table = .; |
54 | *(symtab.*); /* Symbol table, must be LAST symbol! */ |
52 | *(symtab.*); /* Symbol table, must be LAST symbol! */ |
55 | 53 | ||
56 | kdata_end = .; |
54 | kdata_end = .; |
57 | } |
55 | } |
58 | 56 | ||
59 | /DISCARD/ : { |
57 | /DISCARD/ : { |
60 | *(.note.GNU-stack); |
58 | *(.note.GNU-stack); |
61 | *(.comment); |
59 | *(.comment); |
62 | } |
60 | } |
63 | 61 | ||
64 | 62 | ||
65 | _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); |
63 | _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); |
66 | _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start); |
64 | _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start); |
67 | 65 | ||
68 | e820table_boot = KA2PA(e820table) - BOOT_OFFSET; |
66 | e820table_boot = KA2PA(e820table) - BOOT_OFFSET; |
69 | e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; |
67 | e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; |
70 | real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); |
68 | real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); |
71 | } |
69 | } |
72 | 70 |