You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.4 KiB
Plaintext

/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
OUTPUT_FORMAT("elf64-x86-64")
ENTRY(_start)
KERNBASE = 0xffffffff80000000; /* -2 GB */
PAGE_SIZE = 4K;
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(PAGE_SIZE) : 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(PAGE_SIZE) : AT(ADDR(.rodata) - KERNBASE) {
_rodata_start = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
_rodata_end = .;
}
.data ALIGN(PAGE_SIZE) : AT(ADDR(.data) - KERNBASE) {
_data_start = .;
*(.data .data.*)
_data_end = .;
}
_kernel_end = .;
_kernel_end_phys = . - KERNBASE;
.bss ALIGN(PAGE_SIZE) : AT(ADDR(.bss) - KERNBASE) {
_bss_start = .;
*(COMMON)
*(.bss)
_bss_end = .;
. = ALIGN(8);
*(.bootstrap_stack)
}
_image_end = .;
_image_end_phys = . - KERNBASE;
}