From b97967ab660243b723f246db03c2e4a82e125f3f Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 7 Jul 2024 07:02:46 +0300 Subject: simplify assertions + No real point having multiple different levels of assertions, just say you assert something and be done with it --- src/pmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/pmem.c') diff --git a/src/pmem.c b/src/pmem.c index 5516d30..bed10a4 100644 --- a/src/pmem.c +++ b/src/pmem.c @@ -564,7 +564,7 @@ static size_t build_reserved_map(size_t exists, struct avoid_region avoid[64], pm_t size = (pm_t)fdt_load_reg_size(ci, rmem_reg, 0); avoid[exists++] = (struct avoid_region){(pm_t)__va(base), size}; - catastrophic_assert(exists < 64); + assert(exists < 64); } return exists; @@ -636,10 +636,14 @@ void init_pmem(void *fdt, uintptr_t load_addr) info("found initrd at [%lx - %lx]\n", initrd_base, initrd_base + initrd_size); + assert(is_aligned(initrd_base, BASE_PAGE_SIZE)); + pm_t fdt_base = (pm_t)fdt; pm_t fdt_size = fdt_totalsize(fdt); info("found fdt at [%lx - %lx]\n", fdt_base, fdt_base + fdt_size); + assert(is_aligned(fdt_base, BASE_PAGE_SIZE)); + /* find probably most suitable contiguous region of ram for our physical * ram map */ @@ -661,7 +665,7 @@ void init_pmem(void *fdt, uintptr_t load_addr) pm_t pmap_base = select_base(ram_base, ram_size, probe_size, avoid_count, avoid); - catastrophic_assert(pmap_base); + assert(pmap_base); info("choosing to place pmem map at %lx\n", pmap_base); size_t actual_size = populate_pmap(ram_base, ram_size, pmap_base); -- cgit v1.3