rockbox/firmware/kernel
Michael McAllister 8acd1c14d6 kernel: avoid divide-by-zero in thread_get_debug_info() for zero-size stacks
thread_get_debug_info() computes the current stack usage as
stack_used_current * 100 / thread->stack_size with no guard against a zero
stack size. On hosted targets the main thread has stack_size == 0, so
opening the "View OS stacks" debug screen divides by zero and panics with a
floating point exception.

Guard the division and report 0% when the stack size is unknown, which
matches the stack_usage() helper.

Likely affects all hosted non-SDL targets, but tested/confirmed on my
HiBy R1.

Change-Id: I8ecc56f53f1e97e8a59ca71c0e08a66093fecbae
2026-07-22 09:34:04 -04:00
..
include chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
corelock.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
kernel-internal.h chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mrsw_lock.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mutex.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
queue.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
semaphore.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
thread-common.c kernel: avoid divide-by-zero in thread_get_debug_info() for zero-size stacks 2026-07-22 09:34:04 -04:00
thread-internal.h chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
thread.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
tick.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
timeout.c kernel: Break out kernel primitives into separate files and move to separate dir. 2014-03-03 18:11:57 +01:00