db_machdep.h revision 1.3.2.2 1 1.3.2.2 mycroft /*
2 1.3.2.2 mycroft * Mach Operating System
3 1.3.2.2 mycroft * Copyright (c) 1991,1990 Carnegie Mellon University
4 1.3.2.2 mycroft * All Rights Reserved.
5 1.3.2.2 mycroft *
6 1.3.2.2 mycroft * Permission to use, copy, modify and distribute this software and its
7 1.3.2.2 mycroft * documentation is hereby granted, provided that both the copyright
8 1.3.2.2 mycroft * notice and this permission notice appear in all copies of the
9 1.3.2.2 mycroft * software, derivative works or modified versions, and any portions
10 1.3.2.2 mycroft * thereof, and that both notices appear in supporting documentation.
11 1.3.2.2 mycroft *
12 1.3.2.2 mycroft * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 1.3.2.2 mycroft * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 1.3.2.2 mycroft * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 1.3.2.2 mycroft *
16 1.3.2.2 mycroft * Carnegie Mellon requests users of this software to return to
17 1.3.2.2 mycroft *
18 1.3.2.2 mycroft * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
19 1.3.2.2 mycroft * School of Computer Science
20 1.3.2.2 mycroft * Carnegie Mellon University
21 1.3.2.2 mycroft * Pittsburgh PA 15213-3890
22 1.3.2.2 mycroft *
23 1.3.2.2 mycroft * any improvements or extensions that they make and grant Carnegie Mellon
24 1.3.2.2 mycroft * the rights to redistribute these changes.
25 1.3.2.2 mycroft *
26 1.3.2.2 mycroft * $Id: db_machdep.h,v 1.3.2.2 1993/12/19 03:41:52 mycroft Exp $
27 1.3.2.2 mycroft */
28 1.3.2.2 mycroft
29 1.3.2.2 mycroft #ifndef _I386_DB_MACHDEP_H_
30 1.3.2.2 mycroft #define _I386_DB_MACHDEP_H_
31 1.3.2.2 mycroft
32 1.3.2.2 mycroft /*
33 1.3.2.2 mycroft * Machine-dependent defines for new kernel debugger.
34 1.3.2.2 mycroft */
35 1.3.2.2 mycroft
36 1.3.2.2 mycroft
37 1.3.2.2 mycroft #include <vm/vm_prot.h>
38 1.3.2.2 mycroft #include <vm/vm_param.h>
39 1.3.2.2 mycroft #include <vm/vm_inherit.h>
40 1.3.2.2 mycroft #include <vm/lock.h>
41 1.3.2.2 mycroft #include <machine/frame.h>
42 1.3.2.2 mycroft #include <machine/psl.h>
43 1.3.2.2 mycroft #include <machine/trap.h>
44 1.3.2.2 mycroft
45 1.3.2.2 mycroft #define i386_saved_state trapframe
46 1.3.2.2 mycroft /* end of mangling */
47 1.3.2.2 mycroft
48 1.3.2.2 mycroft typedef vm_offset_t db_addr_t; /* address - unsigned */
49 1.3.2.2 mycroft typedef int db_expr_t; /* expression - signed */
50 1.3.2.2 mycroft
51 1.3.2.2 mycroft typedef struct i386_saved_state db_regs_t;
52 1.3.2.2 mycroft db_regs_t ddb_regs; /* register state */
53 1.3.2.2 mycroft #define DDB_REGS (&ddb_regs)
54 1.3.2.2 mycroft
55 1.3.2.2 mycroft #define PC_REGS(regs) ((db_addr_t)(regs)->tf_eip)
56 1.3.2.2 mycroft
57 1.3.2.2 mycroft #define BKPT_INST 0xcc /* breakpoint instruction */
58 1.3.2.2 mycroft #define BKPT_SIZE (1) /* size of breakpoint inst */
59 1.3.2.2 mycroft #define BKPT_SET(inst) (BKPT_INST)
60 1.3.2.2 mycroft
61 1.3.2.2 mycroft #define FIXUP_PC_AFTER_BREAK ddb_regs.tf_eip -= 1;
62 1.3.2.2 mycroft
63 1.3.2.2 mycroft #define db_clear_single_step(regs) ((regs)->tf_eflags &= ~PSL_T)
64 1.3.2.2 mycroft #define db_set_single_step(regs) ((regs)->tf_eflags |= PSL_T)
65 1.3.2.2 mycroft
66 1.3.2.2 mycroft #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT)
67 1.3.2.2 mycroft #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_TRCTRAP && (code) & 15)
68 1.3.2.2 mycroft
69 1.3.2.2 mycroft #define I_CALL 0xe8
70 1.3.2.2 mycroft #define I_CALLI 0xff
71 1.3.2.2 mycroft #define I_RET 0xc3
72 1.3.2.2 mycroft #define I_IRET 0xcf
73 1.3.2.2 mycroft
74 1.3.2.2 mycroft #define inst_trap_return(ins) (((ins)&0xff) == I_IRET)
75 1.3.2.2 mycroft #define inst_return(ins) (((ins)&0xff) == I_RET)
76 1.3.2.2 mycroft #define inst_call(ins) (((ins)&0xff) == I_CALL || \
77 1.3.2.2 mycroft (((ins)&0xff) == I_CALLI && \
78 1.3.2.2 mycroft ((ins)&0x3800) == 0x1000))
79 1.3.2.2 mycroft #define inst_load(ins) 0
80 1.3.2.2 mycroft #define inst_store(ins) 0
81 1.3.2.2 mycroft
82 1.3.2.2 mycroft /* access capability and access macros */
83 1.3.2.2 mycroft
84 1.3.2.2 mycroft #define DB_ACCESS_LEVEL 2 /* access any space */
85 1.3.2.2 mycroft #define DB_CHECK_ACCESS(addr,size,task) \
86 1.3.2.2 mycroft db_check_access(addr,size,task)
87 1.3.2.2 mycroft #define DB_PHYS_EQ(task1,addr1,task2,addr2) \
88 1.3.2.2 mycroft db_phys_eq(task1,addr1,task2,addr2)
89 1.3.2.2 mycroft #define DB_VALID_KERN_ADDR(addr) \
90 1.3.2.2 mycroft ((addr) >= VM_MIN_KERNEL_ADDRESS && \
91 1.3.2.2 mycroft (addr) < VM_MAX_KERNEL_ADDRESS)
92 1.3.2.2 mycroft #define DB_VALID_ADDRESS(addr,user) \
93 1.3.2.2 mycroft ((!(user) && DB_VALID_KERN_ADDR(addr)) || \
94 1.3.2.2 mycroft ((user) && (addr) < VM_MAX_ADDRESS))
95 1.3.2.2 mycroft
96 1.3.2.2 mycroft boolean_t db_check_access(/* vm_offset_t, int, task_t */);
97 1.3.2.2 mycroft boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */);
98 1.3.2.2 mycroft
99 1.3.2.2 mycroft /* macros for printing OS server dependent task name */
100 1.3.2.2 mycroft
101 1.3.2.2 mycroft #define DB_TASK_NAME(task) db_task_name(task)
102 1.3.2.2 mycroft #define DB_TASK_NAME_TITLE "COMMAND "
103 1.3.2.2 mycroft #define DB_TASK_NAME_LEN 23
104 1.3.2.2 mycroft #define DB_NULL_TASK_NAME "? "
105 1.3.2.2 mycroft
106 1.3.2.2 mycroft void db_task_name(/* task_t */);
107 1.3.2.2 mycroft
108 1.3.2.2 mycroft /* macro for checking if a thread has used floating-point */
109 1.3.2.2 mycroft
110 1.3.2.2 mycroft #define db_thread_fp_used(thread) ((thread)->pcb->ims.ifps != 0)
111 1.3.2.2 mycroft
112 1.3.2.2 mycroft #endif /* _I386_DB_MACHDEP_H_ */
113