summaryrefslogtreecommitdiff
path: root/libcr/coroutine.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-15 00:18:27 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-15 14:58:17 -0600
commit3faaad9fe1f11cfe5699c6720c897bfddc7cf49a (patch)
treef15758869c758eeeb7604afc5c03e8d7601d8315 /libcr/coroutine.c
parent9c0338b1b4495457659157e1e9f47d422dcefc2e (diff)
Begone with the printf variants of the log functions
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r--libcr/coroutine.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 4c0b7e8..920c371 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -556,8 +556,7 @@ cid_t coroutine_add_with_stack_size(size_t stack_size,
assert_cid_state(parent, state == CR_RUNNING);
assert(stack_size);
assert(fn);
- log_debugf("coroutine_add_with_stack_size(%zu, \"%s\", %p, %p)...",
- stack_size, name, fn, args);
+ log_debugln("coroutine_add_with_stack_size(", stack_size, ", ", (qstr, name), ", ", (ptr, fn), ", ", (ptr, args), ")...");
if (!coroutine_initialized) {
cr_plat_init();
@@ -567,7 +566,7 @@ cid_t coroutine_add_with_stack_size(size_t stack_size,
cid_t child = coroutine_allocate_cid();
if (!child)
return 0;
- log_debugf("...child=%zu", child);
+ log_debugln("...child=", child);
/* 1. state *************************************************/
coroutine_table[child-1].state = CR_INITIALIZING;
@@ -580,13 +579,13 @@ cid_t coroutine_add_with_stack_size(size_t stack_size,
/* 3. stack *************************************************/
coroutine_table[child-1].stack_size = stack_size + 2*CR_STACK_GUARD_SIZE;
- log_infof("allocing \"%s\" stack with size %zu+2*%zu=%zu",
- name, stack_size, CR_STACK_GUARD_SIZE, coroutine_table[child-1].stack_size);
+ log_infoln("allocing ", (qstr, name), " stack with size ",
+ stack_size, "+2*", (base10, CR_STACK_GUARD_SIZE), "=", coroutine_table[child-1].stack_size);
coroutine_table[child-1].stack =
aligned_alloc(CR_PLAT_STACK_ALIGNMENT, coroutine_table[child-1].stack_size);
- log_infof("... done, stack is [0x%p,0x%p)",
- coroutine_table[child-1].stack + CR_STACK_GUARD_SIZE,
- coroutine_table[child-1].stack + CR_STACK_GUARD_SIZE + stack_size);
+ log_infoln("... done, stack is [",
+ (ptr, coroutine_table[child-1].stack + CR_STACK_GUARD_SIZE), ",",
+ (ptr, coroutine_table[child-1].stack + CR_STACK_GUARD_SIZE + stack_size), ")");
#if CONFIG_COROUTINE_MEASURE_STACK || CONFIG_COROUTINE_PROTECT_STACK
for (size_t i = 0; i < coroutine_table[child-1].stack_size; i++)
((uint8_t *)coroutine_table[child-1].stack)[i] =
@@ -608,8 +607,8 @@ cid_t coroutine_add_with_stack_size(size_t stack_size,
+ stack_size
#endif
;
- log_debugf("...stack =%p", coroutine_table[child-1].stack);
- log_debugf("...stack_base=%p", stack_base);
+ log_debugln("...stack =", (ptr, coroutine_table[child-1].stack));
+ log_debugln("...stack_base=", (ptr, stack_base));
/* run until cr_begin() */
cr_plat_call_with_stack(stack_base, fn, args);
assert_notreached("should cr_begin() instead of returning");
@@ -630,7 +629,7 @@ cid_t coroutine_add_with_stack_size(size_t stack_size,
/* coroutine_main() ***********************************************************/
void coroutine_main(void) {
- log_debugf("coroutine_main()");
+ log_debugln("coroutine_main()");
if (!coroutine_initialized) {
cr_plat_init();
coroutine_initialized = true;
@@ -675,7 +674,7 @@ void coroutine_main(void) {
/* cr_*() *********************************************************************/
void cr_begin(void) {
- log_debugf("cid=%zu: cr_begin()", coroutine_running);
+ log_debugln("cid=", coroutine_running, ": cr_begin()");
assert_cid_state(coroutine_running, state == CR_INITIALIZING);
bool saved = cr_save_and_disable_interrupts();
@@ -707,7 +706,7 @@ static inline void _cr_yield() {
}
void cr_yield(void) {
- log_debugf("cid=%zu: cr_yield()", coroutine_running);
+ log_debugln("cid=", coroutine_running ,": cr_yield()");
assert(!cr_plat_is_in_intrhandler());
assert_cid_state(coroutine_running, state == CR_RUNNING);
@@ -719,7 +718,7 @@ void cr_yield(void) {
}
void cr_pause_and_yield(void) {
- log_debugf("cid=%zu: cr_pause_and_yield()", coroutine_running);
+ log_debugln("cid=", coroutine_running, ": cr_pause_and_yield()");
assert(!cr_plat_is_in_intrhandler());
assert_cid_state(coroutine_running, state == CR_RUNNING);
@@ -730,7 +729,7 @@ void cr_pause_and_yield(void) {
}
[[noreturn]] void cr_exit(void) {
- log_debugf("cid=%zu: cr_exit()", coroutine_running);
+ log_debugln("cid=", coroutine_running, ": cr_exit()");
assert(!cr_plat_is_in_intrhandler());
assert_cid_state(coroutine_running, state == CR_RUNNING);
@@ -747,7 +746,7 @@ static void _cr_unpause(cid_t cid) {
}
void cr_unpause(cid_t cid) {
- log_debugf("cr_unpause(%zu)", cid);
+ log_debugln("cr_unpause(", cid, ")");
assert(!cr_plat_is_in_intrhandler());
assert_cid_state(coroutine_running, state == CR_RUNNING);
@@ -757,7 +756,7 @@ void cr_unpause(cid_t cid) {
}
void cr_unpause_from_intrhandler(cid_t cid) {
- log_debugf("cr_unpause_from_intrhandler(%zu)", cid);
+ log_debugln("cr_unpause_from_intrhandler(", cid, ")");
assert(cr_plat_is_in_intrhandler());
_cr_unpause(cid);