FreeBSD/Linux Kernel Cross Reference
sys/i386/db_machdep.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: db_machdep.h,v $
29 * Revision 2.9 93/01/14 17:28:42 danner
30 * Added SAVE/RESTORE macros for multiP usage.
31 * [92/12/16 12:42:39 af]
32 *
33 * Say we only do a.out images.
34 * [92/12/10 17:37:02 af]
35 *
36 * Revision 2.8 92/02/19 15:07:56 elf
37 * Added db_thread_fp_used.
38 * [92/02/19 rpd]
39 *
40 * Revision 2.7 91/10/09 16:06:28 af
41 * Revision 2.6.3.1 91/10/05 13:10:32 jeffreyh
42 * Added access and task name macros.
43 * [91/08/29 tak]
44 *
45 * Revision 2.6.3.1 91/10/05 13:10:32 jeffreyh
46 * Added access and task name macros.
47 * [91/08/29 tak]
48 *
49 * Revision 2.6 91/05/14 16:05:58 mrt
50 * Correcting copyright
51 *
52 * Revision 2.5 91/02/05 17:11:17 mrt
53 * Changed to new Mach copyright
54 * [91/02/01 17:31:24 mrt]
55 *
56 * Revision 2.4 91/01/08 15:10:16 rpd
57 * Added dummy inst_load/inst_store macros.
58 * [90/12/11 rpd]
59 *
60 * Revision 2.3 90/10/25 14:44:49 rwd
61 * Added watchpoint support.
62 * [90/10/18 rpd]
63 *
64 * Revision 2.2 90/08/27 21:56:15 dbg
65 * Created.
66 * [90/07/25 dbg]
67 *
68 */
69
70 #ifndef _I386_DB_MACHDEP_H_
71 #define _I386_DB_MACHDEP_H_
72
73 /*
74 * Machine-dependent defines for new kernel debugger.
75 */
76
77 #include <mach/i386/vm_types.h>
78 #include <mach/i386/vm_param.h>
79 #include <i386/thread.h> /* for thread_status */
80 #include <i386/eflags.h>
81 #include <i386/trap.h>
82
83 typedef vm_offset_t db_addr_t; /* address - unsigned */
84 typedef int db_expr_t; /* expression - signed */
85
86 typedef struct i386_saved_state db_regs_t;
87 db_regs_t ddb_regs; /* register state */
88 #define DDB_REGS (&ddb_regs)
89 #define SAVE_DDB_REGS DB_SAVE(db_regs_t, ddb_regs)
90 #define RESTORE_DDB_REGS DB_RESTORE(ddb_regs)
91
92 #define PC_REGS(regs) ((db_addr_t)(regs)->eip)
93
94 #define BKPT_INST 0xcc /* breakpoint instruction */
95 #define BKPT_SIZE (1) /* size of breakpoint inst */
96 #define BKPT_SET(inst) (BKPT_INST)
97
98 #define FIXUP_PC_AFTER_BREAK ddb_regs.eip -= 1;
99
100 #define db_clear_single_step(regs) ((regs)->efl &= ~EFL_TF)
101 #define db_set_single_step(regs) ((regs)->efl |= EFL_TF)
102
103 #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_INT3)
104 #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT)
105
106 #define I_CALL 0xe8
107 #define I_CALLI 0xff
108 #define I_RET 0xc3
109 #define I_IRET 0xcf
110
111 #define inst_trap_return(ins) (((ins)&0xff) == I_IRET)
112 #define inst_return(ins) (((ins)&0xff) == I_RET)
113 #define inst_call(ins) (((ins)&0xff) == I_CALL || \
114 (((ins)&0xff) == I_CALLI && \
115 ((ins)&0x3800) == 0x1000))
116 #define inst_load(ins) 0
117 #define inst_store(ins) 0
118
119 /* access capability and access macros */
120
121 #define DB_ACCESS_LEVEL 2 /* access any space */
122 #define DB_CHECK_ACCESS(addr,size,task) \
123 db_check_access(addr,size,task)
124 #define DB_PHYS_EQ(task1,addr1,task2,addr2) \
125 db_phys_eq(task1,addr1,task2,addr2)
126 #define DB_VALID_KERN_ADDR(addr) \
127 ((addr) >= VM_MIN_KERNEL_ADDRESS && \
128 (addr) < VM_MAX_KERNEL_ADDRESS)
129 #define DB_VALID_ADDRESS(addr,user) \
130 ((!(user) && DB_VALID_KERN_ADDR(addr)) || \
131 ((user) && (addr) < VM_MIN_KERNEL_ADDRESS))
132
133 boolean_t db_check_access(/* vm_offset_t, int, task_t */);
134 boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */);
135
136 /* macros for printing OS server dependent task name */
137
138 #define DB_TASK_NAME(task) db_task_name(task)
139 #define DB_TASK_NAME_TITLE "COMMAND "
140 #define DB_TASK_NAME_LEN 23
141 #define DB_NULL_TASK_NAME "? "
142
143 void db_task_name(/* task_t */);
144
145 /* macro for checking if a thread has used floating-point */
146
147 #define db_thread_fp_used(thread) ((thread)->pcb->ims.ifps != 0)
148
149 /* only a.out symbol tables */
150
151 #define DB_NO_COFF 1
152
153 #endif /* _I386_DB_MACHDEP_H_ */
Cache object: 95cccf01e2d47b2135dfa2179d2f5af7
|