From e9c31cf19a30bd2d9960ce8341fea9cbfc973f7a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 22 Jul 2020 19:57:16 +0200 Subject: Added basic malloc (WARNING: DUMB!) :) --- src/lib/inc/def.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/lib/inc') diff --git a/src/lib/inc/def.h b/src/lib/inc/def.h index 69b43e3..6e3066a 100644 --- a/src/lib/inc/def.h +++ b/src/lib/inc/def.h @@ -3,6 +3,10 @@ #ifndef DEF_H #define DEF_H +/** + * Types + */ + typedef signed char s8; typedef unsigned char u8; @@ -15,6 +19,19 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; +/** + * Macros + */ + #define NULL ((void *)0) +#define malloc(n) ((void *)((HEAP += n) - n)) // TODO: Implement real/better malloc/free +#define free(x) + +/** + * Heap + */ + +extern u32 HEAP; +extern u32 HEAP_START; #endif -- cgit v1.2.3