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