Ignore:
File:
1 edited

Legend:

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

    r9ac2013 rf651e80  
    11/*
    2  * Copyright (c) 2010 Jakub Jermar
     2 * Copyright (c) 2001-2004 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup generic
     29/** @addtogroup generic 
    3030 * @{
    3131 */
     
    3636#define KERN_PANIC_H_
    3737
    38 #include <typedefs.h>
    39 #include <print.h>
     38#ifdef CONFIG_DEBUG
     39#       define panic(format, ...) \
     40                panic_printf("Kernel panic in %s() at %s:%u: " format "\n", \
     41                __func__, __FILE__, __LINE__, ##__VA_ARGS__);
     42#else
     43#       define panic(format, ...) \
     44                panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__);
     45#endif
    4046
    41 #define panic(fmt, ...) \
    42         panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__)
    43 
    44 #define panic_assert(fmt, ...) \
    45         panic_common(PANIC_ASSERT, NULL, 0, 0, fmt, ##__VA_ARGS__)
    46 
    47 #define panic_badtrap(istate, n, fmt, ...) \
    48         panic_common(PANIC_BADTRAP, istate, 0, n, fmt, ##__VA_ARGS__)
    49 
    50 #define panic_memtrap(istate, access, addr, fmt, ...) \
    51         panic_common(PANIC_MEMTRAP, istate, access, addr, fmt, ##__VA_ARGS__)
    52 
    53 typedef enum {
    54         PANIC_OTHER,
    55         PANIC_ASSERT,
    56         PANIC_BADTRAP,
    57         PANIC_MEMTRAP
    58 } panic_category_t;
    59 
    60 struct istate;
    61 
    62 extern bool silent;
    63 
    64 extern void panic_common(panic_category_t, struct istate *, int,
    65     uintptr_t, const char *, ...) __attribute__ ((noreturn))
    66     PRINTF_ATTRIBUTE(5, 6);
     47extern void panic_printf(char *fmt, ...) __attribute__((noreturn));
    6748
    6849#endif
Note: See TracChangeset for help on using the changeset viewer.