mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2025-10-13 21:25:07 -07:00
addind more important kernel files and also fixing bugs
This commit is contained in:
27
kernel/malloc.h
Normal file
27
kernel/malloc.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef MALLOC_H
|
||||
#define MALLOC_H
|
||||
|
||||
#include <stddef.h> // For size_t
|
||||
|
||||
// Define the memory block structure
|
||||
struct memory_block {
|
||||
size_t size;
|
||||
struct memory_block *next;
|
||||
int is_free;
|
||||
};
|
||||
|
||||
// Function prototypes
|
||||
void init_heap(void *start, void *end);
|
||||
void *malloc(size_t size);
|
||||
void free(void *ptr);
|
||||
|
||||
// Helper function prototypes
|
||||
void *find_free_block(size_t size);
|
||||
void mark_as_used(void *ptr, size_t size);
|
||||
void mark_as_free(void *ptr);
|
||||
|
||||
// External heap boundaries
|
||||
extern void *user_heap_start;
|
||||
extern void *user_heap_end;
|
||||
|
||||
#endif // MALLOC_H
|
Reference in New Issue
Block a user