blob: d120adfb429fcfaa0483aa8296b69ea47fa2c723 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: kgdb.h,v 1.8 1998/01/07 06:33:44 baccala Exp $
2 * kgdb.h: Defines and declarations for serial line source level
3 * remote debugging of the Linux kernel using gdb.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7#ifndef _SPARC_KGDB_H
8#define _SPARC_KGDB_H
9
10#ifndef __ASSEMBLY__
11/* To init the kgdb engine. */
12extern void set_debug_traps(void);
13
14/* To enter the debugger explicitly. */
15extern void breakpoint(void);
16
17/* For convenience we define the format of a kgdb trap breakpoint
18 * frame here also.
19 */
20struct 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 /* !(__ASSEMBLY__) */
36
37/* Macros for assembly usage of the kgdb breakpoint frame. */
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 + STACKFRAME_SZ + KGDB_G0]; \
56 std %g2, [%reg + STACKFRAME_SZ + KGDB_G2]; \
57 std %g4, [%reg + STACKFRAME_SZ + KGDB_G4]; \
58 std %g6, [%reg + STACKFRAME_SZ + KGDB_G6];
59
60#define SAVE_KGDB_INS(reg) \
61 std %i0, [%reg + STACKFRAME_SZ + KGDB_I0]; \
62 std %i2, [%reg + STACKFRAME_SZ + KGDB_I2]; \
63 std %i4, [%reg + STACKFRAME_SZ + KGDB_I4]; \
64 std %i6, [%reg + STACKFRAME_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 + STACKFRAME_SZ + KGDB_Y]; \
68 st %reg_psr, [%reg + STACKFRAME_SZ + KGDB_PSR]; \
69 st %reg_wim, [%reg + STACKFRAME_SZ + KGDB_WIM]; \
70 st %reg_tbr, [%reg + STACKFRAME_SZ + KGDB_TBR]; \
71 st %reg_pc, [%reg + STACKFRAME_SZ + KGDB_PC]; \
72 st %reg_npc, [%reg + STACKFRAME_SZ + KGDB_NPC];
73
74#define LOAD_KGDB_GLOBALS(reg) \
75 ld [%reg + STACKFRAME_SZ + KGDB_G1], %g1; \
76 ldd [%reg + STACKFRAME_SZ + KGDB_G2], %g2; \
77 ldd [%reg + STACKFRAME_SZ + KGDB_G4], %g4; \
78 ldd [%reg + STACKFRAME_SZ + KGDB_G6], %g6;
79
80#define LOAD_KGDB_INS(reg) \
81 ldd [%reg + STACKFRAME_SZ + KGDB_I0], %i0; \
82 ldd [%reg + STACKFRAME_SZ + KGDB_I2], %i2; \
83 ldd [%reg + STACKFRAME_SZ + KGDB_I4], %i4; \
84 ldd [%reg + STACKFRAME_SZ + KGDB_I6], %i6;
85
86#define LOAD_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
87 ld [%reg + STACKFRAME_SZ + KGDB_Y], %reg_y; \
88 ld [%reg + STACKFRAME_SZ + KGDB_PSR], %reg_psr; \
89 ld [%reg + STACKFRAME_SZ + KGDB_WIM], %reg_wim; \
90 ld [%reg + STACKFRAME_SZ + KGDB_TBR], %reg_tbr; \
91 ld [%reg + STACKFRAME_SZ + KGDB_PC], %reg_pc; \
92 ld [%reg + STACKFRAME_SZ + KGDB_NPC], %reg_npc;
93
94#endif /* !(_SPARC_KGDB_H) */