Rev 445 | Rev 472 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 445 | Rev 470 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | * Copyright (C) 2005 Jakub Jermar |
2 | * Copyright (C) 2005 Jakub Jermar |
- | 3 | * Copyright (C) 2005 Jakub Vana |
|
3 | * All rights reserved. |
4 | * All rights reserved. |
4 | * |
5 | * |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
7 | * modification, are permitted provided that the following conditions |
7 | * are met: |
8 | * are met: |
Line 34... | Line 35... | ||
34 | #include <arch/asm.h> |
35 | #include <arch/asm.h> |
35 | #include <arch/barrier.h> |
36 | #include <arch/barrier.h> |
36 | #include <arch/register.h> |
37 | #include <arch/register.h> |
37 | #include <arch/drivers/it.h> |
38 | #include <arch/drivers/it.h> |
38 | #include <arch.h> |
39 | #include <arch.h> |
- | 40 | #include <symtab.h> |
|
- | 41 | #include <debug.h> |
|
39 | 42 | ||
- | 43 | #define VECTORS_64_BUNDLE 20 |
|
- | 44 | #define VECTORS_16_BUNDLE 48 |
|
- | 45 | #define VECTORS_16_BUNDLE_START 0x5000 |
|
- | 46 | #define VECTOR_MAX 0x7f00 |
|
- | 47 | ||
- | 48 | #define BUNDLE_SIZE 16 |
|
- | 49 | ||
- | 50 | char *vector_names_64_bundle[VECTORS_64_BUNDLE] = { |
|
- | 51 | "VHPT Translation vector", |
|
- | 52 | "Instruction TLB vector", |
|
- | 53 | "Data TLB vector", |
|
- | 54 | "Alternate Instruction TLB vector", |
|
- | 55 | "Alternate Data TLB vector", |
|
- | 56 | "Data Nested TLB vector", |
|
- | 57 | "Instruction Key Miss vector", |
|
- | 58 | "Data Key Miss vector", |
|
- | 59 | "Dirty-Bit vector", |
|
- | 60 | "Instruction Access-Bit vector", |
|
- | 61 | "Data Access-Bit vector" |
|
- | 62 | "Break Instruction vector", |
|
40 | void external_interrupt(void) |
63 | "External Interrupt vector" |
- | 64 | "Reserved", |
|
- | 65 | "Reserved", |
|
- | 66 | "Reserved", |
|
- | 67 | "Reserved", |
|
- | 68 | "Reserved", |
|
- | 69 | "Reserved", |
|
- | 70 | "Reserved" |
|
- | 71 | }; |
|
- | 72 | ||
- | 73 | char *vector_names_16_bundle[VECTORS_16_BUNDLE] = { |
|
- | 74 | "Page Not Present vector", |
|
- | 75 | "Key Permission vector", |
|
- | 76 | "Instruction Access rights vector", |
|
- | 77 | "Data Access Rights vector", |
|
- | 78 | "General Exception vector", |
|
- | 79 | "Disabled FP-Register vector", |
|
- | 80 | "NaT Consumption vector", |
|
- | 81 | "Speculation vector", |
|
- | 82 | "Reserved", |
|
- | 83 | "Debug vector", |
|
- | 84 | "Unaligned Reference vector", |
|
- | 85 | "Unsupported Data Reference vector", |
|
- | 86 | "Floating-point Fault vector", |
|
- | 87 | "Floating-point Trap vector", |
|
- | 88 | "Lower-Privilege Transfer Trap vector", |
|
- | 89 | "Taken Branch Trap vector", |
|
- | 90 | "Single STep Trap vector", |
|
- | 91 | "Reserved", |
|
- | 92 | "Reserved", |
|
- | 93 | "Reserved", |
|
- | 94 | "Reserved", |
|
- | 95 | "Reserved", |
|
- | 96 | "Reserved", |
|
- | 97 | "Reserved", |
|
- | 98 | "Reserved", |
|
- | 99 | "IA-32 Exception vector", |
|
- | 100 | "IA-32 Intercept vector", |
|
- | 101 | "IA-32 Interrupt vector", |
|
- | 102 | "Reserved", |
|
- | 103 | "Reserved", |
|
- | 104 | "Reserved" |
|
- | 105 | }; |
|
- | 106 | ||
- | 107 | static char *vector_to_string(__u16 vector); |
|
- | 108 | static void dump_stack(struct exception_regdump *pstate); |
|
- | 109 | ||
- | 110 | char *vector_to_string(__u16 vector) |
|
- | 111 | { |
|
- | 112 | ASSERT(vector <= VECTOR_MAX); |
|
- | 113 | ||
- | 114 | if (vector >= VECTORS_16_BUNDLE_START) |
|
- | 115 | return vector_names_16_bundle[(vector-VECTORS_16_BUNDLE_START)/(16*BUNDLE_SIZE)]; |
|
- | 116 | else |
|
- | 117 | return vector_names_64_bundle[vector/(64*BUNDLE_SIZE)]; |
|
- | 118 | } |
|
- | 119 | ||
- | 120 | void dump_stack(struct exception_regdump *pstate) |
|
- | 121 | { |
|
- | 122 | char *ifa, *iipa, *iip; |
|
- | 123 | ||
- | 124 | ifa = get_symtab_entry(pstate->cr_ifa); |
|
- | 125 | iipa = get_symtab_entry(pstate->cr_iipa); |
|
- | 126 | iip = get_symtab_entry(pstate->cr_iip); |
|
- | 127 | ||
- | 128 | putchar('\n'); |
|
- | 129 | printf("ar.bsp=%P\tar.bspstore=%P\n", pstate->ar_bsp, pstate->ar_bspstore); |
|
- | 130 | printf("ar.rnat=%Q\tar.rsc=%Q\n", pstate->ar_rnat, pstate->ar_rsc); |
|
- | 131 | printf("ar.ifs=%Q\tar.pfs=%Q\n", pstate->ar_ifs, pstate->ar_pfs); |
|
- | 132 | printf("cr.isr=%Q\tcr.ips=%Q\t\n", pstate->cr_isr, pstate->cr_ips); |
|
- | 133 | ||
- | 134 | printf("cr.iip=%Q (%s)\n", pstate->cr_iip, iip ? iip : "?"); |
|
- | 135 | printf("cr.iipa=%Q (%s)\n", pstate->cr_iipa, iipa ? iipa : "?"); |
|
- | 136 | printf("cr.ifa=%Q (%s)\n", pstate->cr_ifa, ifa ? ifa : "?"); |
|
- | 137 | } |
|
- | 138 | ||
- | 139 | void general_exception(__u64 vector, struct exception_regdump *pstate) |
|
- | 140 | { |
|
- | 141 | dump_stack(pstate); |
|
- | 142 | panic("General Exception\n"); |
|
- | 143 | } |
|
- | 144 | ||
- | 145 | void break_instruction(__u64 vector, struct exception_regdump *pstate) |
|
- | 146 | { |
|
- | 147 | dump_stack(pstate); |
|
- | 148 | panic("Break Instruction\n"); |
|
- | 149 | } |
|
- | 150 | ||
- | 151 | void universal_handler(__u64 vector, struct exception_regdump *pstate) |
|
- | 152 | { |
|
- | 153 | dump_stack(pstate); |
|
- | 154 | panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector)); |
|
- | 155 | } |
|
- | 156 | ||
- | 157 | void external_interrupt(__u64 vector, struct exception_regdump *pstate) |
|
41 | { |
158 | { |
42 | cr_ivr_t ivr; |
159 | cr_ivr_t ivr; |
43 | 160 | ||
44 | ivr.value = ivr_read(); |
161 | ivr.value = ivr_read(); |
45 | srlz_d(); |
162 | srlz_d(); |