1 /* $OpenBSD: db_machdep.h,v 1.2 1998/09/15 10:50:12 pefo Exp $ */
4 * SPDX-License-Identifier: BSD-4-Clause
6 * Copyright (c) 1998 Per Fogelstrom, Opsycon AB
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed under OpenBSD by
19 * Per Fogelstrom, Opsycon AB, Sweden.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
24 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * JNPR: db_machdep.h,v 1.7 2006/10/16 12:30:34 katta
39 #ifndef _MIPS_DB_MACHDEP_H_
40 #define _MIPS_DB_MACHDEP_H_
42 #include <machine/frame.h>
43 #include <machine/trap.h>
45 typedef struct trapframe db_regs_t;
46 extern db_regs_t ddb_regs; /* register state */
48 typedef vm_offset_t db_addr_t; /* address - unsigned */
49 typedef register_t db_expr_t; /* expression - signed */
51 #define SOFTWARE_SSTEP /* Need software single step */
52 #define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */
53 db_addr_t next_instr_address(db_addr_t, boolean_t);
55 #define BKPT_SET(ins) (MIPS_BREAK_DDB)
56 #define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0)
58 #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
59 #define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
61 #define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_regs.pc)
64 if((db_get_value(kdb_frame->pc, sizeof(int), FALSE) & \
65 ~MIPS_BREAK_VAL_MASK) == MIPS_BREAK_INSTR) { \
66 kdb_frame->pc += BKPT_SIZE; \
67 kdb_thrctx->pcb_regs.pc += BKPT_SIZE; \
72 * Test of instructions to see class.
75 #define IT_BRANCH 0x02
79 #define inst_branch(i) (db_inst_type(i) == IT_BRANCH)
80 #define inst_trap_return(i) ((i) & 0)
81 #define inst_call(i) (db_inst_type(i) == IT_CALL)
82 #define inst_return(i) ((i) == 0x03e00008)
83 #define inst_load(i) (db_inst_type(i) == IT_LOAD)
84 #define inst_store(i) (db_inst_type(i) == IT_STORE)
86 int db_inst_type(int);
87 db_addr_t branch_taken(int inst, db_addr_t pc);
88 int32_t kdbpeek(int *);
89 int64_t kdbpeekd(int *);
91 #endif /* !_MIPS_DB_MACHDEP_H_ */