From 703c08acc1e76eba21f2d4d3edefff04fb6c2703 Mon Sep 17 00:00:00 2001 From: Axel Heider Date: Thu, 25 Jan 2024 14:47:30 +0100 Subject: [PATCH] remove PADDR_BASE --- include/arch/arm/arch/32/mode/hardware.h | 2 +- include/hardware.h | 4 ++-- src/arch/arm/64/kernel/vspace.c | 4 ++-- src/arch/riscv/kernel/vspace.c | 4 ++-- src/arch/x86/32/kernel/vspace.c | 2 +- src/arch/x86/32/kernel/vspace_32paging.c | 2 +- src/arch/x86/64/kernel/vspace.c | 2 +- tools/hardware/outputs/c_header.py | 7 ------- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/include/arch/arm/arch/32/mode/hardware.h b/include/arch/arm/arch/32/mode/hardware.h index f872d6ce0f..edd05500a3 100644 --- a/include/arch/arm/arch/32/mode/hardware.h +++ b/include/arch/arm/arch/32/mode/hardware.h @@ -65,7 +65,7 @@ #endif /* The physical memory address to use for mapping the kernel ELF */ -#define KERNEL_ELF_PADDR_BASE PADDR_BASE +#define KERNEL_ELF_PADDR_BASE physBase() /* For use by the linker (only integer constants allowed) */ #define KERNEL_ELF_PADDR_BASE_RAW PHYS_BASE_RAW diff --git a/include/hardware.h b/include/hardware.h index 6cfa8953e6..d157bc573f 100644 --- a/include/hardware.h +++ b/include/hardware.h @@ -12,7 +12,7 @@ * * - USER_TOP: The first address after the end of user memory * - * - PADDR_BASE: The first physical address mapped in the kernel's + * - physBase(): The first physical address mapped in the kernel's * physical memory window. * - PPTR_BASE: The first virtual address of the kernel's physical * memory window. @@ -30,7 +30,7 @@ /* The offset from a physical address to a virtual address in the * physical memory window. */ -#define PPTR_BASE_OFFSET (PPTR_BASE - PADDR_BASE) +#define PPTR_BASE_OFFSET (PPTR_BASE - physBase()) /* The last address in the physical memory region mapped into the * physical memory window */ diff --git a/src/arch/arm/64/kernel/vspace.c b/src/arch/arm/64/kernel/vspace.c index aa3d565ce9..52e39a00f6 100644 --- a/src/arch/arm/64/kernel/vspace.c +++ b/src/arch/arm/64/kernel/vspace.c @@ -266,7 +266,7 @@ BOOT_CODE void map_kernel_window(void) /* map the kernel window using large pages */ vaddr = PPTR_BASE; - for (paddr = PADDR_BASE; paddr < PADDR_TOP; paddr += BIT(seL4_LargePageBits)) { + for (paddr = physBase(); paddr < PADDR_TOP; paddr += BIT(seL4_LargePageBits)) { armKSGlobalKernelPDs[GET_KPT_INDEX(vaddr, KLVL_FRM_ARM_PT_LVL(1))][GET_KPT_INDEX(vaddr, KLVL_FRM_ARM_PT_LVL(2))] = pte_pte_page_new( #ifdef CONFIG_ARM_HYPERVISOR_SUPPORT @@ -1658,7 +1658,7 @@ static exception_t decodeARMFrameInvocation(word_t invLabel, word_t length, word_t pstart = pptr_to_paddr((void *)cap_frame_cap_get_capFBasePtr(cap)) + start; #ifdef CONFIG_ARM_HYPERVISOR_SUPPORT /* Don't let applications flush outside of the kernel window */ - if (pstart < PADDR_BASE || ((end - start) + pstart) > PADDR_TOP) { + if (pstart < physBase() || ((end - start) + pstart) > PADDR_TOP) { userError("Page Flush: Overlaps kernel region."); current_syscall_error.type = seL4_IllegalOperation; return EXCEPTION_SYSCALL_ERROR; diff --git a/src/arch/riscv/kernel/vspace.c b/src/arch/riscv/kernel/vspace.c index 6d4cdfc507..6653851c35 100644 --- a/src/arch/riscv/kernel/vspace.c +++ b/src/arch/riscv/kernel/vspace.c @@ -112,8 +112,8 @@ BOOT_CODE VISIBLE void map_kernel_window(void) /* kernel window starts at PPTR_BASE */ word_t pptr = PPTR_BASE; - /* first we map in memory from PADDR_BASE */ - word_t paddr = PADDR_BASE; + /* first we map in memory from physBase() */ + word_t paddr = physBase(); while (pptr < PPTR_TOP) { assert(IS_ALIGNED(pptr, RISCV_GET_LVL_PGSIZE_BITS(0))); assert(IS_ALIGNED(paddr, RISCV_GET_LVL_PGSIZE_BITS(0))); diff --git a/src/arch/x86/32/kernel/vspace.c b/src/arch/x86/32/kernel/vspace.c index 683f9388d2..696705a147 100644 --- a/src/arch/x86/32/kernel/vspace.c +++ b/src/arch/x86/32/kernel/vspace.c @@ -214,7 +214,7 @@ BOOT_CODE bool_t map_kernel_window( /* Mapping of PPTR_BASE (virtual address) to kernel's PADDR_BASE * up to end of virtual address space except for the last large page. */ - phys = PADDR_BASE; + phys = physBase(); idx = PPTR_BASE >> LARGE_PAGE_BITS; /* PPTR_TOP differs whether CONFIG_KERNEL_LOG_BUFFER diff --git a/src/arch/x86/32/kernel/vspace_32paging.c b/src/arch/x86/32/kernel/vspace_32paging.c index 2e9b03ff16..c3cdbd5e34 100644 --- a/src/arch/x86/32/kernel/vspace_32paging.c +++ b/src/arch/x86/32/kernel/vspace_32paging.c @@ -84,7 +84,7 @@ PHYS_CODE VISIBLE void init_boot_pd(void) /* mapping of PPTR_BASE (virtual address) to PADDR_BASE up to end of virtual address space */ for (i = 0; i < ((-PPTR_BASE) >> seL4_LargePageBits); i++) { *(_boot_pd + i + (PPTR_BASE >> seL4_LargePageBits)) = pde_pde_large_new_phys( - (i << seL4_LargePageBits) + PADDR_BASE, /* physical address */ + (i << seL4_LargePageBits) + physBase(), /* physical address */ 0, /* pat */ 0, /* avl */ 1, /* global */ diff --git a/src/arch/x86/64/kernel/vspace.c b/src/arch/x86/64/kernel/vspace.c index d5f6721b11..5d5169071d 100644 --- a/src/arch/x86/64/kernel/vspace.c +++ b/src/arch/x86/64/kernel/vspace.c @@ -75,7 +75,7 @@ BOOT_CODE bool_t map_kernel_window( /* put the 1GB kernel_base mapping into the PDPT */ x64KSKernelPDPT[GET_PDPT_INDEX(KERNEL_ELF_BASE)] = pdpte_pdpte_1g_new( 0, /* xd */ - PADDR_BASE, + physBase(), 0, /* PAT */ KERNEL_IS_GLOBAL(), /* global */ 0, /* dirty */ diff --git a/tools/hardware/outputs/c_header.py b/tools/hardware/outputs/c_header.py index b0fd92bf93..3992a16f7e 100644 --- a/tools/hardware/outputs/c_header.py +++ b/tools/hardware/outputs/c_header.py @@ -54,13 +54,6 @@ return PHYS_BASE_RAW; } -/* - * PADDR_BASE is the first physical address to map into the kernel's physical - * memory window. - */ -#define PADDR_BASE physBase() - - /* INTERRUPTS */ {% for irq in kernel_irqs %} /* {{ irq.desc }} */