Annotation of sys/arch/sparc64/include/db_machdep.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: db_machdep.h,v 1.9 2005/01/04 21:14:35 espie Exp $ */
2: /* $NetBSD: db_machdep.h,v 1.12 2001/07/07 15:16:13 eeh Exp $ */
3:
4: /*
5: * Mach Operating System
6: * Copyright (c) 1991,1990 Carnegie Mellon University
7: * All Rights Reserved.
8: *
9: * Permission to use, copy, modify and distribute this software and its
10: * 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.
14: *
15: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
17: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18: *
19: * Carnegie Mellon requests users of this software to return to
20: *
21: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22: * School of Computer Science
23: * Carnegie Mellon University
24: * Pittsburgh PA 15213-3890
25: *
26: * any improvements or extensions that they make and grant Carnegie Mellon
27: * the rights to redistribute these changes.
28: */
29:
30: #ifndef _SPARC_DB_MACHDEP_H_
31: #define _SPARC_DB_MACHDEP_H_
32:
33: /*
34: * Machine-dependent defines for new kernel debugger.
35: */
36:
37: #include <uvm/uvm_extern.h>
38:
39: #include <machine/frame.h>
40: #include <machine/psl.h>
41: #include <machine/trap.h>
42: #include <machine/reg.h>
43:
44: /* end of mangling */
45:
46: typedef vaddr_t db_addr_t; /* address - unsigned */
47: typedef long db_expr_t; /* expression - signed */
48:
49: struct trapstate {
50: int64_t tstate;
51: int64_t tpc;
52: int64_t tnpc;
53: int64_t tt;
54: };
55: #if 1
56: typedef struct {
57: struct trapframe64 ddb_tf;
58: struct frame64 ddb_fr;
59: struct trapstate ddb_ts[5];
60: int ddb_tl;
61: struct fpstate64 ddb_fpstate;
62: } db_regs_t;
63: #else
64: typedef struct db_regs {
65: struct trapregs dbr_traps[4];
66: int dbr_y;
67: char dbr_tl;
68: char dbr_canrestore;
69: char dbr_cansave;
70: char dbr_cleanwin;
71: char dbr_cwp;
72: char dbr_wstate;
73: int64_t dbr_g[8];
74: int64_t dbr_ag[8];
75: int64_t dbr_ig[8];
76: int64_t dbr_mg[8];
77: int64_t dbr_out[8];
78: int64_t dbr_local[8];
79: int64_t dbr_in[8];
80: } db_regs_t;
81: #endif
82:
83: extern db_regs_t ddb_regs; /* register state */
84: #define DDB_REGS (&ddb_regs)
85: #define DDB_TF (&ddb_regs.ddb_tf)
86: #define DDB_FR (&ddb_regs.ddb_fr)
87: #define DDB_FP (&ddb_regs.ddb_fpstate)
88:
89: #define PC_REGS(regs) ((db_addr_t)(regs)->ddb_tf.tf_pc)
90: #define SET_PC_REGS(regs, value) (regs)->ddb_tf.tf_pc = (int32_t)(value)
91: #define PC_ADVANCE(regs) do { \
92: vaddr_t n = (regs)->ddb_tf.tf_npc; \
93: (regs)->ddb_tf.tf_pc = n; \
94: (regs)->ddb_tf.tf_npc = n + 4; \
95: } while(0)
96:
97: #define BKPT_INST 0x91d02001 /* breakpoint instruction */
98: #define BKPT_SIZE (4) /* size of breakpoint inst */
99: #define BKPT_SET(inst) (BKPT_INST)
100:
101: #define IS_BREAKPOINT_TRAP(type, code) \
102: ((type) == T_BREAKPOINT || (type) == T_KGDB_EXEC)
103: #define IS_WATCHPOINT_TRAP(type, code) \
104: ((type) ==T_PA_WATCHPT || (type) == T_VA_WATCHPT)
105:
106: /*
107: * Sparc cpus have no hardware single-step.
108: */
109: #define SOFTWARE_SSTEP
110:
111: boolean_t db_inst_trap_return(int inst);
112: boolean_t db_inst_return(int inst);
113: boolean_t db_inst_call(int inst);
114: boolean_t db_inst_branch(int inst);
115: int db_inst_load(int inst);
116: int db_inst_store(int inst);
117: boolean_t db_inst_unconditional_flow_transfer(int inst);
118: db_addr_t db_branch_taken(int inst, db_addr_t pc, db_regs_t *regs);
119: void db_machine_init(void);
120:
121: #define inst_trap_return(ins) db_inst_trap_return(ins)
122: #define inst_return(ins) db_inst_return(ins)
123: #define inst_call(ins) db_inst_call(ins)
124: #define inst_branch(ins) db_inst_branch(ins)
125: #define inst_load(ins) db_inst_load(ins)
126: #define inst_store(ins) db_inst_store(ins)
127: #define inst_unconditional_flow_transfer(ins) \
128: db_inst_unconditional_flow_transfer(ins)
129: #define branch_taken(ins, pc, fun, regs) \
130: db_branch_taken((ins), (pc), (regs))
131:
132: /* see note in db_interface.c about reversed breakpoint addrs */
133: #define next_instr_address(pc, bd) \
134: ((bd) ? (pc) : ddb_regs.ddb_tf.tf_npc)
135:
136: #define DB_MACHINE_COMMANDS
137:
138: void db_machine_init(void);
139: int kdb_trap(int, struct trapframe64 *);
140:
141: /*
142: * We will use elf symbols in DDB when they work.
143: */
144: #define DB_ELF_SYMBOLS
145: #define DB_ELFSIZE 64
146:
147: /*
148: * KGDB definitions
149: */
150: typedef u_long kgdb_reg_t;
151: #define KGDB_NUMREGS 72
152: #define KGDB_BUFLEN 1024
153:
154: #endif /* _SPARC_DB_MACHDEP_H_ */
CVSweb