config: refactor kernel address mapping names
This commit is contained in:
parent
d066986994
commit
c3847487be
6 changed files with 21 additions and 23 deletions
arch/x86
cmake
include/gay
|
@ -37,7 +37,7 @@ enum vga_color {
|
|||
* entries per page table, each mapping 4096 (0x1000) bytes, this gives us an
|
||||
* offset of 0x3ff * 0x1000 = 0x003ff000 for the virtual address.
|
||||
*/
|
||||
#define FB_ADDRESS (CFG_KERNEL_RELOCATE + 0x003ff000)
|
||||
#define FB_ADDRESS (CFG_KERN_OFFSET + 0x003ff000)
|
||||
#define FB_LINES 24
|
||||
#define FB_COLS 80
|
||||
|
||||
|
@ -99,7 +99,7 @@ __asmlink void _boot(u32 magic, void *address) /* NOLINT */
|
|||
* so we need to be careful to translate all pointers to virtual
|
||||
* addresses before accessing them.
|
||||
*/
|
||||
address += CFG_KERNEL_RELOCATE;
|
||||
address += CFG_KERN_OFFSET;
|
||||
int err = 0;
|
||||
for (struct mb2_tag *tag = address + 8; tag != NULL; tag = next_tag(tag)) {
|
||||
err = handle_tag(tag);
|
||||
|
|
|
@ -112,7 +112,7 @@ header_end:
|
|||
* referencing symbols from C requires subtracting the relocation offset
|
||||
* first because the C code is linked against virtual address space
|
||||
*/
|
||||
#define phys_addr(c_symbol) (c_symbol - CFG_KERNEL_RELOCATE)
|
||||
#define phys_addr(c_symbol) (c_symbol - CFG_KERN_OFFSET)
|
||||
|
||||
ASM_ENTRY(_start)
|
||||
/* interrupts are disabled until we set up the IDT in x86_setup_idt() */
|
||||
|
@ -188,8 +188,8 @@ ASM_ENTRY(_start)
|
|||
* be calculated by dividing the number of the first page it maps
|
||||
* through the total number of entries in the page directory.
|
||||
*/
|
||||
movl $(phys_addr(pt0) + 0x003), phys_addr(pd0) + (( 0x00000000 / PAGE_SIZE) / 1024) * 4
|
||||
movl $(phys_addr(pt0) + 0x003), phys_addr(pd0) + ((CFG_KERNEL_RELOCATE / PAGE_SIZE) / 1024) * 4
|
||||
movl $(phys_addr(pt0) + 0x003), phys_addr(pd0) + (( 0x00000000 / PAGE_SIZE) / 1024) * 4
|
||||
movl $(phys_addr(pt0) + 0x003), phys_addr(pd0) + ((CFG_KERN_OFFSET / PAGE_SIZE) / 1024) * 4
|
||||
|
||||
/*
|
||||
* The last entry in the page directory points to itself.
|
||||
|
|
|
@ -7,11 +7,11 @@ OUTPUT_ARCH(i386)
|
|||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
. = KERNEL_ORIGIN;
|
||||
. = CFG_KERN_ORIGIN;
|
||||
|
||||
_image_start = . + KERNEL_RELOCATE;
|
||||
_image_start = . + CFG_KERN_OFFSET;
|
||||
_image_start_phys = .;
|
||||
_kernel_start = . + KERNEL_RELOCATE;
|
||||
_kernel_start = . + CFG_KERN_OFFSET;
|
||||
_kernel_start_phys = .;
|
||||
|
||||
.multiboot.data : {
|
||||
|
@ -24,35 +24,35 @@ SECTIONS {
|
|||
KEEP(*(.multiboot.text))
|
||||
}
|
||||
|
||||
. += KERNEL_RELOCATE;
|
||||
. += CFG_KERN_OFFSET;
|
||||
|
||||
/*
|
||||
* 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) - KERNEL_RELOCATE) {
|
||||
.text ALIGN(4K) : AT(ADDR(.text) - CFG_KERN_OFFSET) {
|
||||
_text_start = .;
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
_text_end = .;
|
||||
}
|
||||
|
||||
.rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_RELOCATE) {
|
||||
.rodata ALIGN(4K) : AT(ADDR(.rodata) - CFG_KERN_OFFSET) {
|
||||
_rodata_start = .;
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
_rodata_end = .;
|
||||
}
|
||||
|
||||
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_RELOCATE) {
|
||||
.data ALIGN(4K) : AT(ADDR(.data) - CFG_KERN_OFFSET) {
|
||||
_data_start = .;
|
||||
*(.data .data.*)
|
||||
_data_end = .;
|
||||
}
|
||||
|
||||
_kernel_end = .;
|
||||
_kernel_end_phys = . - KERNEL_RELOCATE;
|
||||
_kernel_end_phys = . - CFG_KERN_OFFSET;
|
||||
|
||||
.bss ALIGN(4K) : AT(ADDR(.bss) - KERNEL_RELOCATE) {
|
||||
.bss ALIGN(4K) : AT(ADDR(.bss) - CFG_KERN_OFFSET) {
|
||||
_bss_start = .;
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
|
@ -63,7 +63,7 @@ SECTIONS {
|
|||
}
|
||||
|
||||
_image_end = .;
|
||||
_image_end_phys = . - KERNEL_RELOCATE;
|
||||
_image_end_phys = . - CFG_KERN_OFFSET;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* See the end of this file for copyright and license terms. */
|
||||
|
||||
KERNEL_ORIGIN = @KERNEL_ORIGIN@;
|
||||
KERNEL_RELOCATE = @KERNEL_RELOCATE@;
|
||||
CFG_KERN_ORIGIN = @CFG_KERN_ORIGIN@;
|
||||
CFG_KERN_OFFSET = @CFG_KERN_OFFSET@;
|
||||
|
||||
/*
|
||||
* This file is part of GayBSD.
|
||||
|
|
|
@ -8,9 +8,9 @@ set_property(CACHE ARCH PROPERTY STRINGS
|
|||
)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/config-${ARCH}.cmake")
|
||||
|
||||
set(KERNEL_ORIGIN "0x100000" CACHE STRING "Physical address where the kernel is loaded (don't touch this)")
|
||||
set(CFG_KERN_ORIGIN "0x00100000" CACHE STRING "Physical address where the kernel is loaded (don't touch this)")
|
||||
|
||||
set(KERNEL_RELOCATE "0xc0000000" CACHE STRING "Virtual address the kernel is mapped to (don't touch this)")
|
||||
set(CFG_KERN_OFFSET "0xc0000000" CACHE STRING "Virtual address the kernel is mapped to (don't touch this)")
|
||||
|
||||
set(CFG_POISON_PAGES "Poison pages after allocate and free" ON)
|
||||
|
||||
|
@ -18,8 +18,6 @@ set(CFG_POISON_HEAP "Poison heap memory after kmalloc() and kfree()" ON)
|
|||
|
||||
set(CFG_DEBUG_IRQ "Debug IRQs" ON)
|
||||
|
||||
set(SCHED_MAX_TASKS "128" CACHE STRING "Maximum number of tasks")
|
||||
|
||||
# This file is part of GayBSD.
|
||||
# Copyright (c) 2021 fef <owo@fef.moe>.
|
||||
#
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
"@gaybsd_VERSION_MAJOR@.@gaybsd_VERSION_MINOR@.@gaybsd_VERSION_PATCH@@gaybsd_VERSION_SUFFIX@"
|
||||
|
||||
/** @brief Physical address where the kernel is loaded */
|
||||
#define CFG_KERNEL_ORIGIN @KERNEL_ORIGIN@
|
||||
#define CFG_KERN_ORIGIN @CFG_KERN_ORIGIN@
|
||||
|
||||
/** @brief Virtual address the kernel is mapped to */
|
||||
#define CFG_KERNEL_RELOCATE @KERNEL_RELOCATE@
|
||||
#define CFG_KERN_OFFSET @CFG_KERN_OFFSET@
|
||||
|
||||
/** @brief Poison dynamic pages when allocating and freeing them */
|
||||
#cmakedefine01 CFG_POISON_PAGES
|
||||
|
|
Loading…
Reference in a new issue