Home | History | Annotate | Line # | Download | only in include
db_machdep.h revision 1.26.14.1
      1  1.26.14.1  jdolecek /*	$NetBSD: db_machdep.h,v 1.26.14.1 2017/12/03 11:36:43 jdolecek Exp $ */
      2        1.2   deraadt 
      3        1.7        pk /*
      4        1.1        pk  * Mach Operating System
      5        1.1        pk  * Copyright (c) 1991,1990 Carnegie Mellon University
      6        1.1        pk  * All Rights Reserved.
      7        1.7        pk  *
      8        1.1        pk  * Permission to use, copy, modify and distribute this software and its
      9        1.1        pk  * documentation is hereby granted, provided that both the copyright
     10        1.1        pk  * notice and this permission notice appear in all copies of the
     11        1.1        pk  * software, derivative works or modified versions, and any portions
     12        1.1        pk  * thereof, and that both notices appear in supporting documentation.
     13        1.7        pk  *
     14        1.1        pk  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15        1.1        pk  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     16        1.1        pk  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17        1.7        pk  *
     18        1.1        pk  * Carnegie Mellon requests users of this software to return to
     19        1.7        pk  *
     20        1.1        pk  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21        1.1        pk  *  School of Computer Science
     22        1.1        pk  *  Carnegie Mellon University
     23        1.1        pk  *  Pittsburgh PA 15213-3890
     24        1.7        pk  *
     25        1.1        pk  * any improvements or extensions that they make and grant Carnegie Mellon
     26        1.1        pk  * the rights to redistribute these changes.
     27        1.1        pk  */
     28        1.1        pk 
     29        1.1        pk #ifndef	_SPARC_DB_MACHDEP_H_
     30        1.1        pk #define	_SPARC_DB_MACHDEP_H_
     31        1.1        pk 
     32        1.1        pk /*
     33        1.1        pk  * Machine-dependent defines for new kernel debugger.
     34        1.1        pk  */
     35  1.26.14.1  jdolecek #include <sys/types.h>
     36  1.26.14.1  jdolecek 
     37       1.14       mrg #include <uvm/uvm_extern.h>
     38  1.26.14.1  jdolecek 
     39        1.1        pk #include <machine/frame.h>
     40       1.24     rmind #include <machine/pcb.h>
     41        1.1        pk #include <machine/psl.h>
     42        1.1        pk #include <machine/trap.h>
     43        1.1        pk #include <machine/reg.h>
     44        1.1        pk 
     45       1.12        pk typedef	vaddr_t		db_addr_t;	/* address - unsigned */
     46       1.26     joerg #define	DDB_EXPR_FMT	"l"		/* expression is long */
     47        1.8        pk typedef	long		db_expr_t;	/* expression - signed */
     48        1.1        pk 
     49        1.3        pk typedef struct {
     50       1.10        pk 	struct trapframe db_tf;
     51       1.10        pk 	struct frame	 db_fr;
     52        1.3        pk } db_regs_t;
     53        1.3        pk 
     54       1.19        pk /* Current CPU register state */
     55       1.19        pk extern struct cpu_info *ddb_cpuinfo;
     56       1.19        pk extern db_regs_t	*ddb_regp;
     57       1.19        pk #define DDB_REGS        ddb_regp
     58       1.15       mrg #define	DDB_TF		(&ddb_regp->db_tf)
     59       1.15       mrg #define	DDB_FR		(&ddb_regp->db_fr)
     60       1.18        pk 
     61        1.1        pk 
     62        1.8        pk #if defined(lint)
     63       1.10        pk #define	PC_REGS(regs)	((regs)->db_tf.tf_pc)
     64        1.8        pk #else
     65       1.10        pk #define	PC_REGS(regs)	((db_addr_t)(regs)->db_tf.tf_pc)
     66        1.8        pk #endif
     67       1.10        pk #define	PC_ADVANCE(regs) do {				\
     68       1.10        pk 	int n = (regs)->db_tf.tf_npc;			\
     69       1.10        pk 	(regs)->db_tf.tf_pc = n;			\
     70       1.10        pk 	(regs)->db_tf.tf_npc = n + 4;			\
     71       1.10        pk } while(0)
     72        1.1        pk 
     73       1.20       scw #define	BKPT_ADDR(addr)	(addr)		/* breakpoint address */
     74        1.1        pk #define	BKPT_INST	0x91d02001	/* breakpoint instruction */
     75        1.1        pk #define	BKPT_SIZE	(4)		/* size of breakpoint inst */
     76       1.22    cherry #define	BKPT_SET(inst, addr)	(BKPT_INST)
     77        1.1        pk 
     78       1.10        pk #define	IS_BREAKPOINT_TRAP(type, code)	\
     79       1.10        pk 	((type) == T_BREAKPOINT || (type) == T_KGDB_EXEC)
     80        1.1        pk #define IS_WATCHPOINT_TRAP(type, code)	(0)
     81        1.1        pk 
     82       1.11        pk /*
     83       1.11        pk  * Sparc cpus have no hardware single-step.
     84       1.11        pk  */
     85       1.11        pk #define SOFTWARE_SSTEP
     86       1.11        pk 
     87       1.23   thorpej bool		db_inst_trap_return(int inst);
     88       1.23   thorpej bool		db_inst_return(int inst);
     89       1.23   thorpej bool		db_inst_call(int inst);
     90       1.23   thorpej bool		db_inst_branch(int inst);
     91       1.21       uwe int		db_inst_load(int inst);
     92       1.21       uwe int		db_inst_store(int inst);
     93       1.23   thorpej bool		db_inst_unconditional_flow_transfer(int inst);
     94       1.21       uwe db_addr_t	db_branch_taken(int inst, db_addr_t pc, db_regs_t *regs);
     95       1.11        pk 
     96       1.11        pk #define inst_trap_return(ins)	db_inst_trap_return(ins)
     97       1.11        pk #define inst_return(ins)	db_inst_return(ins)
     98       1.11        pk #define inst_call(ins)		db_inst_call(ins)
     99       1.11        pk #define inst_branch(ins)	db_inst_branch(ins)
    100       1.11        pk #define inst_load(ins)		db_inst_load(ins)
    101       1.11        pk #define inst_store(ins)		db_inst_store(ins)
    102       1.11        pk #define	inst_unconditional_flow_transfer(ins) \
    103       1.11        pk 				db_inst_unconditional_flow_transfer(ins)
    104       1.11        pk #define branch_taken(ins, pc, regs) \
    105       1.11        pk 				db_branch_taken((ins), (pc), (regs))
    106       1.11        pk 
    107       1.11        pk /* see note in db_interface.c about reversed breakpoint addrs */
    108       1.11        pk #define next_instr_address(pc, bd) \
    109       1.19        pk 	((bd) ? (pc) : ddb_regp->db_tf.tf_npc)
    110       1.11        pk 
    111       1.11        pk 
    112        1.1        pk 
    113        1.1        pk #define DB_MACHINE_COMMANDS
    114        1.6  christos 
    115       1.21       uwe int kdb_trap(int, struct trapframe *);
    116        1.6  christos 
    117        1.9   thorpej /*
    118       1.25       mrg  * We use elf symbols in DDB.
    119        1.9   thorpej  */
    120       1.13  christos #define	DB_ELF_SYMBOLS
    121       1.10        pk 
    122       1.10        pk 
    123       1.10        pk /*
    124       1.10        pk  * KGDB definitions
    125       1.10        pk  */
    126       1.10        pk typedef u_long		kgdb_reg_t;
    127       1.10        pk #define KGDB_NUMREGS	72
    128       1.10        pk #define KGDB_BUFLEN	1024
    129        1.1        pk 
    130        1.1        pk #endif	/* _SPARC_DB_MACHDEP_H_ */
    131