summaryrefslogtreecommitdiff
path: root/core/syslinux.ld
diff options
context:
space:
mode:
Diffstat (limited to 'core/syslinux.ld')
-rw-r--r--core/syslinux.ld182
1 files changed, 140 insertions, 42 deletions
diff --git a/core/syslinux.ld b/core/syslinux.ld
index c1da230e..9149b9b4 100644
--- a/core/syslinux.ld
+++ b/core/syslinux.ld
@@ -20,7 +20,8 @@ OUTPUT_ARCH(i386)
EXTERN(_start)
ENTRY(_start)
-STACK_LEN = 4096;
+STACK16_LEN = 4096;
+STACK32_LEN = 8192;
SECTIONS
{
@@ -35,15 +36,16 @@ SECTIONS
__earlybss_len = __earlybss_end - __earlybss_start;
__earlybss_dwords = (__earlybss_len + 3) >> 2;
- .bss : {
- __bss_start = .;
- *(.bss)
- *(.bss2)
- __bss_end = .;
+ . = ALIGN(4);
+ .bss16 : {
+ __bss16_start = .;
+ *(.bss16)
+ __bss16_end = .;
}
- __bss_len = __bss_end - __bss_start;
- __bss_dwords = (__bss_len + 3) >> 2;
+ __bss16_len = __bss16_end - __bss16_start;
+ __bss16_dwords = (__bss16_len + 3) >> 2;
+ . = ALIGN(4);
.config : AT (__config_lma) {
__config_start = .;
*(.config)
@@ -61,29 +63,52 @@ SECTIONS
__replacestub_len = __replacestub_end - __replacestub_start;
__replacestub_dwords = (__replacestub_len + 3) >> 2;
- /* Stack */
+ /* 16-bit stack */
- STACK_BASE = 0x7c00 - STACK_LEN;
- . = STACK_BASE;
- .stack : AT(STACK_BASE) {
- __stack_start = .;
- . += STACK_LEN;
- __stack_end = .;
+ STACK16_BASE = 0x7c00 - STACK16_LEN;
+ . = STACK16_BASE;
+ .stack16 : AT(STACK16_BASE) {
+ __stack16_start = .;
+ . += STACK16_LEN;
+ __stack16_end = .;
}
- __stack_len = __stack_end - __stack_start;
- __stack_dwords = (__stack_len + 3) >> 2;
+ __stack16_len = __stack16_end - __stack16_start;
+ __stack16_dwords = (__stack16_len + 3) >> 2;
/* Initialized sections */
. = 0x7c00;
- .text : {
+ .init : {
FILL(0x90909090)
- __text_start = .;
- *(.text)
- __text_end = .;
+ __init_start = .;
+ *(.init)
+ __init_end = .;
}
- __text_len = __text_end - __text_start;
- __text_dwords = (__text_len + 3) >> 2;
+ __init_len = __init_end - __init_start;
+ __init_dwords = (__init_len + 3) >> 2;
+
+ .text16 : {
+ FILL(0x90909090)
+ __text16_start = .;
+ *(.text16)
+ __text16_end = .;
+ }
+ __text16_len = __text16_end - __text16_start;
+ __text16_dwords = (__text16_len + 3) >> 2;
+
+ /*
+ * .textnr is used for 32-bit code that is used on the code
+ * path to initialize the .text segment
+ */
+ . = ALIGN(16);
+ .textnr : {
+ FILL(0x90909090)
+ __textnr_start = .;
+ *(.textnr)
+ __textnr_end = .;
+ }
+ __textnr_len = __textnr_end - __textnr_start;
+ __textnr_dwords = (__textnr_len + 3) >> 2;
. = ALIGN(16);
.bcopyxx : {
@@ -96,13 +121,13 @@ SECTIONS
__bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
. = ALIGN(4);
- .data : {
- __data_start = .;
- *(.data)
- __data_end = .;
+ .data16 : {
+ __data16_start = .;
+ *(.data16)
+ __data16_end = .;
}
- __data_len = __data_end - __data_start;
- __data_dwords = (__data_len + 3) >> 2;
+ __data16_len = __data16_end - __data16_start;
+ __data16_dwords = (__data16_len + 3) >> 2;
. = ALIGN(4);
__config_lma = .;
@@ -112,10 +137,13 @@ SECTIONS
__replacestub_lma = .;
. += SIZEOF(.replacestub);
- /* ADV, must be the last intialized section */
+ /* The 32-bit code loads above the non-progbits sections */
+
+ . = ALIGN(16);
+ __pm_code_lma = .;
. = ALIGN(512);
- .adv : {
+ .adv (NOLOAD) : {
__adv_start = .;
*(.adv)
__adv_end = .;
@@ -125,7 +153,8 @@ SECTIONS
/* Late uninitialized sections */
- .uibss : {
+ . = ALIGN(4);
+ .uibss (NOLOAD) : {
__uibss_start = .;
*(.uibss)
__uibss_end = .;
@@ -133,18 +162,87 @@ SECTIONS
__uibss_len = __uibss_end - __uibss_start;
__uibss_dwords = (__uibss_len + 3) >> 2;
- .bss1 : {
- __bss1_start = .;
- *(.bss1)
- __bss1_end = .;
+ _end16 = .;
+ __assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow");
+
+ /*
+ * The auxilliary data segment is allowed to spill out of the
+ * low 64K.
+ */
+
+ . = ALIGN(16);
+ .auxseg (NOLOAD) : {
+ __auxseg_start = .;
+ *(.auxseg)
+ __auxseg_end = .;
+ }
+ __auxseg_len = __auxseg_end - __auxseg_start;
+ __auxseg_dwords = (__auxseg_len + 3) >> 2;
+ aux_seg = __auxseg_start >> 4;
+
+ /*
+ * 32-bit code. This is a hack for the moment due to the
+ * real-mode segments also allocated.
+ */
+
+ . = ALIGN(128);
+
+ __pm_code_start = .;
+
+ __text_vma = .;
+ __text_lma = __pm_code_lma;
+ .text : AT(__text_lma) {
+ __text_start = .;
+ *(.text)
+ __text_end = .;
+ }
+
+ . = ALIGN(16);
+
+ __rodata_vma = .;
+ __rodata_lma = __rodata_vma + __text_lma - __text_vma;
+ .rodata : AT(__rodata_lma) {
+ __rodata_start = .;
+ *(.rodata)
+ __rodata_end = .;
+ }
+
+ . = ALIGN(16);
+
+ __data_vma = .;
+ __data_lma = __data_vma + __text_lma - __text_vma;
+ .data : AT(__data_lma) {
+ __data_start = .;
+ *(.data)
+ __data_end = .;
+ }
+
+ __pm_code_end = .;
+ __pm_code_len = __pm_code_end - __pm_code_start;
+ __pm_code_dwords = (__pm_code_len + 3) >> 2;
+
+ . = ALIGN(128);
+
+ __bss_vma = .;
+ .bss : AT (__bss_vma) {
+ __bss_start = .;
+ *(.bss)
+ __bss_end = .;
}
- __bss1_len = __bss1_end - __bss1_start;
- __bss1_dwords = (__bss1_len + 3) >> 2;
+ __bss_len = __bss_end - __bss_start;
+ __bss_dwords = (__bss_len + 3) >> 2;
- . = ASSERT(__bss1_end <= 0x10000, "64K overflow");
+ . = ALIGN(128);
- . = 0x100000;
- .com32 : {
- *(.com32)
+ __stack_vma = .;
+ .stack : AT(__stack_vma) {
+ __stack_start = .;
+ . += STACK32_LEN;
+ __stack_end = .;
}
+ __stack_len = __stack_end - __stack_start;
+ __stack_dwords = (__stack_len + 3) >> 2;
+
+ _end = .;
+ __assert_end = ASSERT(_end <= 0x20000, "pm_code_seg overflow");
}