Skip to content

Commit 5777f59

Browse files
author
Daniel Rossier
committed
Remove call to __stdio_exit() in libc (dabt crash randomly)
1 parent 023274d commit 5777f59

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

so3/arch/arm64/traps.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ typedef void (*vector_fn_t)(cpu_regs_t *);
118118

119119
void trap_handle(cpu_regs_t *regs)
120120
{
121+
int ret = 0;
122+
121123
#ifndef CONFIG_AVZ
122124
syscall_args_t sys_args;
123125
#endif
@@ -141,7 +143,9 @@ void trap_handle(cpu_regs_t *regs)
141143
switch (ESR_ELx_EC(esr)) {
142144
case ESR_ELx_EC_DABT_LOW:
143145

144-
dabt_handle(regs, esr);
146+
ret = dabt_handle(regs, esr);
147+
if (ret == -1)
148+
goto __err;
145149
break;
146150

147151
/* SVC used for syscalls */
@@ -247,6 +251,7 @@ void trap_handle(cpu_regs_t *regs)
247251
#endif
248252

249253
default:
254+
__err:
250255
lprintk("### On CPU %d: ESR_Elx_EC(esr): 0x%lx\n", smp_processor_id(), ESR_ELx_EC(esr));
251256
trap_handle_error(regs->lr);
252257
kernel_panic();

so3/kernel/schedule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ void schedule(void)
444444
LOG_DEBUG("Now scheduling thread ID: %d name: %s PID: %d prio: %d\n", next->tid, next->name,
445445
((next->pcb != NULL) ? next->pcb->pid : -1), next->prio);
446446
if (prev)
447-
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name);
447+
LOG_DEBUG("Previous was threadID: %d name: %s PID: %d\n", prev->tid, prev->name,
448+
(next->pcb != NULL) ? next->pcb->pid : -1);
448449

449450
/*
450451
* The current threads (here prev) can be in different states, not only running; it may be in *waiting* or *zombie*

usr/lib/libc/exit/exit.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ _Noreturn void exit(int code)
2929
{
3030
__funcs_on_exit();
3131
__libc_exit_fini();
32+
33+
#warning __stdio_exit() issue
34+
/*
35+
* Currently, this function causes a data abort fault randomly. The effect
36+
* is visible on RPi4 (64-bit) more rarely on virt64
37+
*/
38+
#if 0
3239
__stdio_exit();
40+
#endif /* 0 */
41+
3342
_Exit(code);
3443
}

0 commit comments

Comments
 (0)