1
2
3
4
5
6
7
8
9
10
11#include <asm/asm.h>
12#include <asm/regdef.h>
13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h>
15#include <asm/stackframe.h>
16
17 .macro __build_clear_none
18 .endm
19
20 .macro __build_clear_sti
21 STI
22 .endm
23
24 .macro __build_clear_cli
25 CLI
26 .endm
27
28 .macro __build_clear_fpe
29 cfc1 a1, fcr31
30 li a2, ~(0x3f << 12)
31 and a2, a1
32 ctc1 a2, fcr31
33 STI
34 .endm
35
36 .macro __build_clear_ade
37 dmfc0 t0, CP0_BADVADDR
38 sd t0, PT_BVADDR(sp)
39 KMODE
40 .endm
41
42 .macro __BUILD_silent exception
43 .endm
44
45
46
47
48
49 .macro __BUILD_verbose nexception
50 ld a1, PT_EPC(sp)
51 PRINT("Got \nexception at %016lx\012")
52 .endm
53
54 .macro __BUILD_count exception
55 .set reorder
56 ld t0,exception_count_\exception
57 daddiu t0, 1
58 sd t0,exception_count_\exception
59 .set noreorder
60 .comm exception_count\exception, 8, 8
61 .endm
62
63 .macro BUILD_HANDLER exception handler clear verbose
64 .align 5
65 NESTED(handle_\exception, PT_SIZE, sp)
66 .set noat
67 SAVE_ALL
68 __BUILD_clear_\clear
69 .set at
70 __BUILD_\verbose \exception
71 move a0, sp
72 jal do_\handler
73 j ret_from_exception
74 nop
75 END(handle_\exception)
76 .endm
77