Subversion Repositories HelenOS

Rev

Rev 3022 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 38... Line 38...
38
#include <arch/interrupt.h>
38
#include <arch/interrupt.h>
39
#include <arch/types.h>
39
#include <arch/types.h>
40
#include <proc/task.h>
40
#include <proc/task.h>
41
#include <proc/thread.h>
41
#include <proc/thread.h>
42
#include <arch.h>
42
#include <arch.h>
43
#include <console/klog.h>
-
 
44
#include <ddi/irq.h>
43
#include <ddi/irq.h>
45
 
44
 
46
typedef void (* iroutine)(int n, istate_t *istate);
45
typedef void (* iroutine)(int n, istate_t *istate);
47
 
46
 
48
#define fault_if_from_uspace(istate, cmd, ...) \
47
#define fault_if_from_uspace(istate, fmt, ...) \
49
{ \
48
{ \
50
    if (istate_from_uspace(istate)) { \
49
    if (istate_from_uspace(istate)) { \
51
        task_t *task = TASK; \
50
        task_t *task = TASK; \
52
        klog_printf("Task %llu killed due to an exception at %p.", task->taskid, istate_get_pc(istate)); \
51
        printf("Task %s (%" PRIu64 ") killed due to an exception at %p: ", task->name, task->taskid, istate_get_pc(istate)); \
53
        klog_printf("  " cmd, ##__VA_ARGS__); \
52
        printf(fmt "\n", ##__VA_ARGS__); \
54
        task_kill(task->taskid); \
53
        task_kill(task->taskid); \
55
        thread_exit(); \
54
        thread_exit(); \
56
    } \
55
    } \
57
}
56
}
58
 
57