Subversion Repositories HelenOS-historic

Rev

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

Rev 534 Rev 576
Line 55... Line 55...
55
        stack++;
55
        stack++;
56
    }
56
    }
57
    printf("\n");
57
    printf("\n");
58
}
58
}
59
 
59
 
60
static void print_info_errcode(__u8 n, __native x[])
60
static void print_info_errcode(int n, void *st)
61
{
61
{
62
    char *symbol;
62
    char *symbol;
-
 
63
    __native *x = (__native *) st;
63
 
64
 
64
    if (!(symbol=get_symtab_entry(x[1])))
65
    if (!(symbol=get_symtab_entry(x[1])))
65
        symbol = "";
66
        symbol = "";
66
 
67
 
67
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__);
68
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__);
Line 86... Line 87...
86
 
87
 
87
/*
88
/*
88
 * Interrupt and exception dispatching.
89
 * Interrupt and exception dispatching.
89
 */
90
 */
90
 
91
 
91
static iroutine ivt[IVT_ITEMS];
-
 
92
 
-
 
93
void (* disable_irqs_function)(__u16 irqmask) = NULL;
92
void (* disable_irqs_function)(__u16 irqmask) = NULL;
94
void (* enable_irqs_function)(__u16 irqmask) = NULL;
93
void (* enable_irqs_function)(__u16 irqmask) = NULL;
95
void (* eoi_function)(void) = NULL;
94
void (* eoi_function)(void) = NULL;
96
 
95
 
97
iroutine trap_register(__u8 n, iroutine f)
-
 
98
{
-
 
99
    ASSERT(n < IVT_ITEMS);
-
 
100
   
-
 
101
    iroutine old;
-
 
102
   
-
 
103
    old = ivt[n];
-
 
104
    ivt[n] = f;
-
 
105
   
-
 
106
    return old;
-
 
107
}
-
 
108
 
-
 
109
/*
-
 
110
 * Called directly from the assembler code.
-
 
111
 * CPU is interrupts_disable()'d.
-
 
112
 */
-
 
113
void trap_dispatcher(__u8 n, __native stack[])
96
void null_interrupt(int n, void *st)
114
{
97
{
115
    ASSERT(n < IVT_ITEMS);
98
    __native *stack = (__native *) st;
116
   
-
 
117
    ivt[n](n, stack);
-
 
118
}
-
 
119
 
99
 
120
void null_interrupt(__u8 n, __native stack[])
-
 
121
{
-
 
122
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
100
    printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
123
    printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
101
    printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
124
    panic("unserviced interrupt\n");
102
    panic("unserviced interrupt\n");
125
}
103
}
126
 
104
 
127
void gp_fault(__u8 n, __native stack[])
105
void gp_fault(int n, void *stack)
128
{
106
{
129
    print_info_errcode(n,stack);
107
    print_info_errcode(n,stack);
130
    panic("general protection fault\n");
108
    panic("general protection fault\n");
131
}
109
}
132
 
110
 
133
void ss_fault(__u8 n, __native stack[])
111
void ss_fault(int n, void *stack)
134
{
112
{
135
    print_info_errcode(n,stack);
113
    print_info_errcode(n,stack);
136
    panic("stack fault\n");
114
    panic("stack fault\n");
137
}
115
}
138
 
116
 
139
 
117
 
140
void nm_fault(__u8 n, __native stack[])
118
void nm_fault(int n, void *stack)
141
{
119
{
142
#ifdef CONFIG_FPU_LAZY     
120
#ifdef CONFIG_FPU_LAZY     
143
    scheduler_fpu_lazy_request();
121
    scheduler_fpu_lazy_request();
144
#else
122
#else
145
    panic("fpu fault");
123
    panic("fpu fault");
146
#endif
124
#endif
147
}
125
}
148
 
126
 
149
 
127
 
150
 
128
 
151
void page_fault(__u8 n, __native stack[])
129
void page_fault(int n, void *stack)
152
{
130
{
153
    print_info_errcode(n,stack);
131
    print_info_errcode(n,stack);
154
    printf("Page fault address: %Q\n", read_cr2());
132
    printf("Page fault address: %Q\n", read_cr2());
155
    panic("page fault\n");
133
    panic("page fault\n");
156
}
134
}
157
 
135
 
158
void syscall(__u8 n, __native stack[])
136
void syscall(int n, void *stack)
159
{
137
{
160
    printf("cpu%d: syscall\n", CPU->id);
138
    printf("cpu%d: syscall\n", CPU->id);
161
    thread_usleep(1000);
139
    thread_usleep(1000);
162
}
140
}
163
 
141
 
164
void tlb_shootdown_ipi(__u8 n, __native stack[])
142
void tlb_shootdown_ipi(int n, void *stack)
165
{
143
{
166
    trap_virtual_eoi();
144
    trap_virtual_eoi();
167
    tlb_shootdown_ipi_recv();
145
    tlb_shootdown_ipi_recv();
168
}
146
}
169
 
147
 
170
void wakeup_ipi(__u8 n, __native stack[])
148
void wakeup_ipi(int n, void *stack)
171
{
149
{
172
    trap_virtual_eoi();
150
    trap_virtual_eoi();
173
}
151
}
174
 
152
 
175
void trap_virtual_enable_irqs(__u16 irqmask)
153
void trap_virtual_enable_irqs(__u16 irqmask)