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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [support/] [except.S] - Diff between revs 47 and 50

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

Rev 47 Rev 50
Line 9... Line 9...
_reset:
_reset:
    l.nop
    l.nop
    l.j    _reset_except
    l.j    _reset_except
    l.nop
    l.nop
*/
*/
.org 0x000
 
 
 
_except_200:
/*  This cannot be a regular function because it would waste the return register r9 of the interrupted procedure. */
    l.nop
/*  Furthermore, if this would be a function and l.j handler would be outside of this, the return register set here would be use upon return of this function. */
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
/*  However, the desired behavior is to finish the handler and let the return of the service routine simply restore the registers and return to the interrupted procedure.  */
                    //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
#define intr_handler(handler)   \
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
    l.nop ;\
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
    l.addi  r1,r1,-244          /*free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)*/;\
 
                                /*plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading) */;\
 
    l.sw    0x18(r1),r9         /*save register r9(return addr) to stack*/;\
 
    l.jal   store_regs          /*save registers r3-r31 (except r9) to stack (r9 is changed here)*/;\
 
    l.nop                       ;\
 
                                ;\
 
    l.movhi r9,hi(end_except)   /*set return addr to end_except instruction*/;\
 
    l.ori   r9,r9,lo(end_except)/*set return addr to end_except instruction*/;\
 
    l.j    handler              ;\
    l.nop
    l.nop
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
.org 0x000
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
_except_200:
    l.j    buserr_except
    intr_handler(buserr_except)
    l.nop
 
 
 
.org 0x100
.org 0x100
 
 
_except_300:
_except_300:
    l.nop
    intr_handler(dpf_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    dpf_except
 
    l.nop
 
 
 
.org 0x200
.org 0x200
 
 
_except_400:
_except_400:
    l.nop
    intr_handler(ipf_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    ipf_except
 
    l.nop
 
 
 
.org 0x300
.org 0x300
 
 
_except_500:
_except_500:
    l.nop
    intr_handler(tick_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    tick_except
 
    l.nop
 
 
 
.org 0x400
.org 0x400
 
 
_except_600:
_except_600:
    l.nop
    intr_handler(align_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    align_except
 
    l.nop
 
 
 
.org 0x500
.org 0x500
 
 
_except_700:
_except_700:
    l.nop
    intr_handler(illegal_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    illegal_except
 
    l.nop
 
 
 
.org 0x600
.org 0x600
 
 
_except_800:
_except_800:
    l.nop
    intr_handler(ext_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j ext_except                //jmp to C interrupt handler (returns later to end_except)
 
    l.nop
 
 
 
 
 
.org 0x700
.org 0x700
 
 
_except_900:
_except_900:
    l.nop
    intr_handler(dtlbmiss_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    dtlbmiss_except
 
    l.nop
 
 
 
.org 0x800
.org 0x800
 
 
_except_a00:
_except_a00:
    l.nop
    intr_handler(itlbmiss_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    itlbmiss_except
 
    l.nop
 
 
 
.org 0x900
.org 0x900
 
 
_except_b00:
_except_b00:
    l.nop
    intr_handler(range_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    range_except
 
    l.nop
 
 
 
.org 0xa00
.org 0xa00
 
 
_except_c00:
_except_c00:
    l.nop
    intr_handler(syscall_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    syscall_except
 
    l.nop
 
 
 
.org 0xb00
.org 0xb00
 
 
_except_d00:
_except_d00:
    l.nop
    intr_handler(res1_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    res1_except
 
    l.nop
 
 
 
.org 0xc00
.org 0xc00
 
 
_except_e00:
_except_e00:
    l.nop
    intr_handler(trap_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    trap_except
 
    l.nop
 
 
 
.org 0xd00
.org 0xd00
 
 
_except_f00:
_except_f00:
    l.nop
    intr_handler(res2_except)
    l.addi  r1,r1,-244            //free 29 words (29 x 4 = 112) + 4 because stack points to contained data (stack is r1)
 
                                        //plus 128 bytes not to mess with the previous frame pointer (32 register x 4 bytes = 128 bytes ) (required by C++ multiple threading)
 
    l.sw    0x18(r1),r9            //save register r9(return addr) to stack
 
    l.jal   store_regs            //save registers r3-r31 (except r9) to stack (r9 is changed here)
 
    l.nop
 
 
 
    l.movhi r9,hi(end_except)        //set return addr to end_except instruction
 
    l.ori   r9,r9,lo(end_except)    //set return addr to end_except instruction
 
    l.j    res2_except
 
    l.nop
 
 
 
store_regs:        //save registers r3-r31 (except r9) to stack
store_regs:        //save registers r3-r31 (except r9) to stack
    l.sw    0x00(r1),r3
    l.sw    0x00(r1),r3
    l.sw    0x04(r1),r4
    l.sw    0x04(r1),r4
    l.sw    0x08(r1),r5
    l.sw    0x08(r1),r5

powered by: WebSVN 2.1.0

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