|
|
|
/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
|
|
|
|
|
|
|
|
OUTPUT_FORMAT("elf32-i386")
|
|
|
|
OUTPUT_ARCH(i386)
|
|
|
|
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
KERNBASE = 0xf0000000;
|
|
|
|
|
|
|
|
SECTIONS {
|
|
|
|
. = CFG_KERN_ORIGIN;
|
|
|
|
|
|
|
|
_image_start = . + KERNBASE;
|
|
|
|
_image_start_phys = .;
|
|
|
|
_kernel_start = . + KERNBASE;
|
|
|
|
_kernel_start_phys = .;
|
|
|
|
|
|
|
|
.multiboot.data : {
|
|
|
|
. = ALIGN(8);
|
|
|
|
KEEP(*(.multiboot.data))
|
|
|
|
}
|
|
|
|
|
|
|
|
.multiboot.text : {
|
|
|
|
. = ALIGN(8);
|
|
|
|
KEEP(*(.multiboot.text))
|
|
|
|
}
|
|
|
|
|
|
|
|
. += KERNBASE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All sections from here on are page aligned so we can
|
|
|
|
* set different access permissions for each of them
|
|
|
|
*/
|
|
|
|
|
|
|
|
.text ALIGN(4K) : AT(ADDR(.text) - KERNBASE) {
|
|
|
|
_text_start = .;
|
|
|
|
/* put all ISRs into one contiguous region so the
|
|
|
|
* stack unwinder knows when to stop unwinding */
|
|
|
|
_isr_start = .;
|
|
|
|
KEEP(*(.text.isr))
|
|
|
|
_isr_end = .;
|
|
|
|
*(.text .text.* .gnu.linkonce.t.*)
|
|
|
|
_text_end = .;
|
|
|
|
}
|
|
|
|
|
|
|
|
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNBASE) {
|
|
|
|
_rodata_start = .;
|
|
|
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
|
|
|
_rodata_end = .;
|
|
|
|
}
|
|
|
|
|
|
|
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNBASE) {
|
|
|
|
_data_start = .;
|
|
|
|
*(.data .data.*)
|
|
|
|
_data_end = .;
|
|
|
|
}
|
|
|
|
|
|
|
|
_kernel_end = .;
|
|
|
|
_kernel_end_phys = . - KERNBASE;
|
|
|
|
|
|
|
|
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNBASE) {
|
|
|
|
_bss_start = .;
|
|
|
|
*(COMMON)
|
|
|
|
*(.bss)
|
|
|
|
_bss_end = .;
|
|
|
|
_start_start = .;
|
|
|
|
*(.bootstrap_stack)
|
|
|
|
_stack_end = .;
|
|
|
|
}
|
|
|
|
|
|
|
|
_image_end = .;
|
|
|
|
_image_end_phys = . - KERNBASE;
|
|
|
|
}
|