summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc/kgdb.h
blob: 79534dac8d18356eb060cb819b91d844128866ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* $Id: kgdb.h,v 1.7 1995/11/27 02:43:18 davem Exp $
 * kgdb.h: Defines and declarations for serial line source level
 *         remote debugging of the Linux kernel using gdb.
 *
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
 */
#ifndef _SPARC_KGDB_H
#define _SPARC_KGDB_H

#ifndef __ASSEMBLY__
/* To init the kgdb engine. */
extern void set_debug_traps(void);

/* To enter the debugger explicitly. */
extern void breakpoint(void);

/* For convenience we define the format of a kgdb trap breakpoint
 * frame here also.
 */
struct kgdb_frame {
	unsigned long globals[8];
	unsigned long outs[8];
	unsigned long locals[8];
	unsigned long ins[8];
	unsigned long fpregs[32];
	unsigned long y;
	unsigned long psr;
	unsigned long wim;
	unsigned long tbr;
	unsigned long pc;
	unsigned long npc;
	unsigned long fpsr;
	unsigned long cpsr;
};
#endif /* !(__ASSEMBLY__) */

/* Macros for assembly usage of the kgdb breakpoint frame. */
#define KGDB_G0     0x000
#define KGDB_G1     0x004
#define KGDB_G2     0x008
#define KGDB_G4     0x010
#define KGDB_G6     0x018
#define KGDB_I0     0x020
#define KGDB_I2     0x028
#define KGDB_I4     0x030
#define KGDB_I6     0x038
#define KGDB_Y      0x100
#define KGDB_PSR    0x104
#define KGDB_WIM    0x108
#define KGDB_TBR    0x10c
#define KGDB_PC     0x110
#define KGDB_NPC    0x114

#define SAVE_KGDB_GLOBALS(reg) \
        std     %g0, [%reg + REGWIN_SZ + KGDB_G0]; \
        std     %g2, [%reg + REGWIN_SZ + KGDB_G2]; \
        std     %g4, [%reg + REGWIN_SZ + KGDB_G4]; \
        std     %g6, [%reg + REGWIN_SZ + KGDB_G6];

#define SAVE_KGDB_INS(reg) \
        std     %i0, [%reg + REGWIN_SZ + KGDB_I0]; \
        std     %i2, [%reg + REGWIN_SZ + KGDB_I2]; \
        std     %i4, [%reg + REGWIN_SZ + KGDB_I4]; \
        std     %i6, [%reg + REGWIN_SZ + KGDB_I6];

#define SAVE_KGDB_SREGS(reg, reg_y, reg_psr, reg_wim, reg_tbr, reg_pc, reg_npc) \
        st      %reg_y, [%reg + REGWIN_SZ + KGDB_Y]; \
        st      %reg_psr, [%reg + REGWIN_SZ + KGDB_PSR]; \
        st      %reg_wim, [%reg + REGWIN_SZ + KGDB_WIM]; \
        st      %reg_tbr, [%reg + REGWIN_SZ + KGDB_TBR]; \
        st      %reg_pc, [%reg + REGWIN_SZ + KGDB_PC]; \
        st      %reg_npc, [%reg + REGWIN_SZ + KGDB_NPC];

#define LOAD_KGDB_GLOBALS(reg) \
        ld      [%reg + REGWIN_SZ + KGDB_G1], %g1; \
        ldd     [%reg + REGWIN_SZ + KGDB_G2], %g2; \
        ldd     [%reg + REGWIN_SZ + KGDB_G4], %g4; \
        ldd     [%reg + REGWIN_SZ + KGDB_G6], %g6;

#define LOAD_KGDB_INS(reg) \
        ldd     [%reg + REGWIN_SZ + KGDB_I0], %i0; \
        ldd     [%reg + REGWIN_SZ + KGDB_I2], %i2; \
        ldd     [%reg + REGWIN_SZ + KGDB_I4], %i4; \
        ldd     [%reg + REGWIN_SZ + KGDB_I6], %i6;

#define LOAD_KGDB_SREGS(reg, reg_y_and_psr, reg_pc_and_npc) \
        ldd     [%reg + REGWIN_SZ + KGDB_Y], %reg_y_and_psr; \
        ldd     [%reg + REGWIN_SZ + KGDB_PC], %reg_pc_and_npc;

#endif /* !(_SPARC_KGDB_H) */