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