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