Subversion Repositories HelenOS

Rev

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

Rev 282 Rev 286
Line 37... Line 37...
37
#include <mm/tlb.h>
37
#include <mm/tlb.h>
38
#include <arch.h>
38
#include <arch.h>
39
#include <symtab.h>
39
#include <symtab.h>
40
#include <arch/asm.h>
40
#include <arch/asm.h>
41
 
41
 
-
 
42
 
42
#define PRINT_INFO_ERRCODE(n,x) { \
43
static void print_info_errcode(__u8 n, __native x[])
-
 
44
{
43
    char *symbol = get_symtab_entry(stack[1]); \
45
    char *symbol;
-
 
46
 
44
    if (!symbol) \
47
    if (!(symbol=get_symtab_entry(x[1])))
45
        symbol = ""; \
48
        symbol = "";
-
 
49
 
46
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
50
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__);
47
    printf("%%rip: %Q (%s)\n",x[1],symbol); \
51
    printf("%%rip: %Q (%s)\n",x[1],symbol);
48
    printf("ERROR_WORD=%Q\n", x[0]); \
52
    printf("ERROR_WORD=%Q\n", x[0]);
49
    printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", x[2], x[3],read_cr0()); \
53
    printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", x[2], x[3],read_cr0());
50
    printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-2],x[-3],x[-4]); \
54
    printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-2],x[-3],x[-4]);
51
    printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-5],x[-6],x[-7]); \
55
    printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-5],x[-6],x[-7]);
52
    printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-8],x[-9],x[-10]); \
56
    printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-8],x[-9],x[-10]);
53
    printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-11],x[-12],x[-13]); \
57
    printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-11],x[-12],x[-13]);
54
    printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-14],x[-15],x); \
58
    printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-14],x[-15],x);
55
    printf("%%rbp=%Q\n",x[-1]); \
59
    printf("%%rbp=%Q\n",x[-1]);
56
    printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); \
60
    printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]);
57
    printf("       %Q, %Q, %Q\n", x[8], x[9], x[10]); \
61
    printf("       %Q, %Q, %Q\n", x[8], x[9], x[10]);
58
    printf("       %Q, %Q, %Q\n", x[11], x[12], x[13]); \
62
    printf("       %Q, %Q, %Q\n", x[11], x[12], x[13]);
59
    printf("       %Q, %Q, %Q\n", x[14], x[15], x[16]); \
63
    printf("       %Q, %Q, %Q\n", x[14], x[15], x[16]);
60
    printf("       %Q, %Q, %Q\n", x[17], x[18], x[19]); \
64
    printf("       %Q, %Q, %Q\n", x[17], x[18], x[19]);
61
    printf("       %Q, %Q, %Q\n", x[20], x[21], x[22]); \
65
    printf("       %Q, %Q, %Q\n", x[20], x[21], x[22]);
62
    printf("       %Q, %Q, %Q\n", x[23], x[24], x[25]); \
66
    printf("       %Q, %Q, %Q\n", x[23], x[24], x[25]);
63
        }
67
}
64
 
68
 
65
/*
69
/*
66
 * Interrupt and exception dispatching.
70
 * Interrupt and exception dispatching.
67
 */
71
 */
68
 
72
 
Line 102... Line 106...
102
    panic("unserviced interrupt\n");
106
    panic("unserviced interrupt\n");
103
}
107
}
104
 
108
 
105
void gp_fault(__u8 n, __native stack[])
109
void gp_fault(__u8 n, __native stack[])
106
{
110
{
107
    PRINT_INFO_ERRCODE(n,stack);
111
    print_info_errcode(n,stack);
108
    panic("general protection fault\n");
112
    panic("general protection fault\n");
109
}
113
}
110
 
114
 
111
void ss_fault(__u8 n, __native stack[])
115
void ss_fault(__u8 n, __native stack[])
112
{
116
{
113
    PRINT_INFO_ERRCODE(n,stack);
117
    print_info_errcode(n,stack);
114
    panic("stack fault\n");
118
    panic("stack fault\n");
115
}
119
}
116
 
120
 
117
 
121
 
118
void nm_fault(__u8 n, __native stack[])
122
void nm_fault(__u8 n, __native stack[])
Line 134... Line 138...
134
 
138
 
135
 
139
 
136
 
140
 
137
void page_fault(__u8 n, __native stack[])
141
void page_fault(__u8 n, __native stack[])
138
{
142
{
139
    PRINT_INFO_ERRCODE(n,stack);
143
    print_info_errcode(n,stack);
140
    printf("Page fault address: %Q\n", read_cr2());
144
    printf("Page fault address: %Q\n", read_cr2());
141
    panic("page fault\n");
145
    panic("page fault\n");
142
}
146
}
143
 
147
 
144
void syscall(__u8 n, __native stack[])
148
void syscall(__u8 n, __native stack[])