Simple library providing dynamic memory allocation (similar to malloc) for hobby OSes and embedded systems
This library dependes on:
void* mmGetPages(MWORD n) - Returns a pointer to n contiguous pages (4kb each) - This should implement some kind of lock/unlock
void mmReleasePages(MWORD* address, MWORD n) - returns nothing. Release pages to the system - This should implement some kind of lock/unlock
<stdint.h> - Definitions for uint32_t and uint64_t(for x86_64 only)
<stdbool.h> - Definition for bool type
<string.h> - memcpy and memset
---------------------------------------------------------------------------------------------
This library provides:
MWORD - Macro. Extends to uint32_t or uint64_t depending on target
MWORD lmInit() - Initialize the library. Returns 0 on success
void* lmMalloc(MWORD size) - Similar to malloc. Returns pointer to allocated space
MWORD lmFree(void *ptr) - Returns how much data was freed