xref: /nrf52832-nimble/rt-thread/libcpu/nios/nios_ii/vector.S (revision 104654410c56c573564690304ae786df310c91fc)
1.set noat
2
3.globl .Lexception_exit
4
5.section .exceptions.exit.label
6.Lexception_exit:
7.section .exceptions.exit, "xa"
8        ldw r5, 68(sp)
9
10        /* get exception back */
11        ldw ea, 72(sp)
12
13        /* if(rt_thread_switch_interrupt_flag == 0) goto no_need_context */
14        ldw r4,%gprel(rt_thread_switch_interrupt_flag)(gp)
15        beq r4,zero,no_need_context
16
17need_context:
18        movia ea, rt_hw_context_switch_interrupt_do
19        /* disable interrupt */
20        mov r5, zero
21
22no_need_context:
23        ldw ra,  0(sp)
24
25        wrctl estatus, r5
26
27        /*
28         * Leave a gap in the stack frame at 4(sp) for the muldiv handler to
29         * store zero into.
30         */
31
32        ldw   r1,   8(sp)
33        ldw   r2,  12(sp)
34        ldw   r3,  16(sp)
35        ldw   r4,  20(sp)
36        ldw   r5,  24(sp)
37        ldw   r6,  28(sp)
38        ldw   r7,  32(sp)
39        ldw   r8,  36(sp)
40        ldw   r9,  40(sp)
41        ldw   r10, 44(sp)
42        ldw   r11, 48(sp)
43        ldw   r12, 52(sp)
44        ldw   r13, 56(sp)
45        ldw   r14, 60(sp)
46        ldw   r15, 64(sp)
47
48        addi  sp, sp, 76
49
50        eret
51
52