Ignore:
File:
1 edited

Legend:

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

    rb60c582 r22a28a69  
    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");
     135void istate_decode(istate_t *istate)
     136{
    147137        printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp,
    148138            istate->ar_bspstore);
     
    154144            istate->cr_ipsr);
    155145       
    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);
     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));
    160152}
    161153
    162154void general_exception(uint64_t vector, istate_t *istate)
    163155{
    164         char *desc = "";
    165 
     156        const char *desc;
     157       
    166158        switch (istate->cr_isr.ge_code) {
    167159        case GE_ILLEGALOP:
     
    187179                break;
    188180        }
    189 
     181       
    190182        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    191 
    192         dump_interrupted_context(istate);
    193         panic("General Exception (%s).", desc);
     183        panic_badtrap(istate, vector, "General Exception (%s).", desc);
    194184}
    195185
     
    201191        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    202192            (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));
     193        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
     194            (uint16_t) vector, vector_to_string(vector));
    206195#endif
    207196}
     
    223212                istate->cr_ipsr.ri++;
    224213        }
    225 
     214       
    226215        return syscall_handler(istate->in0, istate->in1, istate->in2,
    227216            istate->in3, istate->in4, istate->in5, istate->in6);
     
    232221        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    233222            (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));
     223        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
     224            (uint16_t) vector, vector_to_string(vector));
    237225}
    238226
    239227static void end_of_local_irq(void)
    240228{
    241         asm volatile ("mov cr.eoi=r0;;");
    242 }
    243 
     229        asm volatile (
     230                "mov cr.eoi=r0;;"
     231        );
     232}
    244233
    245234void external_interrupt(uint64_t vector, istate_t *istate)
    246235{
    247236        cr_ivr_t ivr;
    248         irq_t *irq;
    249237       
    250238        ivr.value = ivr_read();
    251239        srlz_d();
    252 
     240       
     241        irq_t *irq;
     242       
    253243        switch (ivr.vector) {
    254244        case INTERRUPT_SPURIOUS:
     
    257247#endif
    258248                break;
    259 
     249       
    260250#ifdef CONFIG_SMP
    261251        case VECTOR_TLB_SHOOTDOWN_IPI:
     
    264254                break;
    265255#endif
    266 
     256       
    267257        case INTERRUPT_TIMER:
    268258                irq = irq_dispatch_and_lock(ivr.vector);
    269259                if (irq) {
    270260                        irq->handler(irq);
    271                         spinlock_unlock(&irq->lock);
     261                        irq_spinlock_unlock(&irq->lock, false);
    272262                } else {
    273263                        panic("Unhandled Internal Timer Interrupt (%d).",
     
    288278                        if (!irq->preack)
    289279                                end_of_local_irq();
    290                         spinlock_unlock(&irq->lock);
     280                        irq_spinlock_unlock(&irq->lock, false);
    291281                } else {
    292282                        /*
Note: See TracChangeset for help on using the changeset viewer.