mirror of
https://github.com/Alvin-Zilverstand/bob16.git
synced 2026-11-26 05:52:59 +01:00
e
This commit is contained in:
1 parent
78dd619293
commit
6dc841f956
109 files changed
+18192
-1907
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#ifndef BOB64_MEMORY_H
|
||||
#define BOB64_MEMORY_H
|
||||
|
||||
#include "efi.h"
|
||||
|
||||
#define BOB64_PAGE_EXTENT_LIMIT 128
|
||||
#define BOB64_PAGE_ALLOCATION_LIMIT 16384
|
||||
#define BOB64_PAGE_ALLOC_INVALID (-1)
|
||||
#define BOB64_PAGE_ALLOC_FULL (-2)
|
||||
|
||||
typedef struct {
|
||||
u64 Base;
|
||||
u64 Pages;
|
||||
} BOB64_PAGE_EXTENT;
|
||||
|
||||
/* Sorted, non-overlapping runs of currently available physical 4 KiB pages. */
|
||||
typedef struct {
|
||||
usize Count;
|
||||
usize Capacity;
|
||||
BOB64_PAGE_EXTENT *Extents;
|
||||
usize AllocatedCount;
|
||||
BOB64_PAGE_EXTENT Allocated[BOB64_PAGE_ALLOCATION_LIMIT];
|
||||
} BOB64_PAGE_ALLOCATOR;
|
||||
|
||||
int bob64_page_allocator_init(BOB64_PAGE_ALLOCATOR *allocator,
|
||||
BOB64_PAGE_EXTENT *storage,usize capacity,
|
||||
u8 physical_address_bits,
|
||||
const void *memory_map,usize memory_map_size,
|
||||
usize descriptor_size);
|
||||
u64 bob64_page_alloc(BOB64_PAGE_ALLOCATOR *allocator,u64 pages);
|
||||
int bob64_page_free(BOB64_PAGE_ALLOCATOR *allocator,u64 address,u64 pages);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user