db_machdep.h revision 1.6 1 1.6 eeh /* $NetBSD: db_machdep.h,v 1.6 1998/10/08 02:31:39 eeh Exp $ */
2 1.1 eeh
3 1.1 eeh /*
4 1.1 eeh * Mach Operating System
5 1.1 eeh * Copyright (c) 1991,1990 Carnegie Mellon University
6 1.1 eeh * All Rights Reserved.
7 1.1 eeh *
8 1.1 eeh * Permission to use, copy, modify and distribute this software and its
9 1.1 eeh * documentation is hereby granted, provided that both the copyright
10 1.1 eeh * notice and this permission notice appear in all copies of the
11 1.1 eeh * software, derivative works or modified versions, and any portions
12 1.1 eeh * thereof, and that both notices appear in supporting documentation.
13 1.1 eeh *
14 1.1 eeh * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 1.1 eeh * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 1.1 eeh * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 1.1 eeh *
18 1.1 eeh * Carnegie Mellon requests users of this software to return to
19 1.1 eeh *
20 1.1 eeh * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
21 1.1 eeh * School of Computer Science
22 1.1 eeh * Carnegie Mellon University
23 1.1 eeh * Pittsburgh PA 15213-3890
24 1.1 eeh *
25 1.1 eeh * any improvements or extensions that they make and grant Carnegie Mellon
26 1.1 eeh * the rights to redistribute these changes.
27 1.1 eeh */
28 1.1 eeh
29 1.1 eeh #ifndef _SPARC_DB_MACHDEP_H_
30 1.1 eeh #define _SPARC_DB_MACHDEP_H_
31 1.1 eeh
32 1.1 eeh /*
33 1.1 eeh * Machine-dependent defines for new kernel debugger.
34 1.1 eeh */
35 1.1 eeh
36 1.1 eeh
37 1.1 eeh #include <vm/vm.h>
38 1.1 eeh #include <machine/frame.h>
39 1.1 eeh #include <machine/psl.h>
40 1.1 eeh #include <machine/trap.h>
41 1.1 eeh #include <machine/reg.h>
42 1.1 eeh
43 1.1 eeh /* end of mangling */
44 1.1 eeh
45 1.6 eeh typedef vaddr_t db_addr_t; /* address - unsigned */
46 1.1 eeh typedef long db_expr_t; /* expression - signed */
47 1.1 eeh
48 1.1 eeh #if 1
49 1.1 eeh typedef struct {
50 1.1 eeh struct trapframe ddb_tf;
51 1.3 eeh struct frame64 ddb_fr;
52 1.1 eeh } db_regs_t;
53 1.1 eeh #else
54 1.1 eeh struct trapregs {
55 1.1 eeh int64_t tt;
56 1.1 eeh int64_t tstate;
57 1.1 eeh int64_t tpc;
58 1.1 eeh int64_t tnpc;
59 1.1 eeh };
60 1.1 eeh typedef struct db_regs {
61 1.1 eeh struct trapregs dbr_traps[4];
62 1.1 eeh int dbr_y;
63 1.1 eeh char dbr_tl;
64 1.1 eeh char dbr_canrestore;
65 1.1 eeh char dbr_cansave;
66 1.1 eeh char dbr_cleanwin;
67 1.1 eeh char dbr_cwp;
68 1.1 eeh char dbr_wstate;
69 1.1 eeh int64_t dbr_g[8];
70 1.1 eeh int64_t dbr_ag[8];
71 1.1 eeh int64_t dbr_ig[8];
72 1.1 eeh int64_t dbr_mg[8];
73 1.1 eeh int64_t dbr_out[8];
74 1.1 eeh int64_t dbr_local[8];
75 1.1 eeh int64_t dbr_in[8];
76 1.1 eeh } db_regs_t;
77 1.1 eeh #endif
78 1.1 eeh
79 1.1 eeh db_regs_t ddb_regs; /* register state */
80 1.1 eeh #define DDB_REGS (&ddb_regs)
81 1.1 eeh #define DDB_TF (&ddb_regs.ddb_tf)
82 1.1 eeh #define DDB_FR (&ddb_regs.ddb_fr)
83 1.1 eeh
84 1.1 eeh #if defined(lint)
85 1.1 eeh #define PC_REGS(regs) ((regs)->ddb_tf.tf_pc)
86 1.1 eeh #else
87 1.1 eeh #define PC_REGS(regs) ((db_addr_t)(regs)->ddb_tf.tf_pc)
88 1.1 eeh #endif
89 1.1 eeh #define PC_ADVANCE(regs) do { \
90 1.5 eeh vaddr_t n = (regs)->ddb_tf.tf_npc; \
91 1.1 eeh (regs)->ddb_tf.tf_pc = n; \
92 1.1 eeh (regs)->ddb_tf.tf_npc = n + 4; \
93 1.1 eeh } while(0)
94 1.1 eeh
95 1.1 eeh #define BKPT_INST 0x91d02001 /* breakpoint instruction */
96 1.1 eeh #define BKPT_SIZE (4) /* size of breakpoint inst */
97 1.1 eeh #define BKPT_SET(inst) (BKPT_INST)
98 1.1 eeh
99 1.1 eeh #define db_clear_single_step(regs) (void) (0)
100 1.1 eeh #define db_set_single_step(regs) (void) (0)
101 1.1 eeh
102 1.1 eeh #define IS_BREAKPOINT_TRAP(type, code) \
103 1.1 eeh ((type) == T_BREAKPOINT || (type) == T_KGDB_EXEC)
104 1.1 eeh #define IS_WATCHPOINT_TRAP(type, code) (0)
105 1.1 eeh
106 1.1 eeh #define inst_trap_return(ins) ((ins)&0)
107 1.1 eeh #define inst_return(ins) ((ins)&0)
108 1.1 eeh #define inst_call(ins) ((ins)&0)
109 1.1 eeh #define inst_load(ins) 0
110 1.1 eeh #define inst_store(ins) 0
111 1.1 eeh
112 1.1 eeh #define DB_MACHINE_COMMANDS
113 1.1 eeh
114 1.1 eeh void db_machine_init __P((void));
115 1.1 eeh int kdb_trap __P((int, struct trapframe *));
116 1.1 eeh
117 1.1 eeh /*
118 1.1 eeh * We will use elf symbols in DDB when they work.
119 1.1 eeh */
120 1.1 eeh #if 1
121 1.1 eeh #define DB_ELF_SYMBOLS
122 1.4 eeh #ifdef _LP64
123 1.1 eeh #define DB_ELFSIZE 64
124 1.1 eeh #else
125 1.1 eeh #define DB_ELFSIZE 32
126 1.1 eeh #endif
127 1.1 eeh #else
128 1.1 eeh #define DB_AOUT_SYMBOLS
129 1.1 eeh #endif
130 1.1 eeh /*
131 1.1 eeh * KGDB definitions
132 1.1 eeh */
133 1.1 eeh typedef u_long kgdb_reg_t;
134 1.1 eeh #define KGDB_NUMREGS 72
135 1.1 eeh #define KGDB_BUFLEN 1024
136 1.1 eeh
137 1.1 eeh #endif /* _SPARC_DB_MACHDEP_H_ */
138