xref: /netbsd-src/sys/arch/mips/include/db_machdep.h (revision fdecd6a253f999ae92b139670d9e15cc9df4497c)
1 /* $NetBSD: db_machdep.h,v 1.2 1997/07/07 03:57:55 jonathan Exp $ */
2 
3 /*
4  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by Jonathan Stone for
18  *      the NetBSD Project.
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 #ifndef	_MIPS_DB_MACHDEP_H_
35 #define	_MIPS_DB_MACHDEP_H_
36 
37 #include <vm/vm_param.h>		/* XXX  boolean_t */
38 #include <mips/trap.h>			/* T_BREAK */
39 #include <mips/reg.h>			/* register names */
40 #include <mips/proc.h>			/* register state */
41 
42 
43 typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
44 typedef	long		db_expr_t;	/* expression - signed */
45 
46 typedef struct frame db_regs_t;
47 
48 db_regs_t		ddb_regs;	/* register state */
49 #define	DDB_REGS	(&ddb_regs)
50 
51 #define	PC_REGS(regs)	((db_addr_t)(regs)->f_regs[PC])
52 
53 #define BKPT_INST	0x0001000D	/* XXX endianness? */
54 #define	BKPT_SIZE	(4)		/* size of breakpoint inst */
55 #define	BKPT_SET(inst)	(BKPT_INST)
56 
57 #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BREAK)
58 #define IS_WATCHPOINT_TRAP(type, code)	(0)	/* XXX mips3 watchpoint */
59 
60 #define	inst_trap_return(ins)	((ins)&0)
61 #define	inst_return(ins)	((ins)&0)
62 #define inst_load(ins)		0
63 #define inst_store(ins)		0
64 
65 /*
66  * Interface to  disassembly (shared with mdb)
67  */
68 db_addr_t  db_disasm_insn __P((int insn, db_addr_t loc,  boolean_t altfmt));
69 
70 
71 /*
72  * Entrypoints to DDB for kernel, keyboard drivers, init hook
73  */
74 void 	kdb_kbd_trap __P((db_regs_t *));
75 int 	kdb_trap __P((int type, db_regs_t *));
76 void	db_machine_init __P((void));
77 
78 
79 /*
80  * We use ELF symbols in DDB.
81  *
82  */
83 /* #define	DB_ELF_SYMBOLS */
84 #define	DB_AOUT_SYMBOLS */
85 
86 /*
87  * MIPS cpus have no hardware single-step.
88  */
89 #define SOFTWARE_SSTEP
90 
91 boolean_t inst_branch __P((int inst));
92 boolean_t inst_call __P((int inst));
93 boolean_t inst_unconditional_flow_transfer __P((int inst));
94 db_addr_t branch_taken __P((int inst, db_addr_t pc, db_regs_t *regs));
95 db_addr_t next_instr_address __P((db_addr_t pc, boolean_t bd));
96 
97 /*
98  * We have  machine-dependent commands.
99  */
100 #define DB_MACHINE_COMMANDS
101 
102 #endif	/* _MIPS_DB_MACHDEP_H_ */
103