1 /* $NetBSD: db_machdep.h,v 1.16 2006/05/17 21:35:45 drochner Exp $ */
4 * Copyright (c) 1995 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #ifndef _ALPHA_DB_MACHDEP_H_
31 #define _ALPHA_DB_MACHDEP_H_
34 * Machine-dependent defines for new kernel debugger.
37 #include <sys/param.h>
38 #include <uvm/uvm_extern.h>
39 #include <machine/frame.h>
41 typedef vaddr_t db_addr_t
; /* address - unsigned */
42 typedef long db_expr_t
; /* expression - signed */
44 typedef struct trapframe db_regs_t
;
45 extern db_regs_t
*ddb_regp
; /* pointer to current register state */
46 #define DDB_REGS (ddb_regp)
48 #define PC_REGS(regs) ((regs)->tf_regs[FRAME_PC])
50 #define BKPT_ADDR(addr) (addr) /* breakpoint address */
51 #define BKPT_INST 0x00000080 /* breakpoint instruction */
52 #define BKPT_SIZE (4) /* size of breakpoint inst */
53 #define BKPT_SET(inst, addr) (BKPT_INST)
55 #define FIXUP_PC_AFTER_BREAK(regs) \
56 ((regs)->tf_regs[FRAME_PC] -= BKPT_SIZE)
58 #define SOFTWARE_SSTEP 1 /* no hardware support */
59 #define IS_BREAKPOINT_TRAP(type, code) ((type) == ALPHA_KENTRY_IF && \
60 (code) == ALPHA_IF_CODE_BPT)
61 #define IS_WATCHPOINT_TRAP(type, code) 0
64 * Functions needed for software single-stepping.
67 bool db_inst_trap_return(int inst
);
68 bool db_inst_return(int inst
);
69 bool db_inst_call(int inst
);
70 bool db_inst_branch(int inst
);
71 bool db_inst_load(int inst
);
72 bool db_inst_store(int inst
);
73 bool db_inst_unconditional_flow_transfer(int inst
);
74 db_addr_t
db_branch_taken(int inst
, db_addr_t pc
, db_regs_t
*regs
);
76 #define inst_trap_return(ins) db_inst_trap_return(ins)
77 #define inst_return(ins) db_inst_return(ins)
78 #define inst_call(ins) db_inst_call(ins)
79 #define inst_branch(ins) db_inst_branch(ins)
80 #define inst_load(ins) db_inst_load(ins)
81 #define inst_store(ins) db_inst_store(ins)
82 #define inst_unconditional_flow_transfer(ins) \
83 db_inst_unconditional_flow_transfer(ins)
84 #define branch_taken(ins, pc, regs) \
85 db_branch_taken((ins), (pc), (regs))
87 /* No delay slots on Alpha. */
88 #define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4)))
90 u_long
db_register_value(db_regs_t
*, int);
91 int ddb_trap(unsigned long, unsigned long, unsigned long,
92 unsigned long, struct trapframe
*);
94 int alpha_debug(unsigned long, unsigned long, unsigned long,
95 unsigned long, struct trapframe
*);
97 struct alpha_bus_space
;
98 void alpha_kgdb_init(const char **, struct alpha_bus_space
*);
101 * We define some of our own commands.
103 #define DB_MACHINE_COMMANDS
106 * We use Elf64 symbols in DDB.
108 #define DB_ELF_SYMBOLS
109 #define DB_ELFSIZE 64
114 typedef long kgdb_reg_t
;
115 #define KGDB_NUMREGS 66 /* from tm-alpha.h, NUM_REGS */
116 #define KGDB_REG_V0 0
117 #define KGDB_REG_T0 1
118 #define KGDB_REG_T1 2
119 #define KGDB_REG_T2 3
120 #define KGDB_REG_T3 4
121 #define KGDB_REG_T4 5
122 #define KGDB_REG_T5 6
123 #define KGDB_REG_T6 7
124 #define KGDB_REG_T7 8
125 #define KGDB_REG_S0 9
126 #define KGDB_REG_S1 10
127 #define KGDB_REG_S2 11
128 #define KGDB_REG_S3 12
129 #define KGDB_REG_S4 13
130 #define KGDB_REG_S5 14
131 #define KGDB_REG_S6 15 /* FP */
132 #define KGDB_REG_A0 16
133 #define KGDB_REG_A1 17
134 #define KGDB_REG_A2 18
135 #define KGDB_REG_A3 19
136 #define KGDB_REG_A4 20
137 #define KGDB_REG_A5 21
138 #define KGDB_REG_T8 22
139 #define KGDB_REG_T9 23
140 #define KGDB_REG_T10 24
141 #define KGDB_REG_T11 25
142 #define KGDB_REG_RA 26
143 #define KGDB_REG_T12 27
144 #define KGDB_REG_AT 28
145 #define KGDB_REG_GP 29
146 #define KGDB_REG_SP 30
147 #define KGDB_REG_ZERO 31
148 #define KGDB_REG_F0 32
149 #define KGDB_REG_F1 33
150 #define KGDB_REG_F2 34
151 #define KGDB_REG_F3 35
152 #define KGDB_REG_F4 36
153 #define KGDB_REG_F5 37
154 #define KGDB_REG_F6 38
155 #define KGDB_REG_F7 39
156 #define KGDB_REG_F8 40
157 #define KGDB_REG_F9 41
158 #define KGDB_REG_F10 42
159 #define KGDB_REG_F11 43
160 #define KGDB_REG_F12 44
161 #define KGDB_REG_F13 45
162 #define KGDB_REG_F14 46
163 #define KGDB_REG_F15 47
164 #define KGDB_REG_F16 48
165 #define KGDB_REG_F17 49
166 #define KGDB_REG_F18 50
167 #define KGDB_REG_F19 51
168 #define KGDB_REG_F20 52
169 #define KGDB_REG_F21 53
170 #define KGDB_REG_F22 54
171 #define KGDB_REG_F23 55
172 #define KGDB_REG_F24 56
173 #define KGDB_REG_F25 57
174 #define KGDB_REG_F26 58
175 #define KGDB_REG_F27 59
176 #define KGDB_REG_F28 60
177 #define KGDB_REG_F29 61
178 #define KGDB_REG_F30 62
179 #define KGDB_REG_F31 63
180 #define KGDB_REG_PC 64
181 #define KGDB_REG_VFP 65
183 /* Too much? Must be large enough for register transfer. */
184 #define KGDB_BUFLEN 1024
186 #endif /* _ALPHA_DB_MACHDEP_H_ */