Home | History | Annotate | Line # | Download | only in include
      1  1.35   tsutsui /*	$NetBSD: db_machdep.h,v 1.35 2023/09/26 14:33:55 tsutsui Exp $	*/
      2  1.12       cgd 
      3  1.34   tsutsui /*
      4   1.1     glass  * Mach Operating System
      5   1.1     glass  * Copyright (c) 1992 Carnegie Mellon University
      6   1.1     glass  * All Rights Reserved.
      7  1.34   tsutsui  *
      8   1.1     glass  * Permission to use, copy, modify and distribute this software and its
      9   1.1     glass  * documentation is hereby granted, provided that both the copyright
     10   1.1     glass  * notice and this permission notice appear in all copies of the
     11   1.1     glass  * software, derivative works or modified versions, and any portions
     12   1.1     glass  * thereof, and that both notices appear in supporting documentation.
     13  1.34   tsutsui  *
     14   1.1     glass  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15   1.1     glass  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     16   1.1     glass  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17  1.34   tsutsui  *
     18   1.1     glass  * Carnegie Mellon requests users of this software to return to
     19  1.34   tsutsui  *
     20   1.1     glass  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21   1.1     glass  *  School of Computer Science
     22   1.1     glass  *  Carnegie Mellon University
     23   1.1     glass  *  Pittsburgh PA 15213-3890
     24  1.34   tsutsui  *
     25  1.34   tsutsui  * any improvements or extensions that they make and grant Carnegie Mellon
     26   1.1     glass  * the rights to redistribute these changes.
     27   1.1     glass  */
     28   1.1     glass 
     29   1.1     glass /*
     30   1.1     glass  * Machine-dependent defines for new kernel debugger.
     31   1.1     glass  */
     32   1.3       cgd #ifndef	_M68K_DB_MACHDEP_H_
     33   1.3       cgd #define	_M68K_DB_MACHDEP_H_
     34   1.1     glass 
     35  1.31   mlelstv #if !defined(_KERNEL) && !defined(_STANDALONE)
     36  1.31   mlelstv #include <stddef.h>
     37  1.31   mlelstv #include <stdbool.h>
     38  1.31   mlelstv #include <string.h>
     39  1.31   mlelstv #endif /* _KERNEL || _STANDALONE */
     40  1.31   mlelstv 
     41  1.19       gwr #include <sys/types.h>
     42  1.19       gwr 
     43  1.32  christos #include <uvm/uvm_extern.h>
     44  1.15       gwr 
     45  1.15       gwr #include <machine/frame.h>
     46  1.28     rmind #include <machine/pcb.h>
     47   1.1     glass #include <machine/psl.h>
     48   1.1     glass #include <machine/trap.h>
     49   1.1     glass 
     50  1.21       leo typedef	vaddr_t		db_addr_t;	/* address - unsigned */
     51  1.30     joerg #define	DDB_EXPR_FMT	"l"		/* expression is long */
     52  1.16    scottr typedef	long		db_expr_t;	/* expression - signed */
     53  1.15       gwr typedef struct trapframe db_regs_t;
     54  1.15       gwr 
     55  1.19       gwr extern db_regs_t	ddb_regs;	/* register state */
     56   1.1     glass #define DDB_REGS	(&ddb_regs)
     57   1.1     glass 
     58  1.23  kristerw #define	PC_REGS(regs)	((regs)->tf_pc)
     59   1.1     glass 
     60  1.24       scw #define	BKPT_ADDR(addr)	(addr)		/* breakpoint address */
     61   1.1     glass #define	BKPT_INST	0x4e4f		/* breakpoint instruction */
     62   1.1     glass #define	BKPT_SIZE	(2)		/* size of breakpoint inst */
     63  1.27    cherry #define	BKPT_SET(inst, addr)	(BKPT_INST)
     64   1.1     glass 
     65  1.17       gwr #define	FIXUP_PC_AFTER_BREAK(regs)	((regs)->tf_pc -= BKPT_SIZE)
     66   1.1     glass 
     67  1.19       gwr #define	db_clear_single_step(regs)	((regs)->tf_sr &= ~PSL_T)
     68  1.19       gwr #define	db_set_single_step(regs)	((regs)->tf_sr |=  PSL_T)
     69   1.1     glass 
     70   1.4   mycroft #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BREAKPOINT)
     71   1.5   mycroft #ifdef T_WATCHPOINT
     72   1.1     glass #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT)
     73   1.5   mycroft #else
     74   1.5   mycroft #define	IS_WATCHPOINT_TRAP(type, code)	0
     75   1.5   mycroft #endif
     76   1.1     glass 
     77   1.1     glass #define	M_RTS		0xffff0000
     78   1.1     glass #define I_RTS		0x4e750000
     79   1.1     glass #define M_JSR		0xffc00000
     80   1.1     glass #define I_JSR		0x4e800000
     81   1.1     glass #define M_BSR		0xff000000
     82   1.1     glass #define I_BSR		0x61000000
     83   1.1     glass #define	M_RTE		0xffff0000
     84   1.1     glass #define	I_RTE		0x4e730000
     85   1.1     glass 
     86   1.1     glass #define	inst_trap_return(ins)	(((ins)&M_RTE) == I_RTE)
     87   1.1     glass #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS)
     88   1.1     glass #define	inst_call(ins)		(((ins)&M_JSR) == I_JSR || \
     89   1.1     glass 				 ((ins)&M_BSR) == I_BSR)
     90   1.1     glass #define inst_load(ins)		0
     91   1.1     glass #define inst_store(ins)		0
     92  1.13       leo 
     93  1.18       gwr /*
     94  1.18       gwr  * Things needed by kgdb:
     95  1.18       gwr  */
     96  1.18       gwr typedef long kgdb_reg_t;
     97  1.18       gwr #define KGDB_NUMREGS	(16+2)
     98  1.18       gwr #define KGDB_BUFLEN	512
     99  1.18       gwr 
    100  1.18       gwr 
    101  1.13       leo #ifdef _KERNEL
    102  1.13       leo 
    103  1.25   thorpej void	Debugger(void);		/* XXX */
    104  1.25   thorpej void	kdb_kintr(db_regs_t *);
    105  1.35   tsutsui int	kdb_trap(int, db_regs_t *);
    106  1.13       leo 
    107  1.13       leo #endif /* _KERNEL */
    108  1.20   thorpej 
    109  1.20   thorpej /*
    110  1.29       mrg  * We use Elf32 symbols in DDB.
    111  1.20   thorpej  */
    112  1.25   thorpej #define	DB_ELF_SYMBOLS
    113   1.1     glass 
    114   1.7   mycroft #endif	/* _M68K_DB_MACHDEP_H_ */
    115