Changeset 9928240 in mainline for kernel/arch/ia64/src/interrupt.c


Ignore:
Timestamp:
2014-10-12T11:18:49Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
416ef49
Parents:
0b49d4e
Message:

Use exc_dispatcher() for ia64 interruptions.

This is necessary for proper cycle accounting and also CPU state
tracking (idle / non-idle). Syscalls continue to use a different
path, but call syscall_handler() eventually. The speculation
vector needs to be handled differently, outside of exc_dispatch().

File:
1 edited

Legend:

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

    r0b49d4e r9928240  
    5454#include <synch/spinlock.h>
    5555#include <mm/tlb.h>
     56#include <arch/mm/tlb.h>
    5657#include <symtab.h>
    5758#include <putchar.h>
     
    5960#define VECTORS_64_BUNDLE        20
    6061#define VECTORS_16_BUNDLE        48
    61 #define VECTORS_16_BUNDLE_START  0x5000
    62 
    63 #define VECTOR_MAX  0x7f00
    64 
    65 #define BUNDLE_SIZE  16
     62#define VECTORS_16_BUNDLE_START  0x50
     63
     64#define VECTOR_MAX  0x7f
    6665
    6766static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
     
    122121};
    123122
    124 static 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)];
     123static 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];
    131129        else
    132                 return vector_names_64_bundle[vector / (64 * BUNDLE_SIZE)];
     130                return vector_names_64_bundle[n / 4];
    133131}
    134132
     
    153151}
    154152
    155 void general_exception(uint64_t vector, istate_t *istate)
     153void general_exception(unsigned int n, istate_t *istate)
    156154{
    157155        const char *desc;
     
    182180       
    183181        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    184         panic_badtrap(istate, vector, "General Exception (%s).", desc);
    185 }
    186 
    187 void disabled_fp_register(uint64_t vector, istate_t *istate)
     182        panic_badtrap(istate, n, "General Exception (%s).", desc);
     183}
     184
     185void disabled_fp_register(unsigned int n, istate_t *istate)
    188186{
    189187#ifdef CONFIG_FPU_LAZY
     
    191189#else
    192190        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    193             (uint16_t) vector, vector_to_string(vector));
     191            (uint16_t) n, vector_to_string(n));
    194192        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    195             (uint16_t) vector, vector_to_string(vector));
     193            (uint16_t) n, vector_to_string(n));
    196194#endif
    197195}
    198196
    199 void nop_handler(uint64_t vector, istate_t *istate)
    200 {
    201 }
    202 
    203197/** Handle syscall. */
    204 int break_instruction(uint64_t vector, istate_t *istate)
     198sysarg_t break_instruction(unsigned int n, istate_t *istate)
    205199{
    206200        /*
     
    218212}
    219213
    220 void universal_handler(uint64_t vector, istate_t *istate)
     214void universal_handler(unsigned int n, istate_t *istate)
    221215{
    222216        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    223             (uint16_t) vector, vector_to_string(vector));
    224         panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    225             (uint16_t) vector, vector_to_string(vector));
     217            n, vector_to_string(n));
     218        panic_badtrap(istate, n, "Interruption: %#hx (%s).",
     219            n, vector_to_string(n));
    226220}
    227221
     
    229223{
    230224        asm volatile (
    231                 "mov cr.eoi=r0;;"
     225                "mov cr.eoi = r0 ;;"
    232226        );
    233227}
    234228
    235 void external_interrupt(uint64_t vector, istate_t *istate)
     229void external_interrupt(unsigned int n, istate_t *istate)
    236230{
    237231        cr_ivr_t ivr;
     
    298292}
    299293
     294void exception_init(void)
     295{
     296        unsigned int i;
     297
     298        for (i = 0; i < IVT_ITEMS; i++)
     299                exc_register(i, "universal_handler", false, universal_handler);
     300
     301        exc_register(EXC_ALT_ITLB_FAULT,
     302            vector_to_string(EXC_ALT_ITLB_FAULT), true,
     303            alternate_instruction_tlb_fault);
     304        exc_register(EXC_ALT_DTLB_FAULT,
     305            vector_to_string(EXC_ALT_DTLB_FAULT), true,
     306            alternate_data_tlb_fault);
     307        exc_register(EXC_NESTED_TLB_FAULT,
     308            vector_to_string(EXC_NESTED_TLB_FAULT), false,
     309            data_nested_tlb_fault);
     310        exc_register(EXC_DATA_D_BIT_FAULT,
     311            vector_to_string(EXC_DATA_D_BIT_FAULT), true,
     312            data_dirty_bit_fault);
     313        exc_register(EXC_INST_A_BIT_FAULT,
     314            vector_to_string(EXC_INST_A_BIT_FAULT), true,
     315            instruction_access_bit_fault);
     316        exc_register(EXC_DATA_A_BIT_FAULT,
     317            vector_to_string(EXC_DATA_A_BIT_FAULT), true,
     318            data_access_bit_fault);
     319        exc_register(EXC_EXT_INTERRUPT,
     320            vector_to_string(EXC_EXT_INTERRUPT), true,
     321            external_interrupt);
     322
     323        exc_register(EXC_PAGE_NOT_PRESENT,
     324            vector_to_string(EXC_PAGE_NOT_PRESENT), true,
     325            page_not_present);
     326        exc_register(EXC_DATA_AR_FAULT,
     327            vector_to_string(EXC_DATA_AR_FAULT), true,
     328            data_access_rights_fault);
     329        exc_register(EXC_GENERAL_EXCEPTION,
     330            vector_to_string(EXC_GENERAL_EXCEPTION), false,
     331            general_exception);
     332        exc_register(EXC_DISABLED_FP_REG,
     333            vector_to_string(EXC_DISABLED_FP_REG), true,
     334            disabled_fp_register);
     335}
     336
    300337/** @}
    301338 */
Note: See TracChangeset for help on using the changeset viewer.