Subversion Repositories HelenOS-historic

Rev

Rev 461 | Rev 532 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/** AMD64 linker script
 *  
 * umapped section:
 *  kernel text
 *  kernel data
 * mapped section:
 *  kernel text
 *  kernel data 
 */

#define __ASM__
#include <arch/boot/boot.h>
#include <arch/mm/page.h>

ENTRY(kernel_image_start)

SECTIONS {
    .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) {
        unmapped_ktext_start = .;
        *(K_TEXT_START);
        *(K_TEXT_START_2);
        unmapped_ktext_end = .;

        unmapped_kdata_start = .;
        *(K_DATA_START);
        unmapped_kdata_end = .;
    }

    .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)) : AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) {
        ktext_start = .;
        *(BOOT_DATA);
        *(.text);
        ktext_end = .;

        kdata_start = .;
        *(.data);       /* initialized data */
        *(.rodata*);        /* string literals */
        hardcoded_load_address = .;
        QUAD(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET));
        hardcoded_ktext_size = .;
        QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
        hardcoded_kdata_size = .;
        QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
        hardcoded_unmapped_ktext_size = .;
        LONG(unmapped_ktext_end - unmapped_ktext_start);
        hardcoded_unmapped_kdata_size = .;
        LONG(unmapped_kdata_end - unmapped_kdata_start);
        *(COMMON);      /* global variables */

        *(.eh_frame);
        *(.bss);        /* uninitialized static variables */

        symbol_table = .;
        *(symtab.*);            /* Symbol table, must be LAST symbol!*/

        kdata_end = .;
    }

    _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);

    /* Symbols that need to be accessed both from real mode & long mode */
    /* e820*_boot is real mode (pre-above-1MB-move), e820* is */
    /* kernel mapped above-1MB-physical copied symbol */
    e820table_boot = KA2PA(e820table) - BOOT_OFFSET;
    e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET;

    /* real_bootstrap_gdtr is mapped real_bootstrap_gdtr_boot */
    /* It is physically outside of kernel area, we have to access */
    /* it after modification from long mode for booting */
    /* SMP slave processors */
    real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot);
}