OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [uos/] [except-or32.S] - Diff between revs 90 and 346

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 90 Rev 346
Line 196... Line 196...
 
 
/*
/*
 * Reset Exception handler
 * Reset Exception handler
 */
 */
.org 0x100
.org 0x100
_reset_vector:
reset_vector:
 
 
  l.movhi r3,hi(MC_BASE_ADDR)
  l.movhi r3,hi(MC_BASE_ADDR)
  l.ori   r3,r3,lo(MC_BASE_ADDR)
  l.ori   r3,r3,lo(MC_BASE_ADDR)
 
 
  l.addi  r4,r3,MC_CSC(0)
  l.addi  r4,r3,MC_CSC(0)
Line 275... Line 275...
  l.nop
  l.nop
 
 
2:
2:
 
 
 
 
  l.movhi r2,hi(_reset)
  l.movhi r2,hi(reset)
  l.ori   r2,r2,lo(_reset)
  l.ori   r2,r2,lo(reset)
  l.jr    r2
  l.jr    r2
  l.nop
  l.nop
 
 
/*
/*
 * Switch to a new context pointed by _task_context
 * Switch to a new context pointed by task_context
 */
 */
.global _dispatch
.global dispatch
.align 4
.align 4
_dispatch:
dispatch:
        /* load user task GPRs and PC */
        /* load user task GPRs and PC */
        l.movhi r3,hi(_task_context)
        l.movhi r3,hi(task_context)
        l.addi  r3,r0,lo(_task_context)
        l.addi  r3,r0,lo(task_context)
        LOADREGS_N_GO
        LOADREGS_N_GO
 
 
.section .except, "ax"
.section .except, "ax"
 
 
/*
/*
 * Bus Error Exception handler
 * Bus Error Exception handler
 */
 */
.org 0x0200
.org 0x0200
_buserr:
buserr:
        l.nop
        l.nop
        l.sw    0(r0),r3        /* Save r3 */
        l.sw    0(r0),r3        /* Save r3 */
        PRINTF(r3, _buserr_str)
        PRINTF(r3, buserr_str)
_hang:
hang:
        l.j     _hang
        l.j     hang
        l.nop
        l.nop
 
 
_buserr_str:
buserr_str:
        .ascii  "Bus error exception.\n\000"
        .ascii  "Bus error exception.\n\000"
 
 
/*
/*
 * External Interrupt Exception handler
 * External Interrupt Exception handler
 */
 */
.org 0x800
.org 0x800
_extint:
extint:
        l.nop
        l.nop
        l.sw    0(r0),r3        /* Save r3 */
        l.sw    0(r0),r3        /* Save r3 */
        PRINTF(r3,_extint_str)
        PRINTF(r3,extint_str)
        l.mfspr r3,r0,SPR_EPCR_BASE     /* Get EPCR */
        l.mfspr r3,r0,SPR_EPCR_BASE     /* Get EPCR */
        l.sw    4(r0),r3        /* and save it */
        l.sw    4(r0),r3        /* and save it */
 
 
        /* now save user task context */
        /* now save user task context */
        l.movhi r3,hi(_task_context)
        l.movhi r3,hi(task_context)
        l.addi  r3,r0,lo(_task_context)
        l.addi  r3,r0,lo(task_context)
        SAVEREGS
        SAVEREGS
 
 
        /* set kernel context's PC to kernel's scheduler */
        /* set kernel context's PC to kernel's scheduler */
        l.movhi r3,hi(_kernel_context)
        l.movhi r3,hi(kernel_context)
        l.addi  r3,r0,lo(_kernel_context)
        l.addi  r3,r0,lo(kernel_context)
        SET_CONTEXTPC(r3,_int_main,r4)
        SET_CONTEXTPC(r3,int_main,r4)
 
 
        /* load kernel context */
        /* load kernel context */
        l.movhi r3,hi(_kernel_context)
        l.movhi r3,hi(kernel_context)
        l.addi  r3,r0,lo(_kernel_context)
        l.addi  r3,r0,lo(kernel_context)
        LOADREGS
        LOADREGS
 
 
        l.movhi r3,hi(_int_main)
        l.movhi r3,hi(int_main)
        l.addi  r3,r0,lo(_int_main)
        l.addi  r3,r0,lo(int_main)
        l.jr    r3
        l.jr    r3
        l.nop
        l.nop
 
 
_extint_str:
extint_str:
        .ascii  "External interrupt exception.\n\000"
        .ascii  "External interrupt exception.\n\000"
 
 
/*
/*
 * System Call Exception handler
 * System Call Exception handler
 */
 */
.org 0x0c00
.org 0x0c00
_syscall:
syscall:
        l.nop
        l.nop
        l.sw    0(r0),r3        /* Save r3 */
        l.sw    0(r0),r3        /* Save r3 */
        PRINTF(r3,_syscall_str)
        PRINTF(r3,syscall_str)
        l.mfspr r3,r0,SPR_EPCR_BASE     /* Get EPCR */
        l.mfspr r3,r0,SPR_EPCR_BASE     /* Get EPCR */
        l.addi  r3,r3,4         /* increment because EPCR instruction was already executed */
        l.addi  r3,r3,4         /* increment because EPCR instruction was already executed */
        l.sw    4(r0),r3        /* and save it */
        l.sw    4(r0),r3        /* and save it */
 
 
        /* now save user task context */
        /* now save user task context */
        l.movhi r3,hi(_task_context)
        l.movhi r3,hi(task_context)
        l.addi  r3,r0,lo(_task_context)
        l.addi  r3,r0,lo(task_context)
        SAVEREGS
        SAVEREGS
 
 
        /* set kernel context's PC to kernel's syscall entry */
        /* set kernel context's PC to kernel's syscall entry */
        l.movhi r3,hi(_kernel_context)
        l.movhi r3,hi(kernel_context)
        l.addi  r3,r0,lo(_kernel_context)
        l.addi  r3,r0,lo(kernel_context)
        SET_CONTEXTPC(r3,_kernel_syscall,r4)
        SET_CONTEXTPC(r3,kernel_syscall,r4)
 
 
        /* load kernel context */
        /* load kernel context */
        l.movhi r3,hi(_kernel_context)
        l.movhi r3,hi(kernel_context)
        l.addi  r3,r0,lo(_kernel_context)
        l.addi  r3,r0,lo(kernel_context)
        LOADREGS_N_GO
        LOADREGS_N_GO
 
 
_syscall_str:
syscall_str:
        .ascii  "System call exception.\n\000"
        .ascii  "System call exception.\n\000"
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.