Physical memory manager#

group Kernel physical memory manager

Defines

PAGE_SIZE#

Enums

enum frame_order_t#

Values:

enumerator FRAME_ORDER_4KiB#
enumerator FRAME_ORDER_8KiB#
enumerator FRAME_ORDER_16KiB#
enumerator FRAME_ORDER_32KiB#
enumerator FRAME_ORDER_64KiB#
enumerator FRAME_ORDER_128KiB#
enumerator FRAME_ORDER_256KiB#
enumerator FRAME_ORDER_512KiB#
enumerator FRAME_ORDER_1MiB#
enumerator FRAME_ORDER_2MiB#
enumerator FRAME_ORDER_1GiB#

Functions

static inline void * physical_to_effective (__phys void *addr)

Todo:

implement

static inline memory_region_t physical_memory_region_to_effective(physical_memory_region_t pmr)#
error_t phys_mem_init()#

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 – Success

  • ERR_REPEATED_INITIALIZATION – Upon repeated initialization

  • ERR_OUT_OF_BOUND – Internal memory mangament failed

  • ERR_NOT_VALID – Hardware abstraction layer was not initializated beforehand

error_t phys_mem_alloc_frame(frame_order_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