Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/panic.h

    r06737a0 r31198c12  
    11/*
    2  * Copyright (c) 2010 Jakub Jermar
     2 * Copyright (c) 2001-2004 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    3737
    3838#include <typedefs.h>
     39#include <stacktrace.h>
     40#include <print.h>
    3941
    40 #define panic(fmt, ...) \
    41         panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__)
     42#ifdef CONFIG_DEBUG
    4243
    43 #define panic_assert(fmt, ...) \
    44         panic_common(PANIC_ASSERT, NULL, 0, 0, fmt, ##__VA_ARGS__)
     44#define panic(format, ...) \
     45        do { \
     46                silent = false; \
     47                printf("Kernel panic in %s() at %s:%u\n", \
     48                    __func__, __FILE__, __LINE__); \
     49                stack_trace(); \
     50                panic_printf("Panic message: " format "\n", \
     51                    ##__VA_ARGS__);\
     52        } while (0)
    4553
    46 #define panic_badtrap(istate, n, fmt, ...) \
    47         panic_common(PANIC_BADTRAP, istate, 0, n, fmt, ##__VA_ARGS__)
     54#else /* CONFIG_DEBUG */
    4855
    49 #define panic_memtrap(istate, access, addr, fmt, ...) \
    50         panic_common(PANIC_MEMTRAP, istate, access, addr, fmt, ##__VA_ARGS__)
     56#define panic(format, ...) \
     57        do { \
     58                silent = false; \
     59                panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__); \
     60                stack_trace(); \
     61        } while (0)
    5162
    52 typedef enum {
    53         PANIC_OTHER,
    54         PANIC_ASSERT,
    55         PANIC_BADTRAP,
    56         PANIC_MEMTRAP
    57 } panic_category_t;
    58 
    59 struct istate;
     63#endif /* CONFIG_DEBUG */
    6064
    6165extern bool silent;
    6266
    63 extern void panic_common(panic_category_t, struct istate *, int,
    64     uintptr_t, const char *, ...) __attribute__ ((noreturn));
     67extern void panic_printf(const char *fmt, ...) __attribute__((noreturn));
    6568
    6669#endif
Note: See TracChangeset for help on using the changeset viewer.