Changeset 00287cc in mainline for kernel/arch/arm32/src/exception.c


Ignore:
Timestamp:
2009-03-12T23:26:32Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
648c9d9
Parents:
3b122e9
Message:

arm32: update for the new scheme of device drivers and keyboard/serial modules
streamline arm32 port (as GXemul is still the only machine supported), more cleanup is needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/exception.c

    r3b122e9 r00287cc  
    3535
    3636#include <arch/exception.h>
    37 #include <arch/debug/print.h>
    3837#include <arch/memstr.h>
    3938#include <arch/regutils.h>
    4039#include <interrupt.h>
    41 #include <arch/machine.h>
    4240#include <arch/mm/page_fault.h>
    4341#include <arch/barrier.h>
     42#include <arch/drivers/gxemul.h>
    4443#include <print.h>
    4544#include <syscall/syscall.h>
     
    261260static void prefetch_abort_exception_entry(void)
    262261{
    263         asm("sub lr, lr, #4");
     262        asm volatile (
     263                "sub lr, lr, #4"
     264        );
     265       
    264266        PROCESS_EXCEPTION(EXC_PREFETCH_ABORT);
    265267}
     
    268270static void data_abort_exception_entry(void)
    269271{
    270         asm("sub lr, lr, #8");
     272        asm volatile (
     273                "sub lr, lr, #8"
     274        );
     275       
    271276        PROCESS_EXCEPTION(EXC_DATA_ABORT);
    272277}
     
    280285static void irq_exception_entry(void)
    281286{
    282         asm("sub lr, lr, #4");
     287        asm volatile (
     288                "sub lr, lr, #4"
     289        );
     290       
    283291        setup_stack_and_save_regs();
    284292       
     
    300308}
    301309
     310/** Returns the mask of active interrupts. */
     311static inline uint32_t gxemul_irqc_get_sources(void)
     312{
     313        return *((uint32_t *) gxemul_irqc);
     314}
     315
    302316/** Interrupt Exception handler.
    303317 *
     
    306320static void irq_exception(int exc_no, istate_t *istate)
    307321{
    308         machine_irq_exception(exc_no, istate);
     322        uint32_t sources = gxemul_irqc_get_sources();
     323        unsigned int i;
     324       
     325        for (i = 0; i < GXEMUL_IRQC_MAX_IRQ; i++) {
     326                if (sources & (1 << i)) {
     327                        irq_t *irq = irq_dispatch_and_lock(i);
     328                        if (irq) {
     329                                /* The IRQ handler was found. */
     330                                irq->handler(irq);
     331                                spinlock_unlock(&irq->lock);
     332                        } else {
     333                                /* Spurious interrupt.*/
     334                                printf("cpu%d: spurious interrupt (inum=%d)\n",
     335                                    CPU->id, i);
     336                        }
     337                }
     338        }
    309339}
    310340
     
    330360            (unsigned *) EXC_IRQ_VEC);
    331361       
    332         install_handler((unsigned)fiq_exception_entry,
     362        install_handler((unsigned) fiq_exception_entry,
    333363            (unsigned *) EXC_FIQ_VEC);
    334364}
     
    380410void print_istate(istate_t *istate)
    381411{
    382         dprintf("istate dump:\n");
    383 
    384         dprintf(" r0: %x    r1: %x    r2: %x    r3: %x\n",
     412        printf("istate dump:\n");
     413       
     414        printf(" r0: %x    r1: %x    r2: %x    r3: %x\n",
    385415            istate->r0, istate->r1, istate->r2, istate->r3);
    386         dprintf(" r4: %x    r5: %x    r6: %x    r7: %x\n",
     416        printf(" r4: %x    r5: %x    r6: %x    r7: %x\n",
    387417            istate->r4, istate->r5, istate->r6, istate->r7);
    388         dprintf(" r8: %x    r8: %x   r10: %x   r11: %x\n",
     418        printf(" r8: %x    r8: %x   r10: %x   r11: %x\n",
    389419            istate->r8, istate->r9, istate->r10, istate->r11);
    390         dprintf(" r12: %x    sp: %x    lr: %x  spsr: %x\n",
     420        printf(" r12: %x    sp: %x    lr: %x  spsr: %x\n",
    391421            istate->r12, istate->sp, istate->lr, istate->spsr);
    392 
    393         dprintf(" pc: %x\n", istate->pc);
     422       
     423        printf(" pc: %x\n", istate->pc);
    394424}
    395425
Note: See TracChangeset for help on using the changeset viewer.