Kernel/LibC: add free function for FixedWidthAllocator

I have to rework the syscall API and allocators in process. For
now this works well enough :)
This commit is contained in:
Bananymous
2023-05-07 01:21:50 +03:00
parent 890aa9aa15
commit 12e42f40c5
9 changed files with 112 additions and 45 deletions

View File

@@ -17,7 +17,7 @@ namespace Kernel
~FixedWidthAllocator();
vaddr_t allocate();
void deallocate(vaddr_t);
bool deallocate(vaddr_t);
uint32_t allocation_size() const { return m_allocation_size; }
@@ -26,8 +26,10 @@ namespace Kernel
{
node* prev { nullptr };
node* next { nullptr };
bool allocated { false };
};
vaddr_t address_of(const node*) const;
vaddr_t address_of_node(const node*) const;
node* node_from_address(vaddr_t) const;
void allocate_page_for_node_if_needed(const node*);
private:

View File

@@ -57,6 +57,7 @@ namespace Kernel
BAN::ErrorOr<void> set_working_directory(BAN::StringView);
BAN::ErrorOr<void*> allocate(size_t);
void free(void*);
void termid(char*) const;

View File

@@ -8,6 +8,7 @@
#define SYS_SEEK 6
#define SYS_OPEN 7
#define SYS_ALLOC 8
#define SYS_FREE 9
#include <stdint.h>