Ignore:
File:
1 edited

Legend:

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

    r9d58539 rdf7f5cea  
    3636#include <interrupt.h>
    3737#include <arch/interrupt.h>
     38#include <arch/istate.h>
    3839#include <typedefs.h>
    3940#include <arch.h>
    40 #include <time/clock.h>
    4141#include <ipc/sysipc.h>
    4242#include <arch/drivers/pic.h>
     
    4444#include <arch/mm/pht.h>
    4545#include <print.h>
     46#include <log.h>
    4647
    47 void start_decrementer(void)
     48static uint32_t decrementer_value;
     49
     50void decrementer_start(uint32_t val)
     51{
     52        decrementer_value = val;
     53        decrementer_restart();
     54}
     55
     56void decrementer_restart(void)
    4857{
    4958        asm volatile (
    5059                "mtdec %[dec]\n"
    51                 :: [dec] "r" (1000)
     60                :: [dec] "r" (decrementer_value)
    5261        );
    5362}
     
    5564void istate_decode(istate_t *istate)
    5665{
    57         printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
     66        log_printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
    5867            "r2 =%0#10" PRIx32 "\n", istate->r0, istate->sp, istate->r2);
    5968       
    60         printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"
     69        log_printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"
    6170            "r5 =%0#10" PRIx32 "\n", istate->r3, istate->r4, istate->r5);
    6271       
    63         printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"
     72        log_printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"
    6473            "r8 =%0#10" PRIx32 "\n", istate->r6, istate->r7, istate->r8);
    6574       
    66         printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"
     75        log_printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"
    6776            "r11=%0#10" PRIx32 "\n", istate->r9, istate->r10, istate->r11);
    6877       
    69         printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"
     78        log_printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"
    7079            "r14=%0#10" PRIx32 "\n", istate->r12, istate->r13, istate->r14);
    7180       
    72         printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"
     81        log_printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"
    7382            "r17=%0#10" PRIx32 "\n", istate->r15, istate->r16, istate->r17);
    7483       
    75         printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"
     84        log_printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"
    7685            "r20=%0#10" PRIx32 "\n", istate->r18, istate->r19, istate->r20);
    7786       
    78         printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"
     87        log_printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"
    7988            "r23=%0#10" PRIx32 "\n", istate->r21, istate->r22, istate->r23);
    8089       
    81         printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"
     90        log_printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"
    8291            "r26=%0#10" PRIx32 "\n", istate->r24, istate->r25, istate->r26);
    8392       
    84         printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"
     93        log_printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"
    8594            "r29=%0#10" PRIx32 "\n", istate->r27, istate->r28, istate->r29);
    8695       
    87         printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",
     96        log_printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",
    8897            istate->r30, istate->r31);
    8998       
    90         printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"
     99        log_printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"
    91100            "lr =%0#10" PRIx32 "\n", istate->cr, istate->pc, istate->lr);
    92101       
    93         printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"
     102        log_printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"
    94103            "dar=%0#10" PRIx32 "\n", istate->ctr, istate->xer, istate->dar);
    95104       
    96         printf("srr1=%0#10" PRIx32 "\n", istate->srr1);
     105        log_printf("srr1=%0#10" PRIx32 "\n", istate->srr1);
    97106}
    98107
     
    103112{
    104113        uint8_t inum;
    105        
     114
    106115        while ((inum = pic_get_pending()) != 255) {
    107116                irq_t *irq = irq_dispatch_and_lock(inum);
     
    130139                         */
    131140#ifdef CONFIG_DEBUG
    132                         printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",
    133                             CPU->id, inum);
     141                        log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt"
     142                            " (inum=%" PRIu8 ")", CPU->id, inum);
    134143#endif
    135144                }
     
    137146}
    138147
     148static void exception_fp_unavailable(unsigned int n, istate_t *istate)
     149{
     150#ifdef CONFIG_FPU_LAZY
     151        scheduler_fpu_lazy_request();
     152        /*
     153         * Propagate MSR_FP from MSR back to istate's SRR1, which will become
     154         * the next MSR.
     155         */
     156        istate->srr1 |= msr_read() & MSR_FP;
     157#else
     158        fault_if_from_uspace(istate, "FPU fault.");
     159        panic_badtrap(istate, n, "FPU fault.");
     160#endif
     161}
     162
    139163static void exception_decrementer(unsigned int n, istate_t *istate)
    140164{
    141         start_decrementer();
     165        decrementer_restart();
    142166        clock();
    143167}
     
    152176        exc_register(VECTOR_EXTERNAL, "external", true,
    153177            exception_external);
     178        exc_register(VECTOR_FP_UNAVAILABLE, "fp_unavailable", true,
     179            exception_fp_unavailable);
    154180        exc_register(VECTOR_DECREMENTER, "timer", true,
    155181            exception_decrementer);
Note: See TracChangeset for help on using the changeset viewer.