Deleted Added
full compact
db_machdep.h (202175) db_machdep.h (205360)
1/* $OpenBSD: db_machdep.h,v 1.2 1998/09/15 10:50:12 pefo Exp $ */
2
3/*
4 * Copyright (c) 1998 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed under OpenBSD by
17 * Per Fogelstrom, Opsycon AB, Sweden.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * JNPR: db_machdep.h,v 1.7 2006/10/16 12:30:34 katta
1/* $OpenBSD: db_machdep.h,v 1.2 1998/09/15 10:50:12 pefo Exp $ */
2
3/*
4 * Copyright (c) 1998 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed under OpenBSD by
17 * Per Fogelstrom, Opsycon AB, Sweden.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * JNPR: db_machdep.h,v 1.7 2006/10/16 12:30:34 katta
34 * $FreeBSD: head/sys/mips/include/db_machdep.h 202175 2010-01-12 21:36:08Z imp $
34 * $FreeBSD: head/sys/mips/include/db_machdep.h 205360 2010-03-20 05:07:15Z neel $
35 */
36
37#ifndef _MIPS_DB_MACHDEP_H_
38#define _MIPS_DB_MACHDEP_H_
39
40#include <machine/frame.h>
41#include <machine/psl.h>
42#include <machine/trap.h>
43#include <machine/endian.h>
44
45typedef struct trapframe db_regs_t;
46extern db_regs_t ddb_regs; /* register state */
47
48typedef vm_offset_t db_addr_t; /* address - unsigned */
49typedef register_t db_expr_t; /* expression - signed */
50
51#if BYTE_ORDER == _BIG_ENDIAN
52#define BYTE_MSF (1)
53#endif
54
55#define SOFTWARE_SSTEP /* Need software single step */
56#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */
57db_addr_t next_instr_address(db_addr_t, boolean_t);
58#define BKPT_SIZE (4)
59#define BKPT_SET(ins) (BREAK_DDB)
60#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0)
61
62#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
63#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
64
65#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_regs.pc)
66#define BKPT_SKIP \
67 do { \
68 if((db_get_value(kdb_frame->pc, sizeof(int), FALSE) & \
69 ~BREAK_VAL_MASK) == BREAK_INSTR) { \
70 kdb_frame->pc += BKPT_SIZE; \
71 kdb_thrctx->pcb_regs.pc += BKPT_SIZE; \
72 } \
73 } while (0);
74
75
76/*
77 * Test of instructions to see class.
78 */
79#define IT_CALL 0x01
80#define IT_BRANCH 0x02
81#define IT_LOAD 0x03
82#define IT_STORE 0x04
83
84#define inst_branch(i) (db_inst_type(i) == IT_BRANCH)
85#define inst_trap_return(i) ((i) & 0)
86#define inst_call(i) (db_inst_type(i) == IT_CALL)
87#define inst_return(i) ((i) == 0x03e00008)
88#define inst_load(i) (db_inst_type(i) == IT_LOAD)
89#define inst_store(i) (db_inst_type(i) == IT_STORE)
90
91#define DB_SMALL_VALUE_MAX 0x7fffffff
92#define DB_SMALL_VALUE_MIN (-0x400001)
93
94int db_inst_type(int);
35 */
36
37#ifndef _MIPS_DB_MACHDEP_H_
38#define _MIPS_DB_MACHDEP_H_
39
40#include <machine/frame.h>
41#include <machine/psl.h>
42#include <machine/trap.h>
43#include <machine/endian.h>
44
45typedef struct trapframe db_regs_t;
46extern db_regs_t ddb_regs; /* register state */
47
48typedef vm_offset_t db_addr_t; /* address - unsigned */
49typedef register_t db_expr_t; /* expression - signed */
50
51#if BYTE_ORDER == _BIG_ENDIAN
52#define BYTE_MSF (1)
53#endif
54
55#define SOFTWARE_SSTEP /* Need software single step */
56#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */
57db_addr_t next_instr_address(db_addr_t, boolean_t);
58#define BKPT_SIZE (4)
59#define BKPT_SET(ins) (BREAK_DDB)
60#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0)
61
62#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
63#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
64
65#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_regs.pc)
66#define BKPT_SKIP \
67 do { \
68 if((db_get_value(kdb_frame->pc, sizeof(int), FALSE) & \
69 ~BREAK_VAL_MASK) == BREAK_INSTR) { \
70 kdb_frame->pc += BKPT_SIZE; \
71 kdb_thrctx->pcb_regs.pc += BKPT_SIZE; \
72 } \
73 } while (0);
74
75
76/*
77 * Test of instructions to see class.
78 */
79#define IT_CALL 0x01
80#define IT_BRANCH 0x02
81#define IT_LOAD 0x03
82#define IT_STORE 0x04
83
84#define inst_branch(i) (db_inst_type(i) == IT_BRANCH)
85#define inst_trap_return(i) ((i) & 0)
86#define inst_call(i) (db_inst_type(i) == IT_CALL)
87#define inst_return(i) ((i) == 0x03e00008)
88#define inst_load(i) (db_inst_type(i) == IT_LOAD)
89#define inst_store(i) (db_inst_type(i) == IT_STORE)
90
91#define DB_SMALL_VALUE_MAX 0x7fffffff
92#define DB_SMALL_VALUE_MIN (-0x400001)
93
94int db_inst_type(int);
95void db_dump_tlb(int, int);
96db_addr_t branch_taken(int inst, db_addr_t pc);
97void stacktrace_subr(register_t pc, register_t sp, register_t ra, int (*)(const char *, ...));
98int kdbpeek(int *);
99
100#endif /* !_MIPS_DB_MACHDEP_H_ */
95db_addr_t branch_taken(int inst, db_addr_t pc);
96void stacktrace_subr(register_t pc, register_t sp, register_t ra, int (*)(const char *, ...));
97int kdbpeek(int *);
98
99#endif /* !_MIPS_DB_MACHDEP_H_ */