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