diff options
Diffstat (limited to 'include/sbi/sbi_console.h')
-rw-r--r-- | include/sbi/sbi_console.h | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/include/sbi/sbi_console.h b/include/sbi/sbi_console.h index 28b4a79..e15b55d 100644 --- a/include/sbi/sbi_console.h +++ b/include/sbi/sbi_console.h @@ -11,7 +11,6 @@ #define __SBI_CONSOLE_H__ #include <sbi/sbi_types.h> -#include <sbi/sbi_hart.h> struct sbi_console_device { /** Name of the console device */ @@ -44,6 +43,8 @@ int __printf(1, 2) sbi_printf(const char *format, ...); int __printf(1, 2) sbi_dprintf(const char *format, ...); +void __printf(1, 2) __attribute__((noreturn)) sbi_panic(const char *format, ...); + const struct sbi_console_device *sbi_console_get_device(void); void sbi_console_set_device(const struct sbi_console_device *dev); @@ -52,23 +53,9 @@ struct sbi_scratch; int sbi_console_init(struct sbi_scratch *scratch); -#define BUG() do { \ - sbi_printf("BUG: failure at %s:%d/%s()!\n", \ - __FILE__, __LINE__, __func__); \ - sbi_hart_hang(); \ -} while (0) - -#define BUG_ON(cond) do { \ - if (cond) \ - BUG(); \ -} while (0) - -#define SBI_ASSERT(cond) do { \ - if (!(cond)) { \ - sbi_printf("ASSERT: %s:%d/%s(): Assertion `%s` failed.\n", \ - __FILE__,__LINE__,__func__, #cond);\ - sbi_hart_hang(); \ - } \ +#define SBI_ASSERT(cond, args) do { \ + if (unlikely(!(cond))) \ + sbi_panic args; \ } while (0) #endif |