xref: /netbsd-src/sys/arch/vax/include/db_machdep.h (revision dc2ac295848fdbeb08478f3a5bb113efa716e9ad)
1*dc2ac295Schristos /*	$NetBSD: db_machdep.h,v 1.20 2017/11/06 03:47:48 christos Exp $	*/
2913f0b04Sragge 
3913f0b04Sragge /*
4913f0b04Sragge  * Mach Operating System
5913f0b04Sragge  * Copyright (c) 1991,1990 Carnegie Mellon University
6913f0b04Sragge  * All Rights Reserved.
7913f0b04Sragge  *
8913f0b04Sragge  * Permission to use, copy, modify and distribute this software and its
9913f0b04Sragge  * documentation is hereby granted, provided that both the copyright
10913f0b04Sragge  * notice and this permission notice appear in all copies of the
11913f0b04Sragge  * software, derivative works or modified versions, and any portions
12913f0b04Sragge  * thereof, and that both notices appear in supporting documentation.
13913f0b04Sragge  *
14913f0b04Sragge  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15913f0b04Sragge  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16913f0b04Sragge  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17913f0b04Sragge  *
18913f0b04Sragge  * Carnegie Mellon requests users of this software to return to
19913f0b04Sragge  *
20913f0b04Sragge  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
21913f0b04Sragge  *  School of Computer Science
22913f0b04Sragge  *  Carnegie Mellon University
23913f0b04Sragge  *  Pittsburgh PA 15213-3890
24913f0b04Sragge  *
25913f0b04Sragge  * any improvements or extensions that they make and grant Carnegie Mellon
26913f0b04Sragge  * the rights to redistribute these changes.
27913f0b04Sragge  */
28913f0b04Sragge 
29913f0b04Sragge #ifndef	_VAX_DB_MACHDEP_H_
30913f0b04Sragge #define	_VAX_DB_MACHDEP_H_
31913f0b04Sragge 
32913f0b04Sragge /*
33913f0b04Sragge  * Machine-dependent defines for new kernel debugger.
34913f0b04Sragge  * Modified for vax out of i386 code.
35913f0b04Sragge  */
36913f0b04Sragge 
37913f0b04Sragge #include <sys/param.h>
38ee5c2a53Suebayasi #include <uvm/uvm.h>
39913f0b04Sragge #include <machine/trap.h>
40972b94efSragge #include <machine/psl.h>
41913f0b04Sragge 
42e0df4ffcSmatt typedef	vaddr_t		db_addr_t;	/* address - unsigned */
43a2bf8e5dSjoerg #define	DDB_EXPR_FMT	"l"		/* expression is long */
44eaeee62aSragge typedef	long		db_expr_t;	/* expression - signed */
45913f0b04Sragge 
46913f0b04Sragge typedef struct trapframe db_regs_t;
470a6d35b7Smatt extern	db_regs_t	ddb_regs;	/* register state */
48913f0b04Sragge #define	DDB_REGS	(&ddb_regs)
49913f0b04Sragge 
509b5b6463Smatt #define	PC_REGS(regs)	(*(db_addr_t *)&(regs)->tf_pc)
51913f0b04Sragge 
528c5c893bSscw #define	BKPT_ADDR(addr)	(addr)		/* breakpoint address */
53913f0b04Sragge #define	BKPT_INST	0x03		/* breakpoint instruction */
54913f0b04Sragge #define	BKPT_SIZE	(1)		/* size of breakpoint inst */
5593447d7aScherry #define	BKPT_SET(inst, addr)	(BKPT_INST)
56913f0b04Sragge 
579b5b6463Smatt #define	FIXUP_PC_AFTER_BREAK(regs)	((regs)->tf_pc -= BKPT_SIZE)
58913f0b04Sragge 
599b5b6463Smatt #define	db_clear_single_step(regs)	((regs)->tf_psl &= ~PSL_T)
609b5b6463Smatt #define	db_set_single_step(regs)	((regs)->tf_psl |=  PSL_T)
61913f0b04Sragge 
62913f0b04Sragge #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BPTFLT)
63913f0b04Sragge #define IS_WATCHPOINT_TRAP(type, code)	((type) == T_TRCTRAP)
64913f0b04Sragge 
65913f0b04Sragge #define	I_CALL		0xfb
66913f0b04Sragge #define	I_RET		0x04
67913f0b04Sragge #define	I_IRET		0x02
68913f0b04Sragge 
69913f0b04Sragge #define	inst_trap_return(ins)	(((ins)&0xff) == I_IRET)
70913f0b04Sragge #define	inst_return(ins)	(((ins)&0xff) == I_RET)
71913f0b04Sragge #define	inst_call(ins)		(((ins)&0xff) == I_CALL)
72913f0b04Sragge 
73913f0b04Sragge #define inst_load(ins)		0
74913f0b04Sragge #define inst_store(ins)		0
75913f0b04Sragge 
76f81f19e7Sragge #define DB_MACHINE_COMMANDS
77f81f19e7Sragge 
78a24af7a7Sragge /* Prototypes */
79dfba8166Smatt void	kdb_trap(struct trapframe *);
800404c01cSthorpej 
810404c01cSthorpej /*
82504811faSmatt  * We use a.out symbols in DDB (unless we are ELF then we use ELF symbols).
830404c01cSthorpej  */
84504811faSmatt #define	DB_ELF_SYMBOLS
850404c01cSthorpej 
86913f0b04Sragge #endif	/* _VAX_DB_MACHDEP_H_ */
87