Home | History | Annotate | Line # | Download | only in include
      1  1.5   skrll /* $NetBSD: db_machdep.h,v 1.5 2023/10/06 11:45:37 skrll Exp $ */
      2  1.1  cherry 
      3  1.1  cherry /*
      4  1.1  cherry  * Copyright (c) 1995 Carnegie-Mellon University.
      5  1.1  cherry  * All rights reserved.
      6  1.1  cherry  *
      7  1.1  cherry  * Author: Chris G. Demetriou
      8  1.1  cherry  *
      9  1.1  cherry  * Permission to use, copy, modify and distribute this software and
     10  1.1  cherry  * its documentation is hereby granted, provided that both the copyright
     11  1.1  cherry  * notice and this permission notice appear in all copies of the
     12  1.1  cherry  * software, derivative works or modified versions, and any portions
     13  1.1  cherry  * thereof, and that both notices appear in supporting documentation.
     14  1.1  cherry  *
     15  1.1  cherry  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.1  cherry  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.1  cherry  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.1  cherry  *
     19  1.1  cherry  * Carnegie Mellon requests users of this software to return to
     20  1.1  cherry  *
     21  1.1  cherry  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.1  cherry  *  School of Computer Science
     23  1.1  cherry  *  Carnegie Mellon University
     24  1.1  cherry  *  Pittsburgh PA 15213-3890
     25  1.1  cherry  *
     26  1.1  cherry  * any improvements or extensions that they make and grant Carnegie the
     27  1.1  cherry  * rights to redistribute these changes.
     28  1.1  cherry  */
     29  1.1  cherry 
     30  1.1  cherry #ifndef	_IA64_DB_MACHDEP_H_
     31  1.1  cherry #define	_IA64_DB_MACHDEP_H_
     32  1.1  cherry 
     33  1.1  cherry /*
     34  1.1  cherry  * Machine-dependent defines for new kernel debugger.
     35  1.1  cherry  */
     36  1.1  cherry 
     37  1.2  cherry #include <sys/lock.h>
     38  1.1  cherry #include <sys/param.h>
     39  1.1  cherry #include <uvm/uvm_extern.h>
     40  1.1  cherry #include <machine/frame.h>
     41  1.1  cherry #include <machine/ia64_cpu.h>
     42  1.1  cherry 
     43  1.1  cherry typedef	vaddr_t		db_addr_t;	/* address - unsigned */
     44  1.3   joerg #define	DDB_EXPR_FMT	"l"		/* expression is long */
     45  1.1  cherry typedef	long		db_expr_t;	/* expression - signed */
     46  1.1  cherry 
     47  1.1  cherry typedef struct trapframe db_regs_t;
     48  1.1  cherry extern db_regs_t	*ddb_regp;	/* pointer to current register state */
     49  1.1  cherry #define	DDB_REGS	(ddb_regp)
     50  1.1  cherry 
     51  1.1  cherry #if 0	/* XXX: disabling this until we switch on makectx()and have a proper \
     52  1.1  cherry 	   curlwp(). TODO: please switch this back on ASAP */
     53  1.1  cherry 
     54  1.1  cherry #define	PC_REGS(regs)	((db_addr_t)(regs)->tf_special.__spare == 0) ?	\
     55  1.1  cherry 			((db_addr_t)(regs)->tf_special.rp) :		\
     56  1.1  cherry 			((db_addr_t)(regs)->tf_special.iip + (((regs)->tf_special.psr>>41) & 3))
     57  1.1  cherry #endif
     58  1.1  cherry 
     59  1.1  cherry #if 1
     60  1.1  cherry #define PC_REGS(regs)   ((db_addr_t)(regs)->tf_special.iip + (((regs)->tf_special.psr>>41) & 3))
     61  1.1  cherry #endif
     62  1.1  cherry 
     63  1.1  cherry #define db_set_single_step(regs)	((regs)->tf_special.psr |= IA64_PSR_SS)
     64  1.1  cherry #define db_clear_single_step(regs)	((regs)->tf_special.psr &= ~IA64_PSR_SS)
     65  1.1  cherry 
     66  1.1  cherry 
     67  1.1  cherry 
     68  1.1  cherry /* defines to help with manipulating ia64 VLIW instruction bundles and slots */
     69  1.1  cherry 
     70  1.1  cherry #define	TMPL_BITS	5
     71  1.1  cherry #define	TMPL_MASK	((1 << TMPL_BITS) - 1)
     72  1.1  cherry #define	SLOT_BITS	41
     73  1.1  cherry #define	SLOT_COUNT	3
     74  1.1  cherry #define	SLOT_MASK	((1ULL << SLOT_BITS) - 1ULL)
     75  1.1  cherry #define	SLOT_SHIFT(i)	(TMPL_BITS+((i)<<3)+(i))
     76  1.1  cherry 
     77  1.1  cherry #define ADDR_SLOT0(addr)	( (addr) & ~(0xFUL) )
     78  1.1  cherry #define SLOT_ADDR(addr)		( (addr) & (0xFUL) )
     79  1.5   skrll /* breakpoint address.
     80  1.5   skrll  * Check for violations of pseudo offsets above 2.
     81  1.1  cherry  * Adjust for 32 bit shift within Bundle.
     82  1.1  cherry  */
     83  1.1  cherry 
     84  1.1  cherry #define	BKPT_ADDR(addr)	( (SLOT_ADDR(addr) < SLOT_COUNT) ? \
     85  1.1  cherry 			  (ADDR_SLOT0(addr) | (SLOT_ADDR(addr) << 2))	\
     86  1.1  cherry 			  : ADDR_SLOT0(addr) )
     87  1.1  cherry 
     88  1.1  cherry #define	BKPT_SIZE	8
     89  1.1  cherry 
     90  1.1  cherry #define	BKPT_SET(inst, addr)	db_bkpt_set(inst, addr)
     91  1.1  cherry db_expr_t db_bkpt_set(db_expr_t inst, db_addr_t addr);
     92  1.1  cherry 
     93  1.1  cherry 
     94  1.1  cherry #define PC_ADVANCE(regs) db_pc_advance(regs)
     95  1.1  cherry void db_pc_advance(db_regs_t *);
     96  1.1  cherry 
     97  1.1  cherry #define	IS_BREAKPOINT_TRAP(type, code)	(type == IA64_VEC_BREAK)
     98  1.1  cherry #define	IS_WATCHPOINT_TRAP(type, code)	0
     99  1.1  cherry 
    100  1.1  cherry 
    101  1.1  cherry #define	inst_trap_return(ins)	(ins & 0)
    102  1.1  cherry #define	inst_return(ins)	(ins & 0)
    103  1.1  cherry #define	inst_call(ins)		(ins & 0)
    104  1.1  cherry #define	inst_branch(ins)	(ins & 0)
    105  1.1  cherry #define	inst_load(ins)		(ins & 0)
    106  1.1  cherry #define	inst_store(ins)		(ins & 0)
    107  1.1  cherry #define	inst_unconditional_flow_transfer(ins) (ins & 0)
    108  1.1  cherry 
    109  1.1  cherry #define	branch_taken(ins, pc, regs) pc
    110  1.1  cherry 
    111  1.1  cherry u_long	db_register_value(db_regs_t *, int);
    112  1.1  cherry int	ddb_trap(unsigned long, unsigned long, unsigned long,
    113  1.1  cherry 	    unsigned long, struct trapframe *);
    114  1.1  cherry 
    115  1.1  cherry int ia64_trap(int, int, db_regs_t *); /* See: trap.c */
    116  1.1  cherry 
    117  1.1  cherry /*
    118  1.1  cherry  * We define some of our own commands.
    119  1.1  cherry  */
    120  1.1  cherry #define	DB_MACHINE_COMMANDS
    121  1.1  cherry 
    122  1.1  cherry /*
    123  1.1  cherry  * We use Elf64 symbols in DDB.
    124  1.1  cherry  */
    125  1.1  cherry #define	DB_ELF_SYMBOLS
    126  1.1  cherry 
    127  1.1  cherry /*
    128  1.1  cherry  * Stuff for KGDB.
    129  1.1  cherry  */
    130  1.1  cherry typedef long		kgdb_reg_t;
    131  1.1  cherry #define	KGDB_NUMREGS	66	/* from tm-alpha.h, NUM_REGS */
    132  1.1  cherry #define	KGDB_REG_V0	0
    133  1.1  cherry #define	KGDB_REG_T0	1
    134  1.1  cherry #define	KGDB_REG_T1	2
    135  1.1  cherry #define	KGDB_REG_T2	3
    136  1.1  cherry #define	KGDB_REG_T3	4
    137  1.1  cherry #define	KGDB_REG_T4	5
    138  1.1  cherry #define	KGDB_REG_T5	6
    139  1.1  cherry #define	KGDB_REG_T6	7
    140  1.1  cherry #define	KGDB_REG_T7	8
    141  1.1  cherry #define	KGDB_REG_S0	9
    142  1.1  cherry #define	KGDB_REG_S1	10
    143  1.1  cherry #define	KGDB_REG_S2	11
    144  1.1  cherry #define	KGDB_REG_S3	12
    145  1.1  cherry #define	KGDB_REG_S4	13
    146  1.1  cherry #define	KGDB_REG_S5	14
    147  1.1  cherry #define	KGDB_REG_S6	15	/* FP */
    148  1.1  cherry #define	KGDB_REG_A0	16
    149  1.1  cherry #define	KGDB_REG_A1	17
    150  1.1  cherry #define	KGDB_REG_A2	18
    151  1.1  cherry #define	KGDB_REG_A3	19
    152  1.1  cherry #define	KGDB_REG_A4	20
    153  1.1  cherry #define	KGDB_REG_A5	21
    154  1.1  cherry #define	KGDB_REG_T8	22
    155  1.1  cherry #define	KGDB_REG_T9	23
    156  1.1  cherry #define	KGDB_REG_T10	24
    157  1.1  cherry #define	KGDB_REG_T11	25
    158  1.1  cherry #define	KGDB_REG_RA	26
    159  1.1  cherry #define	KGDB_REG_T12	27
    160  1.1  cherry #define	KGDB_REG_AT	28
    161  1.1  cherry #define	KGDB_REG_GP	29
    162  1.1  cherry #define	KGDB_REG_SP	30
    163  1.1  cherry #define	KGDB_REG_ZERO	31
    164  1.1  cherry #define	KGDB_REG_F0	32
    165  1.1  cherry #define	KGDB_REG_F1	33
    166  1.1  cherry #define	KGDB_REG_F2	34
    167  1.1  cherry #define	KGDB_REG_F3	35
    168  1.1  cherry #define	KGDB_REG_F4	36
    169  1.1  cherry #define	KGDB_REG_F5	37
    170  1.1  cherry #define	KGDB_REG_F6	38
    171  1.1  cherry #define	KGDB_REG_F7	39
    172  1.1  cherry #define	KGDB_REG_F8	40
    173  1.1  cherry #define	KGDB_REG_F9	41
    174  1.1  cherry #define	KGDB_REG_F10	42
    175  1.1  cherry #define	KGDB_REG_F11	43
    176  1.1  cherry #define	KGDB_REG_F12	44
    177  1.1  cherry #define	KGDB_REG_F13	45
    178  1.1  cherry #define	KGDB_REG_F14	46
    179  1.1  cherry #define	KGDB_REG_F15	47
    180  1.1  cherry #define	KGDB_REG_F16	48
    181  1.1  cherry #define	KGDB_REG_F17	49
    182  1.1  cherry #define	KGDB_REG_F18	50
    183  1.1  cherry #define	KGDB_REG_F19	51
    184  1.1  cherry #define	KGDB_REG_F20	52
    185  1.1  cherry #define	KGDB_REG_F21	53
    186  1.1  cherry #define	KGDB_REG_F22	54
    187  1.1  cherry #define	KGDB_REG_F23	55
    188  1.1  cherry #define	KGDB_REG_F24	56
    189  1.1  cherry #define	KGDB_REG_F25	57
    190  1.1  cherry #define	KGDB_REG_F26	58
    191  1.1  cherry #define	KGDB_REG_F27	59
    192  1.1  cherry #define	KGDB_REG_F28	60
    193  1.1  cherry #define	KGDB_REG_F29	61
    194  1.1  cherry #define	KGDB_REG_F30	62
    195  1.1  cherry #define	KGDB_REG_F31	63
    196  1.1  cherry #define	KGDB_REG_PC	64
    197  1.1  cherry #define	KGDB_REG_VFP	65
    198  1.1  cherry 
    199  1.1  cherry /* Too much?  Must be large enough for register transfer. */
    200  1.1  cherry #define	KGDB_BUFLEN	1024
    201  1.1  cherry 
    202  1.1  cherry #endif	/* _IA64_DB_MACHDEP_H_ */
    203