rulimine/stage23/mm/pmm.h

48 lines
1.3 KiB
C
Raw Normal View History

2020-09-20 13:03:44 +03:00
#ifndef __MM__PMM_H__
#define __MM__PMM_H__
2020-06-05 18:51:33 +03:00
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
2020-09-18 21:02:10 +03:00
#include <sys/e820.h>
2020-06-05 18:51:33 +03:00
#define MEMMAP_MAX_ENTRIES 1024
#define MEMMAP_USABLE 1
#define MEMMAP_RESERVED 2
#define MEMMAP_ACPI_RECLAIMABLE 3
#define MEMMAP_ACPI_NVS 4
#define MEMMAP_BAD_MEMORY 5
#define MEMMAP_BOOTLOADER_RECLAIMABLE 0x1000
#define MEMMAP_KERNEL_AND_MODULES 0x1001
2021-04-07 03:10:28 +03:00
#define MEMMAP_FRAMEBUFFER 0x1002
2021-03-05 08:10:58 +03:00
#define MEMMAP_EFI_RECLAIMABLE 0x2000
2021-07-07 01:44:37 +03:00
#define MEMMAP_EFI_BOOTSERVICES 0x2001
extern struct e820_entry_t memmap[];
extern size_t memmap_entries;
#if uefi == 1
extern struct e820_entry_t untouched_memmap[];
extern size_t untouched_memmap_entries;
#endif
2020-06-05 18:51:33 +03:00
void init_memmap(void);
struct e820_entry_t *get_memmap(size_t *entries);
struct e820_entry_t *get_raw_memmap(size_t *entry_count);
2020-06-05 21:57:09 +03:00
void print_memmap(struct e820_entry_t *mm, size_t size);
2021-04-07 03:10:28 +03:00
bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free_only, bool panic, bool simulation, bool new_entry);
void pmm_randomise_memory(void);
2020-09-20 13:03:44 +03:00
void *ext_mem_alloc(size_t count);
void *ext_mem_alloc_type(size_t count, uint32_t type);
void *conv_mem_alloc(size_t count);
2020-06-05 18:51:33 +03:00
#if uefi == 1
2021-03-10 03:23:44 +03:00
void pmm_reclaim_uefi_mem(void);
2021-05-06 05:31:05 +03:00
void pmm_release_uefi_mem(void);
2021-03-10 03:23:44 +03:00
#endif
2020-06-05 18:51:33 +03:00
#endif