Rev 337 | Rev 406 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
65 | decky | 1 | /** IA-32 linker script |
1 | jermar | 2 | * |
105 | jermar | 3 | * umapped section: |
4 | * kernel text |
||
5 | * kernel data |
||
6 | * mapped section: |
||
7 | * kernel text |
||
8 | * kernel data |
||
1 | jermar | 9 | */ |
10 | |||
301 | palkovsky | 11 | #define __ASM__ |
12 | #include <arch/boot/boot.h> |
||
13 | #include <arch/mm/page.h> |
||
14 | |||
1 | jermar | 15 | OUTPUT_FORMAT(binary) |
16 | ENTRY(kernel_image_start) |
||
17 | |||
18 | SECTIONS { |
||
301 | palkovsky | 19 | .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) { |
106 | jermar | 20 | unmapped_ktext_start = .; |
21 | *(K_TEXT_START); |
||
110 | jermar | 22 | *(K_TEXT_START_2); |
106 | jermar | 23 | unmapped_ktext_end = .; |
381 | jermar | 24 | |
106 | jermar | 25 | unmapped_kdata_start = .; |
26 | *(K_DATA_START); |
||
27 | unmapped_kdata_end = .; |
||
381 | jermar | 28 | |
29 | LONG(0xdeadbeaf); /* TODO: remove 0xdeadbeaf */ |
||
106 | jermar | 30 | } |
267 | decky | 31 | |
301 | palkovsky | 32 | .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { |
106 | jermar | 33 | ktext_start = .; |
328 | jermar | 34 | *(BOOT_DATA); |
106 | jermar | 35 | *(.text); |
36 | ktext_end = .; |
||
267 | decky | 37 | |
106 | jermar | 38 | kdata_start = .; |
334 | jermar | 39 | *(.data); /* initialized data */ |
40 | *(.rodata*); /* string literals */ |
||
41 | *(COMMON); /* global variables */ |
||
216 | palkovsky | 42 | hardcoded_load_address = .; |
301 | palkovsky | 43 | LONG(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)); |
216 | palkovsky | 44 | hardcoded_ktext_size = .; |
328 | jermar | 45 | LONG((ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start)); |
216 | palkovsky | 46 | hardcoded_kdata_size = .; |
328 | jermar | 47 | LONG((kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start)); |
267 | decky | 48 | hardcoded_unmapped_ktext_size = .; |
49 | LONG(unmapped_ktext_end - unmapped_ktext_start); |
||
50 | hardcoded_unmapped_kdata_size = .; |
||
51 | LONG(unmapped_kdata_end - unmapped_kdata_start); |
||
334 | jermar | 52 | *(.bss); /* uninitialized static variables */ |
268 | palkovsky | 53 | symbol_table = .; |
334 | jermar | 54 | *(symtab.*); /* Symbol table, must be LAST symbol! */ |
268 | palkovsky | 55 | |
106 | jermar | 56 | kdata_end = .; |
57 | } |
||
381 | jermar | 58 | |
59 | /DISCARD/ : { |
||
60 | *(.note.GNU-stack); |
||
61 | *(.comment); |
||
62 | } |
||
63 | |||
235 | decky | 64 | |
65 | _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); |
||
285 | decky | 66 | _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start); |
267 | decky | 67 | |
301 | palkovsky | 68 | e820table_boot = KA2PA(e820table) - BOOT_OFFSET; |
69 | e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; |
||
70 | real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); |
||
1 | jermar | 71 | } |