Ignore:
File:
1 edited

Legend:

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

    rb60c582 r7e752b2  
    4141#include <debug.h>
    4242#include <console/console.h>
    43 #include <arch/types.h>
     43#include <typedefs.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 #define VECTOR_MAX              0x7f00
    63 
    64 #define BUNDLE_SIZE             16
    65 
    66 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
     63#define VECTOR_MAX  0x7f00
     64
     65#define BUNDLE_SIZE  16
     66
     67static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
    6768        "VHPT Translation vector",
    6869        "Instruction TLB vector",
     
    8788};
    8889
    89 char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {
     90static const char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {
    9091        "Page Not Present vector",
    9192        "Key Permission vector",
     
    121122};
    122123
    123 static char *vector_to_string(uint16_t vector);
    124 static void dump_interrupted_context(istate_t *istate);
    125 
    126 char *vector_to_string(uint16_t vector)
     124static const char *vector_to_string(uint16_t vector)
    127125{
    128126        ASSERT(vector <= VECTOR_MAX);
     
    135133}
    136134
    137 void 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");
    147         printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp,
    148             istate->ar_bspstore);
    149         printf("ar.rnat=%#018llx\tar.rsc=%#018llx\n", istate->ar_rnat,
    150             istate->ar_rsc);
    151         printf("ar.ifs=%#018llx\tar.pfs=%#018llx\n", istate->ar_ifs,
    152             istate->ar_pfs);
    153         printf("cr.isr=%#018llx\tcr.ipsr=%#018llx\t\n", istate->cr_isr.value,
    154             istate->cr_ipsr);
    155        
    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);
     135void istate_decode(istate_t *istate)
     136{
     137        printf("ar.bsp=%p\tar.bspstore=%p\n",
     138            (void *) istate->ar_bsp, (void *) istate->ar_bspstore);
     139        printf("ar.rnat=%#0" PRIx64 "\tar.rsc=%#0" PRIx64 "\n",
     140            istate->ar_rnat, istate->ar_rsc);
     141        printf("ar.ifs=%#0" PRIx64 "\tar.pfs=%#0" PRIx64 "\n",
     142            istate->ar_ifs, istate->ar_pfs);
     143        printf("cr.isr=%#0" PRIx64 "\tcr.ipsr=%#0" PRIx64 "\n",
     144            istate->cr_isr.value, istate->cr_ipsr.value);
     145       
     146        printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n",
     147            istate->cr_iip, istate->cr_isr.ei,
     148            symtab_fmt_name_lookup(istate->cr_iip));
     149        printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa,
     150            symtab_fmt_name_lookup(istate->cr_iipa));
     151        printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa,
     152            symtab_fmt_name_lookup(istate->cr_ifa));
    160153}
    161154
    162155void general_exception(uint64_t vector, istate_t *istate)
    163156{
    164         char *desc = "";
    165 
     157        const char *desc;
     158       
    166159        switch (istate->cr_isr.ge_code) {
    167160        case GE_ILLEGALOP:
     
    187180                break;
    188181        }
    189 
     182       
    190183        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    191 
    192         dump_interrupted_context(istate);
    193         panic("General Exception (%s).", desc);
     184        panic_badtrap(istate, vector, "General Exception (%s).", desc);
    194185}
    195186
     
    201192        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    202193            (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));
     194        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
     195            (uint16_t) vector, vector_to_string(vector));
    206196#endif
    207197}
     
    223213                istate->cr_ipsr.ri++;
    224214        }
    225 
     215       
    226216        return syscall_handler(istate->in0, istate->in1, istate->in2,
    227217            istate->in3, istate->in4, istate->in5, istate->in6);
     
    232222        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    233223            (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));
     224        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
     225            (uint16_t) vector, vector_to_string(vector));
    237226}
    238227
    239228static void end_of_local_irq(void)
    240229{
    241         asm volatile ("mov cr.eoi=r0;;");
    242 }
    243 
     230        asm volatile (
     231                "mov cr.eoi=r0;;"
     232        );
     233}
    244234
    245235void external_interrupt(uint64_t vector, istate_t *istate)
    246236{
    247237        cr_ivr_t ivr;
    248         irq_t *irq;
    249238       
    250239        ivr.value = ivr_read();
    251240        srlz_d();
    252 
     241       
     242        irq_t *irq;
     243       
    253244        switch (ivr.vector) {
    254245        case INTERRUPT_SPURIOUS:
     
    257248#endif
    258249                break;
    259 
     250       
    260251#ifdef CONFIG_SMP
    261252        case VECTOR_TLB_SHOOTDOWN_IPI:
     
    264255                break;
    265256#endif
    266 
     257       
    267258        case INTERRUPT_TIMER:
    268259                irq = irq_dispatch_and_lock(ivr.vector);
    269260                if (irq) {
    270261                        irq->handler(irq);
    271                         spinlock_unlock(&irq->lock);
     262                        irq_spinlock_unlock(&irq->lock, false);
    272263                } else {
    273264                        panic("Unhandled Internal Timer Interrupt (%d).",
     
    288279                        if (!irq->preack)
    289280                                end_of_local_irq();
    290                         spinlock_unlock(&irq->lock);
     281                        irq_spinlock_unlock(&irq->lock, false);
    291282                } else {
    292283                        /*
Note: See TracChangeset for help on using the changeset viewer.