Ignore:
File:
1 edited

Legend:

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

    rc2417bc r7e752b2  
    3636#include <interrupt.h>
    3737#include <arch/interrupt.h>
    38 #include <arch/types.h>
     38#include <typedefs.h>
    3939#include <arch.h>
    4040#include <time/clock.h>
     
    4444#include <print.h>
    4545
    46 
    4746void start_decrementer(void)
    4847{
    4948        asm volatile (
    50                 "mtdec %0\n"
    51                 :
    52                 : "r" (1000)
     49                "mtdec %[dec]\n"
     50                :: [dec] "r" (1000)
    5351        );
    5452}
    5553
     54void istate_decode(istate_t *istate)
     55{
     56        printf("r0 =%#0" PRIx32 "\tr1 =%p\tr2 =%#0" PRIx32 "\n",
     57            istate->r0, (void *) istate->sp, istate->r2);
     58       
     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}
    5697
    57 /** Handler of external interrupts */
    58 static void exception_external(int n, istate_t *istate)
     98/** External interrupts handler
     99 *
     100 */
     101static void exception_external(unsigned int n, istate_t *istate)
    59102{
    60         int inum;
     103        uint8_t inum;
    61104       
    62         while ((inum = pic_get_pending()) != -1) {
     105        while ((inum = pic_get_pending()) != 255) {
    63106                irq_t *irq = irq_dispatch_and_lock(inum);
    64107                if (irq) {
     
    80123                        }
    81124                       
    82                         spinlock_unlock(&irq->lock);
     125                        irq_spinlock_unlock(&irq->lock, false);
    83126                } else {
    84127                        /*
     
    86129                         */
    87130#ifdef CONFIG_DEBUG
    88                         printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum);
     131                        printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",
     132                            CPU->id, inum);
    89133#endif
    90134                }
     
    92136}
    93137
    94 
    95 static void exception_decrementer(int n, istate_t *istate)
     138static void exception_decrementer(unsigned int n, istate_t *istate)
    96139{
    97140        start_decrementer();
     
    99142}
    100143
    101 
    102144/* Initialize basic tables for exception dispatching */
    103145void interrupt_init(void)
    104146{
    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);
     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);
    109155}
    110156
Note: See TracChangeset for help on using the changeset viewer.