diff options
author | Marvin Borner | 2021-03-26 21:55:50 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-26 22:02:20 +0100 |
commit | 05498860e8f7b1e8bb27880bc7526de026694804 (patch) | |
tree | 3bddf16e9439a950a3810d45e42a5cefdbcb7663 /libs/libc/inc/mem.h | |
parent | a96e9c4c858d47f61b89d879aa0ce6a02bdacb38 (diff) |
Renamed libs
Cleaner and more flexible.
Diffstat (limited to 'libs/libc/inc/mem.h')
-rw-r--r-- | libs/libc/inc/mem.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/libc/inc/mem.h b/libs/libc/inc/mem.h new file mode 100644 index 0000000..ec00628 --- /dev/null +++ b/libs/libc/inc/mem.h @@ -0,0 +1,29 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#ifndef MEM_H +#define MEM_H + +#include <def.h> + +void *malloc_debug(u32 size, const char *file, int line, const char *func, const char *inp); +void free_debug(void *ptr, const char *file, int line, const char *func, const char *inp); +#define malloc(size) malloc_debug((u32)(size), __FILE__, __LINE__, __func__, #size) +#define free(ptr) free_debug((void *)(ptr), __FILE__, __LINE__, __func__, #ptr) +void *realloc(void *ptr, u32 size); +void *zalloc(u32 size); + +#ifdef kernel +#define STACK_START 0x00500000 // Defined it bootloader +#define STACK_SIZE 0x1000 // idk +#elif defined(userspace) +#else +#error "No lib target specified. Please use -Dkernel or -Duserspace" +#endif + +void *memcpy(void *dest, const void *src, u32 n); +void *memset(void *dest, int val, u32 n); +void *memchr(void *src, int c, u32 n); +int memcmp(const void *s1, const void *s2, u32 n); +int mememp(const u8 *buf, u32 n); + +#endif |