Rev 769 | Rev 825 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 769 | Rev 799 | ||
|---|---|---|---|
| Line 56... | Line 56... | ||
| 56 | stack++; |
56 | stack++; |
| 57 | } |
57 | } |
| 58 | printf("\n"); |
58 | printf("\n"); |
| 59 | } |
59 | } |
| 60 | */ |
60 | */ |
| - | 61 | ||
| 61 | static void print_info_errcode(int n, void *st) |
62 | static void print_info_errcode(int n, struct interrupt_context *ctx) |
| 62 | { |
63 | { |
| 63 | char *symbol; |
64 | char *symbol; |
| 64 | __native *x = (__native *) st; |
65 | __u64 *x = &ctx->stack[0]; |
| 65 | 66 | ||
| 66 | if (!(symbol=get_symtab_entry(x[1]))) |
67 | if (!(symbol=get_symtab_entry(x[1]))) |
| 67 | symbol = ""; |
68 | symbol = ""; |
| 68 | 69 | ||
| 69 | printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); |
70 | printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); |
| 70 | printf("%%rip: %Q (%s)\n",x[1],symbol); |
71 | printf("%%rip: %Q (%s)\n",ctx->stack[1],symbol); |
| 71 | printf("ERROR_WORD=%Q\n", x[0]); |
72 | printf("ERROR_WORD=%Q\n", ctx->stack[0]); |
| 72 | printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", x[2], x[3],read_cr0()); |
73 | printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", ctx->stack[2], |
| - | 74 | ctx->stack[3],read_cr0()); |
|
| 73 | printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-2],x[-3],x[-4]); |
75 | printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",ctx->rax,ctx->rbx,ctx->rcx); |
| 74 | printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-5],x[-6],x[-7]); |
76 | printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",ctx->rdx,ctx->rsi,ctx->rdi); |
| 75 | printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-8],x[-9],x[-10]); |
77 | printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",ctx->r8,ctx->r9,ctx->r10); |
| 76 | printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-11],x[-12],x[-13]); |
78 | printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",ctx->r11,ctx->r12,ctx->r13); |
| 77 | printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-14],x[-15],x); |
79 | printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",ctx->r14,ctx->r15,&ctx->stack[0]); |
| 78 | printf("%%rbp=%Q\n",x[-1]); |
80 | printf("%%rbp=%Q\n",ctx->rbp); |
| 79 | printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); |
81 | printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); |
| 80 | printf(" %Q, %Q, %Q\n", x[8], x[9], x[10]); |
82 | printf(" %Q, %Q, %Q\n", x[8], x[9], x[10]); |
| 81 | printf(" %Q, %Q, %Q\n", x[11], x[12], x[13]); |
83 | printf(" %Q, %Q, %Q\n", x[11], x[12], x[13]); |
| 82 | printf(" %Q, %Q, %Q\n", x[14], x[15], x[16]); |
84 | printf(" %Q, %Q, %Q\n", x[14], x[15], x[16]); |
| 83 | printf(" %Q, %Q, %Q\n", x[17], x[18], x[19]); |
- | |
| 84 | printf(" %Q, %Q, %Q\n", x[20], x[21], x[22]); |
- | |
| 85 | printf(" %Q, %Q, %Q\n", x[23], x[24], x[25]); |
- | |
| 86 | // messy_stack_trace(&x[5]); |
85 | // messy_stack_trace(&x[5]); |
| 87 | } |
86 | } |
| 88 | 87 | ||
| 89 | /* |
88 | /* |
| 90 | * Interrupt and exception dispatching. |
89 | * Interrupt and exception dispatching. |
| Line 92... | Line 91... | ||
| 92 | 91 | ||
| 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 | void null_interrupt(int n, void *st) |
96 | void null_interrupt(int n, struct interrupt_context *ctx) |
| 98 | { |
97 | { |
| 99 | __native *stack = (__native *) st; |
- | |
| 100 | - | ||
| 101 | printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \ |
98 | printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \ |
| 102 | printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]); |
99 | printf("stack: %X, %X, %X, %X\n", ctx->stack[0], ctx->stack[1], |
| - | 100 | ctx->stack[2], ctx->stack[3]); |
|
| 103 | panic("unserviced interrupt\n"); |
101 | panic("unserviced interrupt\n"); |
| 104 | } |
102 | } |
| 105 | 103 | ||
| 106 | void gp_fault(int n, void *stack) |
104 | void gp_fault(int n, void *stack) |
| 107 | { |
105 | { |
| Line 123... | Line 121... | ||
| 123 | #else |
121 | #else |
| 124 | panic("fpu fault"); |
122 | panic("fpu fault"); |
| 125 | #endif |
123 | #endif |
| 126 | } |
124 | } |
| 127 | 125 | ||
| 128 | void page_fault(int n, void *stack) |
126 | void page_fault(int n, struct interrupt_context *ctx) |
| 129 | { |
127 | { |
| 130 | __address page; |
128 | __address page; |
| 131 | 129 | ||
| 132 | page = read_cr2(); |
130 | page = read_cr2(); |
| 133 | if (!as_page_fault(page)) { |
131 | if (!as_page_fault(page)) { |
| 134 | print_info_errcode(n,stack); |
132 | print_info_errcode(n,ctx); |
| 135 | printf("Page fault address: %Q\n", page); |
133 | printf("Page fault address: %Q\n", page); |
| 136 | panic("page fault\n"); |
134 | panic("page fault\n"); |
| 137 | } |
135 | } |
| 138 | } |
136 | } |
| 139 | 137 | ||
| 140 | void syscall(int n, void *stack) |
- | |
| 141 | { |
- | |
| 142 | printf("cpu%d: syscall\n", CPU->id); |
- | |
| 143 | thread_usleep(1000); |
- | |
| 144 | } |
- | |
| 145 | - | ||
| 146 | void tlb_shootdown_ipi(int n, void *stack) |
138 | void tlb_shootdown_ipi(int n, void *stack) |
| 147 | { |
139 | { |
| 148 | trap_virtual_eoi(); |
140 | trap_virtual_eoi(); |
| 149 | tlb_shootdown_ipi_recv(); |
141 | tlb_shootdown_ipi_recv(); |
| 150 | } |
142 | } |