4 * Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
6 * Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License V2
23 * as published by the Free Software Foundation
29 #define SER_ADDR5 0x71100004
30 #define SER_ADDR10 0xf1100004
32 .section ".text.vectors", "ax"
33 .align 4 /* Should be 16384, but alignment is handled by the ldscript */
34 /* Sparc32 trap table */
35 .globl trap_table, t_zero, t_wovf, t_wunf, __divide_error
38 #define WINDOW_SPILL \
39 rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
42 rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
44 #define TRAP_DFAULT(lvl) \
45 rd %psr, %l0; rd %wim, %l3; b handle_dfault; mov lvl, %l7;
47 #define BTRAP(lvl) ba bug; mov lvl, %g1; nop; nop;
48 #define BTRAPS(x) BTRAP(x) BTRAP(x+1) BTRAP(x+2) BTRAP(x+3) BTRAP(x+4) BTRAP(x+5) BTRAP(x+6) BTRAP(x+7)
49 #define TRAP_ENTRY_INTERRUPT(int_level) \
50 sethi %hi(irq_entry ## int_level), %l7; \
51 or %l7, %lo(irq_entry ## int_level), %l7; \
55 t_zero: b entry; nop; nop; nop;
56 BTRAP(0x1) BTRAP(0x2) BTRAP(0x3) BTRAP(0x4)
57 t_wovf: WINDOW_SPILL /* Window Overflow */
58 t_wunf: WINDOW_FILL /* Window Underflow */
62 BTRAP(0xa) BTRAP(0xb) BTRAP(0xc) BTRAP(0xd) BTRAP(0xe) BTRAP(0xf)
65 t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
66 t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
67 t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
68 t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
69 t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
70 t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
71 t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
72 t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
73 t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
74 t_irq10: TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
75 t_irq11: TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
76 t_irq12: TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
77 t_irq13: TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
78 t_irq14: TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
79 t_nmi: BAD_TRAP(0x1f) /* Level 15 (NMI) */
82 BTRAP(0x18) BTRAP(0x19)
83 t_irq10: TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
84 BTRAP(0x1b) BTRAP(0x1c) BTRAP(0x1d)
85 t_irq14: TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
91 BTRAP(0x2a) BTRAP(0x2b) BTRAP(0x2c) BTRAP(0x2d) BTRAP(0x2e) BTRAP(0x2f)
92 BTRAPS(0x30) BTRAPS(0x38)
93 BTRAPS(0x40) BTRAPS(0x48)
94 BTRAPS(0x50) BTRAPS(0x58)
95 BTRAPS(0x60) BTRAPS(0x68)
96 BTRAPS(0x70) BTRAPS(0x78)
97 BTRAPS(0x80) BTRAPS(0x88)
98 BTRAPS(0x90) BTRAPS(0x98)
99 BTRAPS(0xa0) BTRAPS(0xa8)
100 BTRAPS(0xb0) BTRAPS(0xb8)
101 BTRAPS(0xc0) BTRAPS(0xc8)
102 BTRAPS(0xd0) BTRAPS(0xd8)
103 BTRAPS(0xe0) BTRAPS(0xe8)
104 BTRAPS(0xf0) BTRAPS(0xf8)
106 .section ".text", "ax"
110 /* Dump the exception and its context */
113 andn %g2, PSR_ET, %g2
115 ! Disable mmu, re-enable boot mode
117 set dump_exception, %g2
121 sta %g2, [%g0] ASI_M_MMUREGS
124 /* void outstr (unsigned long port5, unsigned long port10,
125 * const unsigned char *str);
126 * Writes a string on an IO port.
128 1: lduba [%o2] ASI_M_KERNELTXT, %o3
132 stba %o3, [%o0] ASI_M_BYPASS
133 stba %o3, [%o1] ASI_M_CTL
140 /* void outhex (unsigned long port5, unsigned long port10,
142 * Dumps a 32 bits hex number on serial port
153 2: add %o2, 'a' - 10, %o2
154 3: stba %o2, [%o0] ASI_M_BYPASS
155 stba %o2, [%o1] ASI_M_CTL
162 /* void dump_exception ();
164 * Dump a message when catching an exception
167 set SER_ADDR5 + 2, %o0
168 set SER_ADDR10 + 2, %o1
169 set (_BUG_message_0), %o2
176 set (_BUG_message_1), %o2
183 set (_BUG_message_2), %o2
190 set (_BUG_message_3), %o2
199 sethi %hi(counter_regs), %l7
200 ld [%l7 + %lo(counter_regs)], %l7
207 sethi %hi(counter_regs), %l7
208 ld [%l7 + %lo(counter_regs)], %l7
210 sethi %hi(obp_ticks), %l7
211 ld [%l7 + %lo(obp_ticks)], %l7
218 /* Register window handlers */
222 /* Data fault handler */
225 .global ignore_dfault
234 /* If ignore_dfault is 0, fall through to normal exception handler */
235 sethi %hi(ignore_dfault), %l4
236 ld [%l4 + %lo(ignore_dfault)], %l4
241 /* Otherwise skip the faulting instruction and return */
248 .string "Unhandled Exception 0x"
250 .string "\r\nPC = 0x"
254 .string "\r\nStopping execution\r\n"