4 #include "asm_book_e.h"
\r
6 #include "asm_offset.h"
\r
9 #define INTC_IACKR 0xfff48010
\r
10 #define INTC_EOIR 0xfff48018
\r
12 #define SIU_MIDR 0xfffe8004
\r
13 #define SIMULATOR(_reg,_inst,_label) \
\r
14 lis _reg, SIU_MIDR@ha; \
\r
15 lwz _reg, SIU_MIDR@l(_reg); \
\r
20 .extern intc_vector_tbl
\r
23 //---------------------------------------------------------------
\r
24 // just a small decrementer exception to trigger soft interrupt
\r
25 // in the INTC( simluator addon )
\r
28 #define INTC_SSCIR7 0xFFF48027
\r
29 .global dec_exception
\r
41 lis r3, INTC_SSCIR7@ha
\r
42 stb r4, INTC_SSCIR7@l(r3)
\r
50 EXCEPTION_CSRRx(exception_IVOR0,320) //#CRITICAL_INPUT_EXCEPTION
\r
51 EXCEPTION_CSRRx(exception_IVOR1,321) //#MACHINE_CHECK_EXCEPTION
\r
52 EXCEPTION_SRRx(exception_IVOR2,322) //#DATA_STORAGE_EXCEPTION
\r
53 EXCEPTION_SRRx(exception_IVOR3,323) //#INSTRUCTION_STORAGE_EXCEPTION
\r
54 // IVOR4, defined elsewhere
\r
55 EXCEPTION_SRRx(exception_IVOR5,325) //#ALIGNMENT_EXCEPTION
\r
56 EXCEPTION_SRRx(exception_IVOR6,326) //#PROGRAM_EXCEPTION
\r
57 EXCEPTION_SRRx(exception_IVOR7,327) //#FLOATING_POINT_EXCEPTION
\r
58 EXCEPTION_SRRx(exception_IVOR8,328) //#SYSTEM_CALL_EXCEPTION)
\r
59 EXCEPTION_SRRx(exception_IVOR9,329)
\r
60 // IVOR10, defined elsewhere
\r
61 EXCEPTION_SRRx(exception_IVOR11,331) //#FIXED_INTERVAL_TIMER_EXCEPTION
\r
62 EXCEPTION_SRRx(exception_IVOR12,332) //#WATCHDOG_TIMER_EXCEPTION
\r
63 EXCEPTION_SRRx(exception_IVOR13,333) //#DATA_TLB_EXCEPTION
\r
64 EXCEPTION_SRRx(exception_IVOR14,334) //#INSTRUCTION_TLB_EXCEPTION
\r
73 .global exception_IVOR4
\r
74 .global os_lc_restore
\r
79 // Save registers NOT preserved by functions
\r
80 SAVE_VGPR(1,C_SIZE);
\r
81 // Save registers preserved by functions
\r
86 // TODO: Why 0, can't remember
\r
88 stw r3,EXC_VECTOR_OFF(r4)
\r
89 mr r4,r1 // save stack
\r
93 stw r3,C_CONTEXT_OFF(sp)
\r
95 // Switch to interrupt stack if at depth 0
\r
96 LOAD_IND_32(3,os_sys+SYS_INT_NEST_CNT)
\r
99 // Load the interrupt stack
\r
100 LOAD_IND_32(sp,os_sys+SYS_INT_STACK)
\r
105 lis r3, IntCtrl_Entry@h
\r
106 ori r3, r3,IntCtrl_Entry@l
\r
109 mr r3,r4 /* "old" stack as arg1 */
\r
113 // Set the retun value as new stack
\r
119 RESTORE_VGPR(1,C_SIZE)
\r
121 RESTORE_WORK_AND_MORE
\r
127 # Force this jump table to this address to match the
\r
128 # value written to z1 IVPR
\r
129 .section ".exception_tbl","ax"
\r
130 .balign 0x0800 //TODO: 1000 eller 800?
\r
131 .global exception_tbl
\r
133 # The .skip directive aligns the branch instructions
\r
134 # to the irq vector offsets
\r
157 //b exception_IVOR10
\r