Changeset 89c57b6 in mainline for kernel/generic/src/debug/panic.c


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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 mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/panic.c

    rcefb126 r89c57b6  
    4242#include <interrupt.h>
    4343
     44#define BANNER_LEFT   "######>"
     45#define BANNER_RIGHT  "<######"
     46
    4447void panic_common(panic_category_t cat, istate_t *istate, int access,
    4548    uintptr_t address, const char *fmt, ...)
    4649{
    4750        va_list args;
    48 
     51       
    4952        silent = false;
    50 
    51         printf("\nKERNEL PANIC ");
     53       
     54        printf("\n%s Kernel panic ", BANNER_LEFT);
    5255        if (CPU)
    53                 printf("ON cpu%d ", CPU->id);
    54         printf("DUE TO ");
    55 
     56                printf("on cpu%u ", CPU->id);
     57        printf("due to ");
     58       
    5659        va_start(args, fmt);
    5760        if (cat == PANIC_ASSERT) {
    58                 printf("A FAILED ASSERTION:\n");
     61                printf("a failed assertion: %s\n", BANNER_RIGHT);
    5962                vprintf(fmt, args);
    6063                printf("\n");
    6164        } else if (cat == PANIC_BADTRAP) {
    62                 printf("BAD TRAP %ld.\n", address);
     65                printf("bad trap %" PRIun ". %s\n", address,
     66                    BANNER_RIGHT);
     67                if (fmt) {
     68                        vprintf(fmt, args);
     69                        printf("\n");
     70                }
    6371        } else if (cat == PANIC_MEMTRAP) {
    64                 printf("A BAD MEMORY ACCESS WHILE ");
     72                printf("a bad memory access while ");
    6573                if (access == PF_ACCESS_READ)
    66                         printf("LOADING FROM");
     74                        printf("loading from");
    6775                else if (access == PF_ACCESS_WRITE)
    68                         printf("STORING TO");
     76                        printf("storing to");
    6977                else if (access == PF_ACCESS_EXEC)
    70                         printf("BRANCHING TO");
     78                        printf("branching to");
    7179                else
    72                         printf("REFERENCING");
    73                 printf(" ADDRESS %p.\n", address);
     80                        printf("referencing");
     81                printf(" address %p. %s\n", (void *) address,
     82                    BANNER_RIGHT);
     83                if (fmt) {
     84                        vprintf(fmt, args);
     85                        printf("\n");
     86                }
    7487        } else {
    75                 printf("THE FOLLOWING REASON:\n");
     88                printf("the following reason: %s\n",
     89                    BANNER_RIGHT);
    7690                vprintf(fmt, args);
     91                printf("\n");
    7792        }
    7893        va_end(args);
    79 
     94       
    8095        printf("\n");
    81 
     96       
    8297        if (istate) {
    8398                istate_decode(istate);
    8499                printf("\n");
    85100        }
    86 
     101       
    87102        stack_trace();
    88103        halt();
Note: See TracChangeset for help on using the changeset viewer.