Changeset e3038b4 in mainline for kernel/generic/include/panic.h


Ignore:
Timestamp:
2010-06-28T22:45:51Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
49eb681
Parents:
05e3cb8 (diff), e4a4b44 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge unified panic architecture (Phase 1).

Note that this is still work in progress as there are the following sharp edges:

  • imprecise detection of read/write accesses on some architectures
  • missing or imperfect capability to print stack traces on some architectures
  • istate_t on some architectures may contain too little valuable information
  • basically all trap frames need to be reorganized to look like a normal stack frame on the stack trace so that there are no missing frames
  • panic_common() could print more information about the current context such as the task name, thread name, ASID etc.
  • functions that call panic_*() should be protected against inlining to avoid missing or confusing stack frames in the stack trace
File:
1 edited

Legend:

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

    r05e3cb8 re3038b4  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
     2 * Copyright (c) 2010 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    3737
    3838#include <typedefs.h>
    39 #include <stacktrace.h>
    40 #include <print.h>
    4139
    42 #ifdef CONFIG_DEBUG
     40#define panic(fmt, ...) \
     41        panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__)
    4342
    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)
     43#define panic_assert(fmt, ...) \
     44        panic_common(PANIC_ASSERT, NULL, 0, 0, fmt, ##__VA_ARGS__)
    5345
    54 #else /* CONFIG_DEBUG */
     46#define panic_badtrap(istate, n, fmt, ...) \
     47        panic_common(PANIC_BADTRAP, istate, 0, n, fmt, ##__VA_ARGS__)
    5548
    56 #define panic(format, ...) \
    57         do { \
    58                 silent = false; \
    59                 panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__); \
    60                 stack_trace(); \
    61         } while (0)
     49#define panic_memtrap(istate, access, addr, fmt, ...) \
     50        panic_common(PANIC_MEMTRAP, istate, access, addr, fmt, ##__VA_ARGS__)
    6251
    63 #endif /* CONFIG_DEBUG */
     52typedef enum {
     53        PANIC_OTHER,
     54        PANIC_ASSERT,
     55        PANIC_BADTRAP,
     56        PANIC_MEMTRAP
     57} panic_category_t;
     58
     59struct istate;
    6460
    6561extern bool silent;
    6662
    67 extern void panic_printf(const char *fmt, ...) __attribute__((noreturn));
     63extern void panic_common(panic_category_t, struct istate *, int,
     64    uintptr_t, const char *, ...) __attribute__ ((noreturn));
    6865
    6966#endif
Note: See TracChangeset for help on using the changeset viewer.