Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/interrupt.c

    r22a28a69 rb60c582  
    4141#include <debug.h>
    4242#include <console/console.h>
    43 #include <typedefs.h>
     43#include <arch/types.h>
    4444#include <arch/asm.h>
    4545#include <arch/barrier.h>
     
    5757#include <putchar.h>
    5858
    59 #define VECTORS_64_BUNDLE        20
    60 #define VECTORS_16_BUNDLE        48
    61 #define VECTORS_16_BUNDLE_START  0x5000
    62 
    63 #define VECTOR_MAX  0x7f00
    64 
    65 #define BUNDLE_SIZE  16
    66 
    67 static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
     59#define VECTORS_64_BUNDLE       20
     60#define VECTORS_16_BUNDLE       48
     61#define VECTORS_16_BUNDLE_START 0x5000
     62#define VECTOR_MAX              0x7f00
     63
     64#define BUNDLE_SIZE             16
     65
     66char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
    6867        "VHPT Translation vector",
    6968        "Instruction TLB vector",
     
    8887};
    8988
    90 static const char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {
     89char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {
    9190        "Page Not Present vector",
    9291        "Key Permission vector",
     
    122121};
    123122
    124 static const char *vector_to_string(uint16_t vector)
     123static char *vector_to_string(uint16_t vector);
     124static void dump_interrupted_context(istate_t *istate);
     125
     126char *vector_to_string(uint16_t vector)
    125127{
    126128        ASSERT(vector <= VECTOR_MAX);
     
    133135}
    134136
    135 void istate_decode(istate_t *istate)
    136 {
     137void dump_interrupted_context(istate_t *istate)
     138{
     139        char *ifa, *iipa, *iip;
     140
     141        ifa = symtab_fmt_name_lookup(istate->cr_ifa);
     142        iipa = symtab_fmt_name_lookup(istate->cr_iipa);
     143        iip = symtab_fmt_name_lookup(istate->cr_iip);
     144
     145        putchar('\n');
     146        printf("Interrupted context dump:\n");
    137147        printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp,
    138148            istate->ar_bspstore);
     
    144154            istate->cr_ipsr);
    145155       
    146         printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei,
    147             symtab_fmt_name_lookup(istate->cr_iip));
    148         printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa,
    149             symtab_fmt_name_lookup(istate->cr_iipa));
    150         printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa,
    151             symtab_fmt_name_lookup(istate->cr_ifa));
     156        printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip,
     157            istate->cr_isr.ei, iip);
     158        printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa, iipa);
     159        printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa, ifa);
    152160}
    153161
    154162void general_exception(uint64_t vector, istate_t *istate)
    155163{
    156         const char *desc;
    157        
     164        char *desc = "";
     165
    158166        switch (istate->cr_isr.ge_code) {
    159167        case GE_ILLEGALOP:
     
    179187                break;
    180188        }
    181        
     189
    182190        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    183         panic_badtrap(istate, vector, "General Exception (%s).", desc);
     191
     192        dump_interrupted_context(istate);
     193        panic("General Exception (%s).", desc);
    184194}
    185195
     
    191201        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    192202            (uint16_t) vector, vector_to_string(vector));
    193         panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    194             (uint16_t) vector, vector_to_string(vector));
     203        dump_interrupted_context(istate);
     204        panic("Interruption: %#hx (%s).", (uint16_t) vector,
     205            vector_to_string(vector));
    195206#endif
    196207}
     
    212223                istate->cr_ipsr.ri++;
    213224        }
    214        
     225
    215226        return syscall_handler(istate->in0, istate->in1, istate->in2,
    216227            istate->in3, istate->in4, istate->in5, istate->in6);
     
    221232        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    222233            (uint16_t) vector, vector_to_string(vector));
    223         panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    224             (uint16_t) vector, vector_to_string(vector));
     234        dump_interrupted_context(istate);
     235        panic("Interruption: %#hx (%s).", (uint16_t) vector,
     236            vector_to_string(vector));
    225237}
    226238
    227239static void end_of_local_irq(void)
    228240{
    229         asm volatile (
    230                 "mov cr.eoi=r0;;"
    231         );
    232 }
     241        asm volatile ("mov cr.eoi=r0;;");
     242}
     243
    233244
    234245void external_interrupt(uint64_t vector, istate_t *istate)
    235246{
    236247        cr_ivr_t ivr;
     248        irq_t *irq;
    237249       
    238250        ivr.value = ivr_read();
    239251        srlz_d();
    240        
    241         irq_t *irq;
    242        
     252
    243253        switch (ivr.vector) {
    244254        case INTERRUPT_SPURIOUS:
     
    247257#endif
    248258                break;
    249        
     259
    250260#ifdef CONFIG_SMP
    251261        case VECTOR_TLB_SHOOTDOWN_IPI:
     
    254264                break;
    255265#endif
    256        
     266
    257267        case INTERRUPT_TIMER:
    258268                irq = irq_dispatch_and_lock(ivr.vector);
    259269                if (irq) {
    260270                        irq->handler(irq);
    261                         irq_spinlock_unlock(&irq->lock, false);
     271                        spinlock_unlock(&irq->lock);
    262272                } else {
    263273                        panic("Unhandled Internal Timer Interrupt (%d).",
     
    278288                        if (!irq->preack)
    279289                                end_of_local_irq();
    280                         irq_spinlock_unlock(&irq->lock, false);
     290                        spinlock_unlock(&irq->lock);
    281291                } else {
    282292                        /*
Note: See TracChangeset for help on using the changeset viewer.