Skip to content

Commit

Permalink
liballoc: remove reference to __MOS_KERNEL__
Browse files Browse the repository at this point in the history
it's not used by the kernel for long
  • Loading branch information
moodyhunter committed Dec 24, 2023
1 parent 32f2537 commit 2efc5f9
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions userspace/libs/liballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include <mos_stdio.h>
#include <mos_string.h>

#ifdef __MOS_KERNEL__
#include <mos/platform/platform.h>
#endif

#define VERSION "1.1"

// This is the byte alignment that memory must be allocated on. IMPORTANT for GTK and other stuff.
Expand Down Expand Up @@ -103,34 +99,6 @@ static size_t l_mem_allocated = 0; // Running total of allocated memory.
static size_t l_mem_inuse = 0; // Running total of used memory.
static size_t l_warnings = 0; // Number of warnings encountered

#if __MOS_KERNEL__
void liballoc_dump(void)
{
pr_info("--------------- Memory data ---------------");
pr_info2(" Total Memory Allocated: %zu bytes", l_mem_allocated);
pr_info2(" Memory Used (malloc'ed): %zu bytes", l_mem_inuse);
pr_info2(" Emitted %zu warning(s)", l_warnings);

liballoc_block_t *maj = l_memroot;
liballoc_part_t *min = NULL;

pr_info("Memory Blocks:");
while (maj != NULL)
{
pr_info2(" %p: total = %zu, used = %zu", (void *) maj, maj->size, maj->usage);

min = maj->first;
while (min != NULL)
{
pr_info2(" %p: %zu bytes", (void *) min, min->size);
min = min->next;
}

maj = maj->next;
}
}
#endif

static liballoc_block_t *allocate_new_pages_for(unsigned int size)
{
// This is how much space is required.
Expand Down Expand Up @@ -462,12 +430,7 @@ void liballoc_free(const void *original_ptr)

const void *ptr = original_ptr;
if (ptr == NULL)
{
#ifdef __MOS_KERNEL__
mos_panic("liballoc: free(NULL) called");
#endif
return;
}

LIBALLOC_UNALIGN_PTR(ptr);

Expand Down

0 comments on commit 2efc5f9

Please sign in to comment.