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