db_machdep.h revision 1.2 1 1.1 glass /*
2 1.1 glass * Mach Operating System
3 1.1 glass * Copyright (c) 1992 Carnegie Mellon University
4 1.1 glass * All Rights Reserved.
5 1.1 glass *
6 1.1 glass * Permission to use, copy, modify and distribute this software and its
7 1.1 glass * documentation is hereby granted, provided that both the copyright
8 1.1 glass * notice and this permission notice appear in all copies of the
9 1.1 glass * software, derivative works or modified versions, and any portions
10 1.1 glass * thereof, and that both notices appear in supporting documentation.
11 1.1 glass *
12 1.1 glass * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 1.1 glass * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 1.1 glass * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 1.1 glass *
16 1.1 glass * Carnegie Mellon requests users of this software to return to
17 1.1 glass *
18 1.1 glass * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
19 1.1 glass * School of Computer Science
20 1.1 glass * Carnegie Mellon University
21 1.1 glass * Pittsburgh PA 15213-3890
22 1.1 glass *
23 1.1 glass * any improvements or extensions that they make and grant Carnegie Mellon
24 1.1 glass * the rights to redistribute these changes.
25 1.1 glass */
26 1.1 glass /*
27 1.1 glass * HISTORY
28 1.1 glass * $Log: db_machdep.h,v $
29 1.2 glass * Revision 1.2 1993/08/10 08:42:37 glass
30 1.2 glass * fixed problem that caused two consecutive segments to be using the same
31 1.2 glass * pmeg unknowingly. still too many printfs, not sure how many are actualy
32 1.1 glass * in the machine dependent code. reaches cpu_startup() where it stops
33 1.1 glass * deliberately. next project: autoconfig(), maybe kgdb
34 1.1 glass *
35 1.1 glass * Revision 1.1 93/08/08 12:18:27 glass
36 1.1 glass * various changes
37 1.1 glass *
38 1.1 glass * Revision 2.5 91/07/31 18:12:56 dbg
39 1.1 glass * Changed register save area name.
40 1.1 glass * [91/07/12 dbg]
41 1.1 glass *
42 1.1 glass * Revision 2.4 91/01/08 15:52:19 rpd
43 1.1 glass * Added dummy inst_load/inst_store macros.
44 1.1 glass * [91/01/06 rpd]
45 1.1 glass *
46 1.1 glass * Revision 2.3 90/10/25 14:47:23 rwd
47 1.1 glass * Added watchpoint support.
48 1.1 glass * [90/10/16 rwd]
49 1.1 glass *
50 1.1 glass * Revision 2.2 90/08/27 22:11:31 dbg
51 1.1 glass * Created.
52 1.1 glass * [90/07/25 dbg]
53 1.1 glass *
54 1.1 glass */
55 1.1 glass
56 1.1 glass /*
57 1.1 glass * Machine-dependent defines for new kernel debugger.
58 1.1 glass */
59 1.1 glass #ifndef _SUN3_DB_MACHDEP_H_
60 1.1 glass #define _SUN3_DB_MACHDEP_H_
61 1.1 glass
62 1.1 glass /*#include <mach/sun3/vm_types.h>*/
63 1.1 glass /*#include <mach/sun3/vm_param.h>*/
64 1.1 glass /*#include <sun3/thread.h>*/ /* for thread_status */
65 1.1 glass #include <vm/queue.h>
66 1.1 glass #include <vm/vm_prot.h>
67 1.1 glass #include <vm/vm_param.h>
68 1.1 glass #include <vm/vm_inherit.h>
69 1.1 glass #include <vm/lock.h>
70 1.1 glass #include <machine/psl.h>
71 1.1 glass #include <machine/trap.h>
72 1.1 glass
73 1.1 glass
74 1.1 glass typedef vm_offset_t db_addr_t; /* address - unsigned */
75 1.1 glass typedef int db_expr_t; /* expression - signed */
76 1.1 glass struct mc68020_saved_state {
77 1.1 glass int d0; /* data registers */
78 1.1 glass int d1;
79 1.1 glass int d2;
80 1.1 glass int d3;
81 1.1 glass int d4;
82 1.1 glass int d5;
83 1.1 glass int d6;
84 1.1 glass int d7;
85 1.1 glass int a0; /* address registers */
86 1.1 glass int a1;
87 1.1 glass int a2;
88 1.1 glass int a3;
89 1.1 glass int a4;
90 1.1 glass int a5;
91 1.1 glass int a6;
92 1.1 glass int sp; /* stack pointer */
93 1.1 glass unsigned short sr; /* status register */
94 1.1 glass unsigned int pc; /* program counter - UNALIGNED!!! */
95 1.1 glass unsigned int stkfmt : 4; /* rte stack frame format */
96 1.1 glass unsigned int vector : 12; /* vector number */
97 1.1 glass };
98 1.1 glass typedef struct mc68020_saved_state db_regs_t;
99 1.1 glass db_regs_t ddb_regs; /* register state */
100 1.1 glass #define DDB_REGS (&ddb_regs)
101 1.1 glass
102 1.1 glass #define PC_REGS(regs) ((db_addr_t)(regs)->pc)
103 1.1 glass
104 1.2 glass #define BKPT_INST 0x4e4f /* breakpoint instruction */
105 1.1 glass #define BKPT_SIZE (2) /* size of breakpoint inst */
106 1.1 glass #define BKPT_SET(inst) (BKPT_INST)
107 1.1 glass
108 1.1 glass #define FIXUP_PC_AFTER_BREAK ddb_regs.pc -= 2;
109 1.1 glass
110 1.1 glass #define SR_T1 0x8000
111 1.1 glass #define db_clear_single_step(regs) ((regs)->sr &= ~SR_T1)
112 1.1 glass #define db_set_single_step(regs) ((regs)->sr |= SR_T1)
113 1.1 glass
114 1.1 glass #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BRKPT)
115 1.1 glass #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT)
116 1.1 glass
117 1.1 glass #define M_RTS 0xffff0000
118 1.1 glass #define I_RTS 0x4e750000
119 1.1 glass #define M_JSR 0xffc00000
120 1.1 glass #define I_JSR 0x4e800000
121 1.1 glass #define M_BSR 0xff000000
122 1.1 glass #define I_BSR 0x61000000
123 1.1 glass #define M_RTE 0xffff0000
124 1.1 glass #define I_RTE 0x4e730000
125 1.1 glass
126 1.1 glass #define inst_trap_return(ins) (((ins)&M_RTE) == I_RTE)
127 1.1 glass #define inst_return(ins) (((ins)&M_RTS) == I_RTS)
128 #define inst_call(ins) (((ins)&M_JSR) == I_JSR || \
129 ((ins)&M_BSR) == I_BSR)
130 #define inst_load(ins) 0
131 #define inst_store(ins) 0
132
133 #endif /* _SUN3_DDB_MACHDEP_H_ */
134