db_machdep.h revision 1.1 1 1.1 ichiro /* $NetBSD: db_machdep.h,v 1.1 2001/02/23 03:48:15 ichiro Exp $ */
2 1.1 ichiro
3 1.1 ichiro /*
4 1.1 ichiro * Copyright (c) 1996 Scott K Stevens
5 1.1 ichiro *
6 1.1 ichiro * Mach Operating System
7 1.1 ichiro * Copyright (c) 1991,1990 Carnegie Mellon University
8 1.1 ichiro * All Rights Reserved.
9 1.1 ichiro *
10 1.1 ichiro * Permission to use, copy, modify and distribute this software and its
11 1.1 ichiro * documentation is hereby granted, provided that both the copyright
12 1.1 ichiro * notice and this permission notice appear in all copies of the
13 1.1 ichiro * software, derivative works or modified versions, and any portions
14 1.1 ichiro * thereof, and that both notices appear in supporting documentation.
15 1.1 ichiro *
16 1.1 ichiro * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 1.1 ichiro * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
18 1.1 ichiro * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 1.1 ichiro *
20 1.1 ichiro * Carnegie Mellon requests users of this software to return to
21 1.1 ichiro *
22 1.1 ichiro * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
23 1.1 ichiro * School of Computer Science
24 1.1 ichiro * Carnegie Mellon University
25 1.1 ichiro * Pittsburgh PA 15213-3890
26 1.1 ichiro *
27 1.1 ichiro * any improvements or extensions that they make and grant Carnegie Mellon
28 1.1 ichiro * the rights to redistribute these changes.
29 1.1 ichiro */
30 1.1 ichiro
31 1.1 ichiro #ifndef _ARM32_DB_MACHDEP_H_
32 1.1 ichiro #define _ARM32_DB_MACHDEP_H_
33 1.1 ichiro
34 1.1 ichiro /*
35 1.1 ichiro * Machine-dependent defines for new kernel debugger.
36 1.1 ichiro */
37 1.1 ichiro
38 1.1 ichiro #include <uvm/uvm_extern.h>
39 1.1 ichiro #include <machine/frame.h>
40 1.1 ichiro #include <machine/psl.h>
41 1.1 ichiro #include <machine/trap.h>
42 1.1 ichiro
43 1.1 ichiro /* end of mangling */
44 1.1 ichiro
45 1.1 ichiro typedef vm_offset_t db_addr_t; /* address - unsigned */
46 1.1 ichiro typedef long db_expr_t; /* expression - signed */
47 1.1 ichiro
48 1.1 ichiro typedef trapframe_t db_regs_t;
49 1.1 ichiro
50 1.1 ichiro db_regs_t ddb_regs; /* register state */
51 1.1 ichiro #define DDB_REGS (&ddb_regs)
52 1.1 ichiro
53 1.1 ichiro #define PC_REGS(regs) ((db_addr_t)(regs)->tf_pc)
54 1.1 ichiro
55 1.1 ichiro #define BKPT_INST (KERNEL_BREAKPOINT) /* breakpoint instruction */
56 1.1 ichiro #define BKPT_SIZE (INSN_SIZE) /* size of breakpoint inst */
57 1.1 ichiro #define BKPT_SET(inst) (BKPT_INST)
58 1.1 ichiro
59 1.1 ichiro /*#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_pc -= BKPT_SIZE)*/
60 1.1 ichiro
61 1.1 ichiro #define T_BREAKPOINT (1)
62 1.1 ichiro
63 1.1 ichiro #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT)
64 1.1 ichiro #define IS_WATCHPOINT_TRAP(type, code) (0)
65 1.1 ichiro
66 1.1 ichiro #define inst_trap_return(ins) (0)
67 1.1 ichiro /* ldmxx reg, {..., pc}
68 1.1 ichiro 01800000 stack mode
69 1.1 ichiro 000f0000 register
70 1.1 ichiro 0000ffff register list */
71 1.1 ichiro /* mov pc, reg
72 1.1 ichiro 0000000f register */
73 1.1 ichiro #define inst_return(ins) (((ins) & 0x0e108000) == 0x08108000 || \
74 1.1 ichiro ((ins) & 0x0ff0fff0) == 0x01a0f000)
75 1.1 ichiro /* bl ...
76 1.1 ichiro 00ffffff offset>>2 */
77 1.1 ichiro #define inst_call(ins) (((ins) & 0x0f000000) == 0x0b000000)
78 1.1 ichiro /* b ...
79 1.1 ichiro 00ffffff offset>>2 */
80 1.1 ichiro /* ldr pc, [pc, reg, lsl #2]
81 1.1 ichiro 0000000f register */
82 1.1 ichiro #define inst_branch(ins) (((ins) & 0x0f000000) == 0x0a000000 || \
83 1.1 ichiro ((ins) & 0x0fdffff0) == 0x079ff100)
84 1.1 ichiro #define inst_load(ins) (0)
85 1.1 ichiro #define inst_store(ins) (0)
86 1.1 ichiro #define inst_unconditional_flow_transfer(ins) \
87 1.1 ichiro ((((ins) & INSN_COND_MASK) == INSN_COND_AL) && \
88 1.1 ichiro (inst_branch(ins) || inst_call(ins) || inst_return(ins)))
89 1.1 ichiro
90 1.1 ichiro #define getreg_val (0)
91 1.1 ichiro #define next_instr_address(pc, bd) ((bd) ? (pc) : ((pc) + INSN_SIZE))
92 1.1 ichiro
93 1.1 ichiro #define DB_MACHINE_COMMANDS
94 1.1 ichiro
95 1.1 ichiro #define SOFTWARE_SSTEP
96 1.1 ichiro
97 1.1 ichiro u_int branch_taken __P((u_int insn, u_int pc, db_regs_t *db_regs));
98 1.1 ichiro int kdb_trap __P((int, db_regs_t *));
99 1.1 ichiro
100 1.1 ichiro /*
101 1.1 ichiro * We use a.out symbols in DDB.
102 1.1 ichiro */
103 1.1 ichiro #define DB_AOUT_SYMBOLS
104 1.1 ichiro
105 1.1 ichiro #endif /* _ARM32_DB_MACHDEP_H_ */
106