Physical memory manager#

group Kernel physical memory manager

Enums

enum frame_size_t#

Values:

enumerator FRAME_SIZE_4KiB#
enumerator FRAME_SIZE_8KiB#
enumerator FRAME_SIZE_16KiB#
enumerator FRAME_SIZE_32KiB#
enumerator FRAME_SIZE_64KiB#
enumerator FRAME_SIZE_128KiB#
enumerator FRAME_SIZE_256KiB#
enumerator FRAME_SIZE_512KiB#
enumerator FRAME_SIZE_1MiB#
enumerator FRAME_SIZE_2MiB#
enumerator FRAME_SIZE_1GiB#

Functions

static inline void * physical_to_effective (__phys void *addr)

Todo:

implement

u64 phys_mem_get_frame_size_in_bytes(frame_size_t fs)#
error_t phys_mem_init(const physical_memory_region_t *pmrs, size_t pmr_count, const memory_area_t *reserved_areas, size_t reserved_areas_count)#

Initializes physical memory manager.

Parameters:
  • pmrs – An array of allocatable regions of physical memory

  • pmr_count

  • reserved_areas – An array of reserved areas of physical memory of count reserved_areas_count

  • reserved_areas_count

Return values:
  • ERR_NONE

  • ERR_REPEATED_INITIALIZATION

  • ERR_OUT_OF_BOUND – Internal memory mangament failed

  • ERR_BAD_ARGpmr_count is zero

error_t phys_mem_alloc_frame(frame_size_t frame_size, physical_memory_region_t *regOUT)#
Return values:
  • ERR_NONE

  • ERR_OUT_OF_MEMORY – The block of specified size was not able to be allocated

error_t phys_mem_free_frame(physical_memory_region_t reg)#
Return values:
  • ERR_NONE

  • ERR_NOT_VALID – The address being freed was reported as not allocated