Skip to content

Commit

Permalink
WIP libsel4platsupport: debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-h committed Apr 12, 2024
1 parent d749931 commit 6b1cd8c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion libsel4muslcsys/src/sys_morecore.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ long sys_mmap_impl(void *addr, size_t length, int prot, int flags, int fd, off_t
if (length > morecore_top - morecore_base) {
return -ENOMEM;
}

ZF_LOGI(
"morecore %p - %p, len %#x, return address: 0x%"PRIxPTR,
morecore_base, morecore_top, length, morecore_top-length);

/* Steal from the top */
morecore_top -= length;
return morecore_top;
Expand Down Expand Up @@ -116,6 +121,8 @@ static void init_morecore_region(void)
morecore_base = (uintptr_t) morecore_area;
morecore_top = (uintptr_t) &morecore_area[morecore_size];
}

ZF_LOGI("morecore %p - %p (%#zd)", morecore_base, morecore_top, morecore_size);
}

static long sys_brk_static(va_list ap)
Expand Down Expand Up @@ -199,8 +206,16 @@ static long sys_mmap_impl_static(void *addr, size_t length, int prot, int flags,
if (base < morecore_base) {
return -ENOMEM;
}
ZF_LOGF_IF(
(base % 0x1000) != 0,
"morecore %p - %p, len %#zx, return address: %p (not 4 KiB aligned)",
(void*)morecore_base, (void*)morecore_top, length, (void*)base);

ZF_LOGI(
"morecore %p - %p, len %#zx, return address: %p",
(void*)morecore_base, (void*)morecore_top, length, (void*)base);

morecore_top = base;
ZF_LOGF_IF((base % 0x1000) != 0, "return address: 0x%"PRIxPTR" requires alignment: 0x%x ", base, 0x1000);
return base;
}
assert(!"not implemented");
Expand Down

0 comments on commit 6b1cd8c

Please sign in to comment.