From ace65b453151845bc361f21f3e5b651c35f9f126 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 22 May 2024 13:00:41 -0400 Subject: massive refactor for mp and organization --- mem/zone.h | 71 -------------------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 mem/zone.h (limited to 'mem/zone.h') diff --git a/mem/zone.h b/mem/zone.h deleted file mode 100644 index c0b0f52..0000000 --- a/mem/zone.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef JOVE_MEM_ZONE_H -#define JOVE_MEM_ZONE_H 1 - -#include -#include "lib/buddymap.h" - -enum { - MEM_ZONE_STANDARD = 0, /* First GiB of physical memory. */ - MEM_ZONE_HIGHER, - MEM_ZONE_COUNT -}; - -#define MEM_ZONE_STANDARD_BASE 0 -#define MEM_ZONE_STANDARD_LIMIT (1 * GiB) -#define MEM_ZONE_HIGHER_BASE MEM_ZONE_STANDARD_LIMIT - -#define MEM_BUDDY_ORDERS 12 -struct PhysicalMemoryZone -{ - const char *name; - - uintptr_t base; - uintptr_t limit; - - struct BuddyMap freemap; -}; - -/**Return the zone index for the given address - * @param addr address to look up - * @return zone index*/ -int mem_zone_for(uintptr_t addr); - -/**Return the lower bound for the given zone index. - * @param zone index into zones. - * @return lower bound.*/ -uintptr_t mem_zone_bound_lower(size_t zone); - -/**Return the upper bound for the given zone index. - * @param zone index into zones. - * @return upper bound.*/ -uintptr_t mem_zone_bound_upper(size_t zone); - -/**Return the number of pages free in the given zone. - * @param zone index into zones. - * @return number of free pages.*/ -size_t mem_zone_pages_free(size_t zone); - -/** Using a given zone, reserve a range of physical addresses - * @param zone identifier of zone to modify - * @param base starting address to reserve - * @param limit ending address to reserve - * @return error code or 0 if success */ -int mem_zone_resv(size_t zone, uintptr_t base, uintptr_t limit); - -/** Using a given zone, free a range of physical addresses - * @param zone identifier of zone to modify - * @param base starting address to free - * @param limit ending address to free - * @return error code or 0 if success*/ -int mem_zone_free(size_t zone, uintptr_t base, uintptr_t limit); - -/** Allocate a number of pages from the given zone - * @param zone identifier of the zone to modify - * @param pages number of pages to allocate - * @return physical memory address of allocation - * zero if allocation failed*/ -uintptr_t mem_zone_alloc(size_t zone, size_t pages); - -void mem_zone_setup_standard(void); - -#endif -- cgit v1.2.1