addind more important kernel files and also fixing bugs

This commit is contained in:
2025-05-15 02:37:06 -07:00
parent 512bd49ff7
commit a9f2826014
21 changed files with 489 additions and 17 deletions

27
kernel/malloc.h Normal file
View 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