Ignore:
File:
1 edited

Legend:

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

    rf2f6636 r9ac2013  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
     2 * Copyright (c) 2010 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 <stacktrace.h>
     38#include <typedefs.h>
    3939#include <print.h>
    4040
    41 #ifdef CONFIG_DEBUG
    42 #       define panic(format, ...) \
    43                 do { \
    44                         printf("Kernel panic in %s() at %s:%u.\n", \
    45                             __func__, __FILE__, __LINE__); \
    46                         stack_trace(); \
    47                         panic_printf("Panic message: " format "\n", \
    48                             ##__VA_ARGS__);\
    49                 } while (0)
    50 #else
    51 #       define panic(format, ...) \
    52                 panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__);
    53 #endif
     41#define panic(fmt, ...) \
     42        panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__)
    5443
    55 extern void panic_printf(char *fmt, ...) __attribute__((noreturn));
     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
     53typedef enum {
     54        PANIC_OTHER,
     55        PANIC_ASSERT,
     56        PANIC_BADTRAP,
     57        PANIC_MEMTRAP
     58} panic_category_t;
     59
     60struct istate;
     61
     62extern bool silent;
     63
     64extern void panic_common(panic_category_t, struct istate *, int,
     65    uintptr_t, const char *, ...) __attribute__ ((noreturn))
     66    PRINTF_ATTRIBUTE(5, 6);
    5667
    5768#endif
Note: See TracChangeset for help on using the changeset viewer.