1
2
3
4
5
6
7 #ifndef _SPARC_KGDB_H
8 #define _SPARC_KGDB_H
9
10 #ifndef __ASSEMBLY__
11
12 extern void set_debug_traps(void);
13
14
15 extern void breakpoint(void);
16
17
18
19
20 struct kgdb_frame {
21 unsigned long globals[8];
22 unsigned long outs[8];
23 unsigned long locals[8];
24 unsigned long ins[8];
25 unsigned long fpregs[32];
26 unsigned long y;
27 unsigned long psr;
28 unsigned long wim;
29 unsigned long tbr;
30 unsigned long pc;
31 unsigned long npc;
32 unsigned long fpsr;
33 unsigned long cpsr;
34 };
35 #endif
36
37
38 #define KGDB_G0 0x000
39 #define KGDB_G1 0x004
40 #define KGDB_G2 0x008
41 #define KGDB_G4 0x010
42 #define KGDB_G6 0x018
43 #define KGDB_I0 0x020
44 #define KGDB_I2 0x028
45 #define KGDB_I4 0x030
46 #define KGDB_I6 0x038
47 #define KGDB_Y 0x100
48 #define KGDB_PSR 0x104
49 #define KGDB_WIM 0x108
50 #define KGDB_TBR 0x10c
51 #define KGDB_PC 0x110
52 #define KGDB_NPC 0x114
53
54 #define SAVE_KGDB_GLOBALS(reg) \
55 std %g0, [%reg + REGWIN_SZ + KGDB_G0]; \
56 std %g2, [%reg + REGWIN_SZ + KGDB_G2]; \
57 std %g4, [%reg + REGWIN_SZ + KGDB_G4]; \
58 std %g6, [%reg + REGWIN_SZ + KGDB_G6];
59
60 #define SAVE_KGDB_INS(reg) \
61 std %i0, [%reg + REGWIN_SZ + KGDB_I0]; \
62 std %i2, [%reg + REGWIN_SZ + KGDB_I2]; \
63 std %i4, [%reg + REGWIN_SZ + KGDB_I4]; \
64 std %i6, [%reg + REGWIN_SZ + KGDB_I6];
65
66 #define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
67 st %reg_y, [%reg + REGWIN_SZ + KGDB_Y]; \
68 st %reg_psr, [%reg + REGWIN_SZ + KGDB_PSR]; \
69 st %reg_wim, [%reg + REGWIN_SZ + KGDB_WIM]; \
70 st %reg_tbr, [%reg + REGWIN_SZ + KGDB_TBR]; \
71 st %reg_pc, [%reg + REGWIN_SZ + KGDB_PC]; \
72 st %reg_npc, [%reg + REGWIN_SZ + KGDB_NPC];
73
74 #define LOAD_KGDB_GLOBALS(reg) \
75 ld [%reg + REGWIN_SZ + KGDB_G1], %g1; \
76 ldd [%reg + REGWIN_SZ + KGDB_G2], %g2; \
77 ldd [%reg + REGWIN_SZ + KGDB_G4], %g4; \
78 ldd [%reg + REGWIN_SZ + KGDB_G6], %g6;
79
80 #define LOAD_KGDB_INS(reg) \
81 ldd [%reg + REGWIN_SZ + KGDB_I0], %i0; \
82 ldd [%reg + REGWIN_SZ + KGDB_I2], %i2; \
83 ldd [%reg + REGWIN_SZ + KGDB_I4], %i4; \
84 ldd [%reg + REGWIN_SZ + KGDB_I6], %i6;
85
86 #define LOAD_KGDB_SREGS(reg, reg_y_and_psr, reg_pc_and_npc) \
87 ldd [%reg + REGWIN_SZ + KGDB_Y], %reg_y_and_psr; \
88 ldd [%reg + REGWIN_SZ + KGDB_PC], %reg_pc_and_npc;
89
90 #endif