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 //---------------------------------------------------------------
\r
21 // just a small decrementer exception to trigger soft interrupt
\r
22 // in the INTC( simluator addon )
\r
25 #define INTC_SSCIR7 0xFFF48027
\r
26 .global dec_exception
\r
38 lis r3, INTC_SSCIR7@ha
\r
39 stb r4, INTC_SSCIR7@l(r3)
\r
47 EXCEPTION_CSRRx(exception_IVOR0,320) //#CRITICAL_INPUT_EXCEPTION
\r
48 EXCEPTION_CSRRx(exception_IVOR1,321) //#MACHINE_CHECK_EXCEPTION
\r
49 EXCEPTION_SRRx(exception_IVOR2,322) //#DATA_STORAGE_EXCEPTION
\r
50 EXCEPTION_SRRx(exception_IVOR3,323) //#INSTRUCTION_STORAGE_EXCEPTION
\r
51 // IVOR4, defined elsewhere
\r
52 EXCEPTION_SRRx(exception_IVOR5,325) //#ALIGNMENT_EXCEPTION
\r
53 EXCEPTION_SRRx(exception_IVOR6,326) //#PROGRAM_EXCEPTION
\r
54 EXCEPTION_SRRx(exception_IVOR7,327) //#FLOATING_POINT_EXCEPTION
\r
55 EXCEPTION_SRRx(exception_IVOR8,328) //#SYSTEM_CALL_EXCEPTION)
\r
56 EXCEPTION_SRRx(exception_IVOR9,329)
\r
57 // IVOR10, defined elsewhere
\r
58 EXCEPTION_SRRx(exception_IVOR11,331) //#FIXED_INTERVAL_TIMER_EXCEPTION
\r
59 EXCEPTION_SRRx(exception_IVOR12,332) //#WATCHDOG_TIMER_EXCEPTION
\r
60 EXCEPTION_SRRx(exception_IVOR13,333) //#DATA_TLB_EXCEPTION
\r
61 EXCEPTION_SRRx(exception_IVOR14,334) //#INSTRUCTION_TLB_EXCEPTION
\r
70 .global exception_IVOR4
\r
71 .global os_lc_restore
\r
76 // Save registers NOT preserved by functions
\r
77 SAVE_VGPR(1,C_SIZE);
\r
78 // Save registers preserved by functions
\r
83 // TODO: Why 0, can't remember
\r
85 stw r3,EXC_VECTOR_OFF(r4)
\r
86 mr r4,r1 // save stack
\r
90 stw r3,C_CONTEXT_OFF(sp)
\r
92 // Switch to interrupt stack if at depth 0
\r
93 LOAD_IND_32(3,os_sys+SYS_INT_NEST_CNT)
\r
96 // Load the interrupt stack
\r
97 LOAD_IND_32(sp,os_sys+SYS_INT_STACK)
\r
102 lis r3, Irq_Entry@h
\r
103 ori r3, r3,Irq_Entry@l
\r
106 mr r3,r4 /* "old" stack as arg1 */
\r
110 // Set the retun value as new stack
\r
116 RESTORE_VGPR(1,C_SIZE)
\r
118 RESTORE_WORK_AND_MORE
\r
124 # Force this jump table to this address to match the
\r
125 # value written to z1 IVPR
\r
126 .section ".exception_tbl","ax"
\r
127 .balign 0x0800 //TODO: 1000 eller 800?
\r
128 .global exception_tbl
\r
130 # The .skip directive aligns the branch instructions
\r
131 # to the irq vector offsets
\r
154 //b exception_IVOR10
\r