Ignore:
File:
1 edited

Legend:

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

    r7e752b2 rc2417bc  
    3636#include <interrupt.h>
    3737#include <arch/interrupt.h>
    38 #include <typedefs.h>
     38#include <arch/types.h>
    3939#include <arch.h>
    4040#include <time/clock.h>
     
    4444#include <print.h>
    4545
     46
    4647void start_decrementer(void)
    4748{
    4849        asm volatile (
    49                 "mtdec %[dec]\n"
    50                 :: [dec] "r" (1000)
     50                "mtdec %0\n"
     51                :
     52                : "r" (1000)
    5153        );
    5254}
    5355
    54 void istate_decode(istate_t *istate)
     56
     57/** Handler of external interrupts */
     58static void exception_external(int n, istate_t *istate)
    5559{
    56         printf("r0 =%#0" PRIx32 "\tr1 =%p\tr2 =%#0" PRIx32 "\n",
    57             istate->r0, (void *) istate->sp, istate->r2);
     60        int inum;
    5861       
    59         printf("r3 =%#0" PRIx32 "\tr4 =%#0" PRIx32 "\tr5 =%#0" PRIx32 "\n",
    60             istate->r3, istate->r4, istate->r5);
    61        
    62         printf("r6 =%#0" PRIx32 "\tr7 =%#0" PRIx32 "\tr8 =%#0" PRIx32 "\n",
    63             istate->r6, istate->r7, istate->r8);
    64        
    65         printf("r9 =%#0" PRIx32 "\tr10=%#0" PRIx32 "\tr11=%#0" PRIx32 "\n",
    66             istate->r9, istate->r10, istate->r11);
    67        
    68         printf("r12=%#0" PRIx32 "\tr13=%#0" PRIx32 "\tr14=%#0" PRIx32 "\n",
    69             istate->r12, istate->r13, istate->r14);
    70        
    71         printf("r15=%#0" PRIx32 "\tr16=%#0" PRIx32 "\tr17=%#0" PRIx32 "\n",
    72             istate->r15, istate->r16, istate->r17);
    73        
    74         printf("r18=%#0" PRIx32 "\tr19=%#0" PRIx32 "\tr20=%#0" PRIx32 "\n",
    75             istate->r18, istate->r19, istate->r20);
    76        
    77         printf("r21=%#0" PRIx32 "\tr22=%#0" PRIx32 "\tr23=%#0" PRIx32 "\n",
    78             istate->r21, istate->r22, istate->r23);
    79        
    80         printf("r24=%#0" PRIx32 "\tr25=%#0" PRIx32 "\tr26=%#0" PRIx32 "\n",
    81             istate->r24, istate->r25, istate->r26);
    82        
    83         printf("r27=%#0" PRIx32 "\tr28=%#0" PRIx32 "\tr29=%#0" PRIx32 "\n",
    84             istate->r27, istate->r28, istate->r29);
    85        
    86         printf("r30=%#0" PRIx32 "\tr31=%#0" PRIx32 "\n",
    87             istate->r30, istate->r31);
    88        
    89         printf("cr =%#0" PRIx32 "\tpc =%p\tlr =%p\n",
    90             istate->cr, (void *) istate->pc, (void *) istate->lr);
    91        
    92         printf("ctr=%#0" PRIx32 "\txer=%#0" PRIx32 "\tdar=%#0" PRIx32 "\n",
    93             istate->ctr, istate->xer, istate->dar);
    94        
    95         printf("srr1=%p\n", (void *) istate->srr1);
    96 }
    97 
    98 /** External interrupts handler
    99  *
    100  */
    101 static void exception_external(unsigned int n, istate_t *istate)
    102 {
    103         uint8_t inum;
    104        
    105         while ((inum = pic_get_pending()) != 255) {
     62        while ((inum = pic_get_pending()) != -1) {
    10663                irq_t *irq = irq_dispatch_and_lock(inum);
    10764                if (irq) {
     
    12380                        }
    12481                       
    125                         irq_spinlock_unlock(&irq->lock, false);
     82                        spinlock_unlock(&irq->lock);
    12683                } else {
    12784                        /*
     
    12986                         */
    13087#ifdef CONFIG_DEBUG
    131                         printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",
    132                             CPU->id, inum);
     88                        printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum);
    13389#endif
    13490                }
     
    13692}
    13793
    138 static void exception_decrementer(unsigned int n, istate_t *istate)
     94
     95static void exception_decrementer(int n, istate_t *istate)
    13996{
    14097        start_decrementer();
     
    14299}
    143100
     101
    144102/* Initialize basic tables for exception dispatching */
    145103void interrupt_init(void)
    146104{
    147         exc_register(VECTOR_DATA_STORAGE, "data_storage", true,
    148             pht_refill);
    149         exc_register(VECTOR_INSTRUCTION_STORAGE, "instruction_storage", true,
    150             pht_refill);
    151         exc_register(VECTOR_EXTERNAL, "external", true,
    152             exception_external);
    153         exc_register(VECTOR_DECREMENTER, "timer", true,
    154             exception_decrementer);
     105        exc_register(VECTOR_DATA_STORAGE, "data_storage", pht_refill);
     106        exc_register(VECTOR_INSTRUCTION_STORAGE, "instruction_storage", pht_refill);
     107        exc_register(VECTOR_EXTERNAL, "external", exception_external);
     108        exc_register(VECTOR_DECREMENTER, "timer", exception_decrementer);
    155109}
    156110
Note: See TracChangeset for help on using the changeset viewer.