|
|
1.1 root 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 [email protected]
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 1.1.1.1 1993/03/21 09:45:47 cgd
30: * initial import of 386bsd-0.1 sources
31: *
32: * Revision 2.8 92/02/19 15:07:56 elf
33: * Added db_thread_fp_used.
34: * [92/02/19 rpd]
35: *
36: * Revision 2.7 91/10/09 16:06:28 af
37: * Revision 2.6.3.1 91/10/05 13:10:32 jeffreyh
38: * Added access and task name macros.
39: * [91/08/29 tak]
40: *
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 91/05/14 16:05:58 mrt
46: * Correcting copyright
47: *
48: * Revision 2.5 91/02/05 17:11:17 mrt
49: * Changed to new Mach copyright
50: * [91/02/01 17:31:24 mrt]
51: *
52: * Revision 2.4 91/01/08 15:10:16 rpd
53: * Added dummy inst_load/inst_store macros.
54: * [90/12/11 rpd]
55: *
56: * Revision 2.3 90/10/25 14:44:49 rwd
57: * Added watchpoint support.
58: * [90/10/18 rpd]
59: *
60: * Revision 2.2 90/08/27 21:56:15 dbg
61: * Created.
62: * [90/07/25 dbg]
63: *
64: */
65:
66: #ifndef _I386_DB_MACHDEP_H_
67: #define _I386_DB_MACHDEP_H_
68:
69: /*
70: * Machine-dependent defines for new kernel debugger.
71: */
72:
73:
74: /* #include <mach/i386/vm_types.h> */
75: /* #include <mach/i386/vm_param.h> */
76: #include <vm/vm_prot.h>
77: #include <vm/vm_param.h>
78: #include <vm/vm_inherit.h>
79: #include <vm/lock.h>
80: /* #include <i386/thread.h> */ /* for thread_status */
81: #include <machine/frame.h> /* for struct trapframe */
82: /* #include <i386/eflags.h> */
83: #include <machine/eflags.h> /* from Mach... */
84: /* #include <i386/trap.h> */
85: #include <machine/trap.h>
86:
87: #define i386_saved_state trapframe
88: /* end of mangling */
89:
90: typedef vm_offset_t db_addr_t; /* address - unsigned */
91: typedef int db_expr_t; /* expression - signed */
92:
93: typedef struct i386_saved_state db_regs_t;
94: db_regs_t ddb_regs; /* register state */
95: #define DDB_REGS (&ddb_regs)
96:
97: #define PC_REGS(regs) ((db_addr_t)(regs)->tf_eip)
98:
99: #define BKPT_INST 0xcc /* breakpoint instruction */
100: #define BKPT_SIZE (1) /* size of breakpoint inst */
101: #define BKPT_SET(inst) (BKPT_INST)
102:
103: #define FIXUP_PC_AFTER_BREAK ddb_regs.tf_eip -= 1;
104:
105: #define db_clear_single_step(regs) ((regs)->tf_eflags &= ~EFL_TF)
106: #define db_set_single_step(regs) ((regs)->tf_eflags |= EFL_TF)
107:
108: /* #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_INT3) */
109: /* #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT) */
110: /* using the 386bsd values, rather than the Mach ones: */
111: #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT)
112: #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_KDBTRAP)
113:
114: #define I_CALL 0xe8
115: #define I_CALLI 0xff
116: #define I_RET 0xc3
117: #define I_IRET 0xcf
118:
119: #define inst_trap_return(ins) (((ins)&0xff) == I_IRET)
120: #define inst_return(ins) (((ins)&0xff) == I_RET)
121: #define inst_call(ins) (((ins)&0xff) == I_CALL || \
122: (((ins)&0xff) == I_CALLI && \
123: ((ins)&0x3800) == 0x1000))
124: #define inst_load(ins) 0
125: #define inst_store(ins) 0
126:
127: /* access capability and access macros */
128:
129: #define DB_ACCESS_LEVEL 2 /* access any space */
130: #define DB_CHECK_ACCESS(addr,size,task) \
131: db_check_access(addr,size,task)
132: #define DB_PHYS_EQ(task1,addr1,task2,addr2) \
133: db_phys_eq(task1,addr1,task2,addr2)
134: #define DB_VALID_KERN_ADDR(addr) \
135: ((addr) >= VM_MIN_KERNEL_ADDRESS && \
136: (addr) < VM_MAX_KERNEL_ADDRESS)
137: #define DB_VALID_ADDRESS(addr,user) \
138: ((!(user) && DB_VALID_KERN_ADDR(addr)) || \
139: ((user) && (addr) < VM_MIN_KERNEL_ADDRESS))
140:
141: boolean_t db_check_access(/* vm_offset_t, int, task_t */);
142: boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */);
143:
144: /* macros for printing OS server dependent task name */
145:
146: #define DB_TASK_NAME(task) db_task_name(task)
147: #define DB_TASK_NAME_TITLE "COMMAND "
148: #define DB_TASK_NAME_LEN 23
149: #define DB_NULL_TASK_NAME "? "
150:
151: void db_task_name(/* task_t */);
152:
153: /* macro for checking if a thread has used floating-point */
154:
155: #define db_thread_fp_used(thread) ((thread)->pcb->ims.ifps != 0)
156:
157: #endif /* _I386_DB_MACHDEP_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.