Initial commit: SUB-OS 64-Bit Production Monolithic Operating System with LazyBox userland suite

This commit is contained in:
subhobhai943 committed 2026-08-16 21:23:52 +05:30
commit cd9c786d14
88 files changed
+7132

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#ifndef _MM_KMALLOC_H
#define _MM_KMALLOC_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
void heap_init(void);
void* kmalloc(size_t size);
void* kzalloc(size_t size);
void* krealloc(void* ptr, size_t new_size);
void kfree(void* ptr);
size_t heap_get_used_bytes(void);
size_t heap_get_free_bytes(void);
size_t heap_get_total_bytes(void);
#endif // _MM_KMALLOC_H
+36
View File
@@ -0,0 +1,36 @@
#ifndef _MM_PMM_H
#define _MM_PMM_H
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#define PMM_PAGE_SIZE 4096
// E820 Memory Map entry structure
typedef struct {
uint64_t base;
uint64_t length;
uint32_t type;
uint32_t acpi_attr;
} __attribute__((packed)) e820_entry_t;
#define E820_TYPE_USABLE 1
#define E820_TYPE_RESERVED 2
#define E820_TYPE_ACPI_RECLAIM 3
#define E820_TYPE_ACPI_NVS 4
#define E820_TYPE_BAD 5
void pmm_init(void* memory_map, uint64_t memory_map_count);
void* pmm_alloc_page(void);
void* pmm_alloc_pages(size_t count);
void pmm_free_page(void* page);
void pmm_free_pages(void* page, size_t count);
uint64_t pmm_get_total_pages(void);
uint64_t pmm_get_used_pages(void);
uint64_t pmm_get_free_pages(void);
uint64_t pmm_get_total_memory(void);
uint64_t pmm_get_usable_memory(void);
#endif // _MM_PMM_H