Ignore:
File:
1 edited

Legend:

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

    r416ef49 r9d58539  
    5454#include <synch/spinlock.h>
    5555#include <mm/tlb.h>
    56 #include <arch/mm/tlb.h>
    5756#include <symtab.h>
    5857#include <putchar.h>
     
    6059#define VECTORS_64_BUNDLE        20
    6160#define VECTORS_16_BUNDLE        48
    62 #define VECTORS_16_BUNDLE_START  0x50
    63 
    64 #define VECTOR_MAX  0x7f
     61#define VECTORS_16_BUNDLE_START  0x5000
     62
     63#define VECTOR_MAX  0x7f00
     64
     65#define BUNDLE_SIZE  16
    6566
    6667static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
     
    121122};
    122123
    123 static const char *vector_to_string(unsigned int n)
    124 {
    125         ASSERT(n <= VECTOR_MAX);
    126        
    127         if (n >= VECTORS_16_BUNDLE_START)
    128                 return vector_names_16_bundle[n - VECTORS_16_BUNDLE_START];
     124static const char *vector_to_string(uint16_t vector)
     125{
     126        ASSERT(vector <= VECTOR_MAX);
     127       
     128        if (vector >= VECTORS_16_BUNDLE_START)
     129                return vector_names_16_bundle[(vector -
     130                    VECTORS_16_BUNDLE_START) / (16 * BUNDLE_SIZE)];
    129131        else
    130                 return vector_names_64_bundle[n / 4];
     132                return vector_names_64_bundle[vector / (64 * BUNDLE_SIZE)];
    131133}
    132134
     
    151153}
    152154
    153 void general_exception(unsigned int n, istate_t *istate)
     155void general_exception(uint64_t vector, istate_t *istate)
    154156{
    155157        const char *desc;
     
    180182       
    181183        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    182         panic_badtrap(istate, n, "General Exception (%s).", desc);
    183 }
    184 
    185 void disabled_fp_register(unsigned int n, istate_t *istate)
     184        panic_badtrap(istate, vector, "General Exception (%s).", desc);
     185}
     186
     187void disabled_fp_register(uint64_t vector, istate_t *istate)
    186188{
    187189#ifdef CONFIG_FPU_LAZY
     
    189191#else
    190192        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    191             (uint16_t) n, vector_to_string(n));
     193            (uint16_t) vector, vector_to_string(vector));
    192194        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    193             (uint16_t) n, vector_to_string(n));
     195            (uint16_t) vector, vector_to_string(vector));
    194196#endif
    195197}
    196198
     199void nop_handler(uint64_t vector, istate_t *istate)
     200{
     201}
     202
    197203/** Handle syscall. */
    198 sysarg_t break_instruction(unsigned int n, istate_t *istate)
    199 {
    200         sysarg_t ret;
    201 
     204int break_instruction(uint64_t vector, istate_t *istate)
     205{
    202206        /*
    203207         * Move to next instruction after BREAK.
     
    210214        }
    211215       
    212         interrupts_enable();
    213         ret = syscall_handler(istate->in0, istate->in1, istate->in2,
     216        return syscall_handler(istate->in0, istate->in1, istate->in2,
    214217            istate->in3, istate->in4, istate->in5, istate->in6);
    215         interrupts_disable();
    216 
    217         return ret;
    218 }
    219 
    220 void universal_handler(unsigned int n, istate_t *istate)
     218}
     219
     220void universal_handler(uint64_t vector, istate_t *istate)
    221221{
    222222        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    223             n, vector_to_string(n));
    224         panic_badtrap(istate, n, "Interruption: %#hx (%s).",
    225             n, vector_to_string(n));
     223            (uint16_t) vector, vector_to_string(vector));
     224        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
     225            (uint16_t) vector, vector_to_string(vector));
    226226}
    227227
     
    229229{
    230230        asm volatile (
    231                 "mov cr.eoi = r0 ;;"
     231                "mov cr.eoi=r0;;"
    232232        );
    233233}
    234234
    235 void external_interrupt(unsigned int n, istate_t *istate)
     235void external_interrupt(uint64_t vector, istate_t *istate)
    236236{
    237237        cr_ivr_t ivr;
     
    298298}
    299299
    300 void exception_init(void)
    301 {
    302         unsigned int i;
    303 
    304         for (i = 0; i < IVT_ITEMS; i++)
    305                 exc_register(i, "universal_handler", false, universal_handler);
    306 
    307         exc_register(EXC_ALT_ITLB_FAULT,
    308             vector_to_string(EXC_ALT_ITLB_FAULT), true,
    309             alternate_instruction_tlb_fault);
    310         exc_register(EXC_ALT_DTLB_FAULT,
    311             vector_to_string(EXC_ALT_DTLB_FAULT), true,
    312             alternate_data_tlb_fault);
    313         exc_register(EXC_NESTED_TLB_FAULT,
    314             vector_to_string(EXC_NESTED_TLB_FAULT), false,
    315             data_nested_tlb_fault);
    316         exc_register(EXC_DATA_D_BIT_FAULT,
    317             vector_to_string(EXC_DATA_D_BIT_FAULT), true,
    318             data_dirty_bit_fault);
    319         exc_register(EXC_INST_A_BIT_FAULT,
    320             vector_to_string(EXC_INST_A_BIT_FAULT), true,
    321             instruction_access_bit_fault);
    322         exc_register(EXC_DATA_A_BIT_FAULT,
    323             vector_to_string(EXC_DATA_A_BIT_FAULT), true,
    324             data_access_bit_fault);
    325         exc_register(EXC_EXT_INTERRUPT,
    326             vector_to_string(EXC_EXT_INTERRUPT), true,
    327             external_interrupt);
    328 
    329         exc_register(EXC_PAGE_NOT_PRESENT,
    330             vector_to_string(EXC_PAGE_NOT_PRESENT), true,
    331             page_not_present);
    332         exc_register(EXC_DATA_AR_FAULT,
    333             vector_to_string(EXC_DATA_AR_FAULT), true,
    334             data_access_rights_fault);
    335         exc_register(EXC_GENERAL_EXCEPTION,
    336             vector_to_string(EXC_GENERAL_EXCEPTION), false,
    337             general_exception);
    338         exc_register(EXC_DISABLED_FP_REG,
    339             vector_to_string(EXC_DISABLED_FP_REG), true,
    340             disabled_fp_register);
    341 }
    342 
    343300/** @}
    344301 */
Note: See TracChangeset for help on using the changeset viewer.