Subversion Repositories HelenOS

Rev

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

/** IA-32 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 */
        *(COMMON);          /* global variables */
        hardcoded_load_address = .;
        LONG(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET));
        hardcoded_ktext_size = .;
        LONG((ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start));
        hardcoded_kdata_size = .;
        LONG((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);
        symbol_table = .;
        *(symtab.*);                /* Symbol table, must be LAST symbol! */
        *(.bss);            /* uninitialized static variables */
        kdata_end = .;
    }

    /DISCARD/ : {
        *(.note.GNU-stack);     
        *(.comment);
    }

    
    _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);
    _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start);
    
    e820table_boot = KA2PA(e820table) - BOOT_OFFSET;
    e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET;
    real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot);
}