|
|
@ -11,17 +11,8 @@ void malloc_init(malloc_info* given_info)
|
|
|
|
allocate_memory_end = given_info->allocate_memory_end;
|
|
|
|
allocate_memory_end = given_info->allocate_memory_end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
optional_voidptr malloc(size_t size)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (optional_voidptr) { .error = ENOMEM };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int free(void* ptr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// allocate stack and return a pointer to the *end* of the allocated region
|
|
|
|
// allocate stack and return a pointer to the *end* of the allocated region
|
|
|
|
|
|
|
|
// this doesn't reuse stack from functions which exited
|
|
|
|
optional_voidptr malloc_stack(size_t size)
|
|
|
|
optional_voidptr malloc_stack(size_t size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
void* new_alloc_end = (void*) (((int) allocate_memory_end) - size);
|
|
|
|
void* new_alloc_end = (void*) (((int) allocate_memory_end) - size);
|
|
|
|