Subversion Repositories HelenOS

Rev

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

Rev 224 Rev 268
Line 34... Line 34...
34
#include <func.h>
34
#include <func.h>
35
#include <cpu.h>
35
#include <cpu.h>
36
#include <arch/asm.h>
36
#include <arch/asm.h>
37
#include <mm/tlb.h>
37
#include <mm/tlb.h>
38
#include <arch.h>
38
#include <arch.h>
-
 
39
#include <symtab.h>
39
 
40
 
40
/*
41
/*
41
 * Interrupt and exception dispatching.
42
 * Interrupt and exception dispatching.
42
 */
43
 */
43
 
44
 
Line 45... Line 46...
45
 
46
 
46
void (* disable_irqs_function)(__u16 irqmask) = NULL;
47
void (* disable_irqs_function)(__u16 irqmask) = NULL;
47
void (* enable_irqs_function)(__u16 irqmask) = NULL;
48
void (* enable_irqs_function)(__u16 irqmask) = NULL;
48
void (* eoi_function)(void) = NULL;
49
void (* eoi_function)(void) = NULL;
49
 
50
 
-
 
51
#define PRINT_INFO_ERRCODE(x) { \
-
 
52
    char *symbol = get_symtab_entry(stack[1]); \
-
 
53
    if (!symbol) \
-
 
54
        symbol = ""; \
-
 
55
    printf("----------------EXCEPTION OCCURED----------------\n"); \
-
 
56
    printf("%%eip: %X (%s)\n",x[1],symbol); \
-
 
57
    printf("ERROR_WORD=%X\n", x[0]); \
-
 
58
    printf("%%cs=%X,flags=%X\n", x[2], x[3]); \
-
 
59
    printf("%%eax=%X, %%ebx=%X, %%ecx=%X, %%edx=%X\n",\
-
 
60
           x[-2],x[-5],x[-3],x[-4]); \
-
 
61
    printf("%%esi=%X, %%edi=%X, %%ebp=%X, %%esp=%X\n",\
-
 
62
           x[-8],x[-9],x[-1],x); \
-
 
63
    printf("stack: %X, %X, %X, %X\n", x[4], x[5], x[6], x[7]); \
-
 
64
    printf("       %X, %X, %X, %X\n", x[8], x[9], x[10], x[11]); \
-
 
65
        }
-
 
66
 
50
iroutine trap_register(__u8 n, iroutine f)
67
iroutine trap_register(__u8 n, iroutine f)
51
{
68
{
52
    ASSERT(n < IVT_ITEMS);
69
    ASSERT(n < IVT_ITEMS);
53
   
70
   
54
    iroutine old;
71
    iroutine old;
Line 77... Line 94...
77
    panic("unserviced interrupt\n");
94
    panic("unserviced interrupt\n");
78
}
95
}
79
 
96
 
80
void gp_fault(__u8 n, __native stack[])
97
void gp_fault(__u8 n, __native stack[])
81
{
98
{
82
    printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
-
 
83
    printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
-
 
84
    printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
99
    PRINT_INFO_ERRCODE(stack);
85
    panic("general protection fault\n");
100
    panic("general protection fault\n");
86
}
101
}
87
 
102
 
88
void ss_fault(__u8 n, __native stack[])
103
void ss_fault(__u8 n, __native stack[])
89
{
104
{
90
    printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
-
 
91
    printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
-
 
92
    printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
105
    PRINT_INFO_ERRCODE(stack);
93
    panic("stack fault\n");
106
    panic("stack fault\n");
94
}
107
}
95
 
108
 
96
 
109
 
97
void nm_fault(__u8 n, __native stack[])
110
void nm_fault(__u8 n, __native stack[])
Line 108... Line 121...
108
 
121
 
109
 
122
 
110
 
123
 
111
void page_fault(__u8 n, __native stack[])
124
void page_fault(__u8 n, __native stack[])
112
{
125
{
-
 
126
    PRINT_INFO_ERRCODE(stack);
113
    printf("page fault address: %X\n", read_cr2());
127
    printf("page fault address: %X\n", read_cr2());
114
    printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
-
 
115
    printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
-
 
116
    printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
-
 
117
    panic("page fault\n");
128
    panic("page fault\n");
118
}
129
}
119
 
130
 
120
void syscall(__u8 n, __native stack[])
131
void syscall(__u8 n, __native stack[])
121
{
132
{