db_machdep.h revision 12589
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 *	$Id: db_machdep.h,v 1.8 1995/05/30 08:00:34 rgrimes Exp $
27 */
28
29#ifndef _MACHINE_DB_MACHDEP_H_
30#define	_MACHINE_DB_MACHDEP_H_
31
32#include <machine/frame.h>
33#include <machine/psl.h>
34
35#define i386_saved_state trapframe
36
37typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
38typedef	int		db_expr_t;	/* expression - signed */
39
40typedef struct i386_saved_state db_regs_t;
41extern db_regs_t	ddb_regs;	/* register state */
42#define	DDB_REGS	(&ddb_regs)
43
44#define	PC_REGS(regs)	(((regs)->tf_cs & 0xfffc) == 0x08 \
45			 ? (db_addr_t)(regs)->tf_eip : 0)
46
47#define	BKPT_INST	0xcc		/* breakpoint instruction */
48#define	BKPT_SIZE	(1)		/* size of breakpoint inst */
49#define	BKPT_SET(inst)	(BKPT_INST)
50
51#define	FIXUP_PC_AFTER_BREAK	ddb_regs.tf_eip -= 1;
52
53#define	db_clear_single_step(regs)	((regs)->tf_eflags &= ~PSL_T)
54#define	db_set_single_step(regs)	((regs)->tf_eflags |=  PSL_T)
55
56#define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BPTFLT)
57/*
58 * Watchpoints are not supported.  The debug exception type is in %dr6
59 * and not yet in the args to this macro.
60 */
61#define IS_WATCHPOINT_TRAP(type, code)	0
62
63#define	I_CALL		0xe8
64#define	I_CALLI		0xff
65#define	I_RET		0xc3
66#define	I_IRET		0xcf
67
68#define	inst_trap_return(ins)	(((ins)&0xff) == I_IRET)
69#define	inst_return(ins)	(((ins)&0xff) == I_RET)
70#define	inst_call(ins)		(((ins)&0xff) == I_CALL || \
71				 (((ins)&0xff) == I_CALLI && \
72				  ((ins)&0x3800) == 0x1000))
73#define inst_load(ins)		0
74#define inst_store(ins)		0
75
76#endif /* !_MACHINE_DB_MACHDEP_H_ */
77