dde_linux: don't spin when panicking

Issue #3997
This commit is contained in:
Norman Feske 2021-03-08 11:30:41 +01:00
parent 6223ae4413
commit 755aed7cb2
13 changed files with 43 additions and 9 deletions

View File

@ -28,7 +28,7 @@ CC_CXX_OPT = -fpermissive
SRC_CC = dummies.cc lxcc_emul.cc nic_handler.cc \
timer_handler.cc random.cc
SRC_CC += malloc.cc printf.cc env.cc
SRC_CC += malloc.cc printf.cc bug.cc env.cc
SRC_C += driver.c dummies_c.c lxc_emul.c

View File

@ -20,7 +20,7 @@ SRC_CC += dummies.cc init.cc lxcc_emul.cc nic.cc socket_call.cc random.cc \
# lx_kit
SRC_CC += mapped_io_mem_range.cc irq.cc pci.cc malloc.cc scheduler.cc \
work.cc timer.cc printf.cc env.cc
work.cc timer.cc printf.cc bug.cc env.cc
SRC_C += lxc_emul.c dummies_new.c

View File

@ -7,6 +7,7 @@ SRC_C = dummies.c lx_emul_c.c
# lx_kit
SRC_CC += printf.cc \
bug.cc \
env.cc \
irq.cc \
malloc.cc \

View File

@ -11,6 +11,7 @@ SRC_CC += irq.cc \
mapped_io_mem_range.cc \
pci.cc \
printf.cc \
bug.cc \
scheduler.cc \
timer.cc \
work.cc \

View File

@ -7,7 +7,7 @@ INC_DIR += $(PRG_DIR)/../..
INC_DIR += $(REP_DIR)/src/drivers/nic
# lx_kit
SRC_CC += env.cc irq.cc malloc.cc scheduler.cc timer.cc work.cc printf.cc
SRC_CC += env.cc irq.cc malloc.cc scheduler.cc timer.cc work.cc printf.cc bug.cc
INC_DIR += $(REP_DIR)/src/include
# contrib code

View File

@ -43,7 +43,7 @@ MOD_SUFFIX =
CC_OPT += -DMOD_SUFFIX=$(MOD_SUFFIX)
# lx_kit
SRC_CC += printf.cc work.cc timer.cc scheduler.cc irq.cc malloc.cc env.cc
SRC_CC += printf.cc bug.cc work.cc timer.cc scheduler.cc irq.cc malloc.cc env.cc
# common lib
SRC_C += lib/ctype.c

View File

@ -1,7 +1,7 @@
TARGET := usb_hid_drv
SRC_C := dummies.c
SRC_CC := main.cc lx_emul.cc evdev.cc
SRC_CC += printf.cc timer.cc scheduler.cc env.cc work.cc
SRC_CC += printf.cc bug.cc timer.cc scheduler.cc env.cc work.cc
LIBS := base usb_hid_include lx_kit_setjmp

View File

@ -10,6 +10,7 @@ INC_DIR += $(REP_DIR)/src/include
# lx_kit
SRC_CC += lx_kit/printf.cc
SRC_CC += lx_kit/bug.cc
SRC_CC += lx_kit/work.cc
SRC_CC += lx_kit/timer.cc
SRC_CC += lx_kit/scheduler.cc

View File

@ -1,7 +1,7 @@
TARGET := usb_modem_drv
SRC_C := dummies.c lxc.c
SRC_CC := main.cc lx_emul.cc component.cc terminal.cc fec_nic.cc
SRC_CC += printf.cc timer.cc scheduler.cc malloc.cc env.cc work.cc
SRC_CC += printf.cc bug.cc timer.cc scheduler.cc malloc.cc env.cc work.cc
SRC_CC += uplink_client.cc
LIBS := base usb_modem_include lx_kit_setjmp nic_driver

View File

@ -1,7 +1,7 @@
TARGET := usb_net_drv
SRC_C := dummies.c lxc.c
SRC_CC := main.cc lx_emul.cc component.cc linux_network_session_base.cc
SRC_CC += printf.cc timer.cc scheduler.cc malloc.cc env.cc work.cc
SRC_CC += printf.cc bug.cc timer.cc scheduler.cc malloc.cc env.cc work.cc
SRC_CC += uplink_client.cc
LIBS := base usb_net_include lx_kit_setjmp nic_driver

View File

@ -19,6 +19,8 @@
** asm/bug.h **
***************/
extern void lx_sleep_forever() __attribute__((noreturn));
#define WARN_ON(condition) ({ \
int ret = !!(condition); \
if (ret) lx_printf("[%s] WARN_ON(%s) \n", __func__, #condition); \
@ -31,7 +33,7 @@
#define BUG() do { \
lx_printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
while (1); \
lx_sleep_forever(); \
} while (0)
#define WARN_ON_ONCE WARN_ON

View File

@ -71,6 +71,9 @@ static inline int _printk(const char *fmt, ...)
#define vprintk(...)
#endif
extern void lx_sleep_forever() __attribute__((noreturn));
static inline __printf(1, 2) void panic(const char *fmt, ...) __noreturn;
static inline void panic(const char *fmt, ...)
{
@ -79,7 +82,7 @@ static inline void panic(const char *fmt, ...)
lx_vprintf(fmt, args);
va_end(args);
lx_printf("\npanic()\n");
while (1) ;
lx_sleep_forever();
}
/*

View File

@ -0,0 +1,26 @@
/*
* \brief C ABI for panicking / blocking forever
* \author Norman Feske
* \date 2021-03-08
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/sleep.h>
/* Linux emulation environment includes */
#include <lx_emul/extern_c_begin.h>
#include <lx_emul/bug.h>
#include <lx_emul/extern_c_end.h>
extern "C" void lx_sleep_forever()
{
Genode::sleep_forever();
}