Add a libc skeleton with a primitive malloc.

This commit is contained in:
Drew Galbraith 2023-06-07 10:33:10 -07:00
parent eb04242a59
commit dcc05f2741
7 changed files with 73 additions and 1 deletions

View file

@ -20,6 +20,7 @@ add_executable(test2
test2.cpp)
target_link_libraries(test2
libc
mammoth_lib)
set_target_properties(test2

View file

@ -1,6 +1,7 @@
#include <mammoth/channel.h>
#include <mammoth/debug.h>
#include <mammoth/thread.h>
#include <stdlib.h>
void thread_entry(void* a) {
dbgln("In thread");
@ -18,7 +19,7 @@ int main(uint64_t bootstrap_cap) {
Thread t2(thread_entry, b);
uint64_t size = 10;
char buff[10];
char* buff = (char*)malloc(size);
Channel c1;
c1.adopt_cap(bootstrap_cap);
check(c1.ReadStr(buff, &size));