MyOS Kernel
|
#include "cpu/arch_consts.h"
#include "cpu/halt.h"
#include "vga_err.h"
#include <grub/multiboot2.h>
#include <klog.h>
#include <stdint.h>
#include <stdlib.h>
Macros | |
#define | BMAP_LEN (NUM_FRAMES/8) |
The size of the physical memory manager's bitmap. | |
Functions | |
static char | get_bmap_bit (int index) |
static void | set_bmap_bit (int index) |
static void | clear_bmap_bit (int index) |
void | pmem_init (struct multiboot_boot_header_tag *tags) |
void * | pmem_alloc (int num_pages) |
void | pmem_free (int start_page, int num_pages) |
Variables | |
static char | bmap [BMAP_LEN] |
Bitmap of allocated/non-present page frames. | |
|
static |
Clear a bit in the heap bitmap
index | The bit to clear |
|
static |
Get a bit in the bitmap
index | The bit to get |
void* pmem_alloc | ( | int | num_pages | ) |
Allocate physical frames
num_pages | The number of frames to allocate |
void pmem_free | ( | int | start_page, |
int | num_pages | ||
) |
Free allocated physical frames
start_page | The frame to start freeing at. |
num_pages | The number of frames to free |
void pmem_init | ( | struct multiboot_boot_header_tag * | tags | ) |
Initialize the physical memory manager
tags | The multiboot header |
|
static |
Set a bit in the heap bitmap
index | The bit to set |