Home | History | Annotate | Line # | Download | only in include
      1  1.18   andvar /*	$NetBSD: db_machdep.h,v 1.18 2023/09/02 21:54:55 andvar Exp $	*/
      2   1.1   itojun 
      3   1.1   itojun /*
      4   1.1   itojun  * Mach Operating System
      5   1.1   itojun  * Copyright (c) 1991,1990 Carnegie Mellon University
      6   1.1   itojun  * All Rights Reserved.
      7   1.1   itojun  *
      8   1.1   itojun  * Permission to use, copy, modify and distribute this software and its
      9   1.1   itojun  * documentation is hereby granted, provided that both the copyright
     10   1.1   itojun  * notice and this permission notice appear in all copies of the
     11   1.1   itojun  * software, derivative works or modified versions, and any portions
     12   1.1   itojun  * thereof, and that both notices appear in supporting documentation.
     13   1.1   itojun  *
     14   1.1   itojun  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     15   1.1   itojun  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     16   1.1   itojun  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     17   1.1   itojun  *
     18   1.1   itojun  * Carnegie Mellon requests users of this software to return to
     19   1.1   itojun  *
     20   1.1   itojun  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     21   1.1   itojun  *  School of Computer Science
     22   1.1   itojun  *  Carnegie Mellon University
     23   1.1   itojun  *  Pittsburgh PA 15213-3890
     24   1.1   itojun  *
     25   1.1   itojun  * any improvements or extensions that they make and grant Carnegie Mellon
     26   1.1   itojun  * the rights to redistribute these changes.
     27   1.1   itojun  */
     28   1.1   itojun 
     29   1.1   itojun #ifndef	_SH3_DB_MACHDEP_H_
     30   1.1   itojun #define	_SH3_DB_MACHDEP_H_
     31   1.1   itojun 
     32   1.1   itojun /*
     33   1.1   itojun  * Machine-dependent defines for new kernel debugger.
     34   1.1   itojun  */
     35   1.1   itojun 
     36   1.1   itojun #include <sys/param.h>
     37   1.2      mrg #include <uvm/uvm_extern.h>
     38   1.8      uch #include <sh3/exception.h>
     39  1.15    rmind #include <sh3/pcb.h>
     40   1.1   itojun 
     41   1.3   tsubai typedef	vaddr_t		db_addr_t;	/* address - unsigned */
     42  1.16    joerg #define	DDB_EXPR_FMT	"l"		/* expression is long */
     43   1.1   itojun typedef	long		db_expr_t;	/* expression - signed */
     44   1.1   itojun 
     45   1.1   itojun typedef struct trapframe db_regs_t;
     46  1.10      uwe extern db_regs_t	ddb_regs;	/* register state */
     47   1.1   itojun #define	DDB_REGS	(&ddb_regs)
     48   1.1   itojun 
     49  1.18   andvar #define	PC_REGS(regs)	((regs)->tf_spc)
     50  1.12    skrll #define PC_ADVANCE(regs) ((regs)->tf_spc += BKPT_SIZE)
     51   1.1   itojun 
     52   1.9      scw #define	BKPT_ADDR(addr)	(addr)		/* breakpoint address */
     53   1.1   itojun #define	BKPT_INST	0xc3c3		/* breakpoint instruction */
     54   1.3   tsubai #define	BKPT_SIZE	2		/* size of breakpoint inst */
     55  1.11   cherry #define	BKPT_SET(inst, addr)	BKPT_INST
     56   1.1   itojun 
     57   1.1   itojun #define	FIXUP_PC_AFTER_BREAK(regs)	((regs)->tf_spc -= BKPT_SIZE)
     58   1.1   itojun 
     59  1.14      uwe #define	IS_BREAKPOINT_TRAP(type, code)	\
     60  1.14      uwe 	((type) == EXPEVT_TRAPA && (code) == _SH_TRA_BREAK)
     61  1.14      uwe #define	IS_WATCHPOINT_TRAP(type, code)	(false)
     62   1.1   itojun 
     63   1.7      uch #define	inst_load(ins)		0
     64   1.7      uch #define	inst_store(ins)		0
     65   1.1   itojun 
     66   1.1   itojun /* access capability and access macros */
     67   1.1   itojun 
     68   1.7      uch #define	DB_ACCESS_LEVEL		2	/* access any space */
     69   1.7      uch #define	DB_CHECK_ACCESS(addr, size, task)				\
     70   1.1   itojun 	db_check_access(addr, size, task)
     71   1.7      uch #define	DB_PHYS_EQ(task1, addr1, task2, addr2)				\
     72   1.1   itojun 	db_phys_eq(task1, addr1, task2, addr2)
     73   1.7      uch #define	DB_VALID_KERN_ADDR(addr)					\
     74   1.6      uch 	((addr) >= VM_MIN_KERNEL_ADDRESS &&				\
     75   1.1   itojun 	 (addr) < VM_MAX_KERNEL_ADDRESS)
     76   1.7      uch #define	DB_VALID_ADDRESS(addr, user)					\
     77   1.6      uch 	((!(user) && DB_VALID_KERN_ADDR(addr)) ||			\
     78   1.1   itojun 	 ((user) && (addr) < VM_MAX_ADDRESS))
     79   1.1   itojun 
     80   1.1   itojun /* macros for printing OS server dependent task name */
     81   1.1   itojun 
     82   1.7      uch #define	DB_TASK_NAME(task)	db_task_name(task)
     83   1.7      uch #define	DB_TASK_NAME_TITLE	"COMMAND                "
     84   1.7      uch #define	DB_TASK_NAME_LEN	23
     85   1.7      uch #define	DB_NULL_TASK_NAME	"?                      "
     86   1.1   itojun 
     87   1.1   itojun /*
     88   1.1   itojun  * Constants for KGDB.
     89   1.1   itojun  */
     90   1.5      uch typedef	long	kgdb_reg_t;
     91   1.5      uch #define	KGDB_NUMREGS	59
     92   1.5      uch #define	KGDB_BUFLEN	1024
     93   1.1   itojun 
     94   1.1   itojun /* macro for checking if a thread has used floating-point */
     95   1.7      uch #define	db_thread_fp_used(thread)	((thread)->pcb->ims.ifps != 0)
     96   1.1   itojun 
     97   1.3   tsubai int kdb_trap(int, int, db_regs_t *);
     98  1.13  thorpej bool inst_call(int);
     99  1.13  thorpej bool inst_return(int);
    100  1.13  thorpej bool inst_trap_return(int);
    101   1.1   itojun 
    102   1.1   itojun /*
    103   1.1   itojun  * We use ELF symbols in DDB.
    104   1.1   itojun  *
    105   1.1   itojun  */
    106   1.1   itojun #define	DB_ELF_SYMBOLS
    107   1.4      uch 
    108   1.4      uch /*
    109   1.4      uch  * We have machine-dependent commands.
    110   1.4      uch  */
    111   1.7      uch #define	DB_MACHINE_COMMANDS
    112   1.5      uch 
    113   1.5      uch extern const char kgdb_devname[];
    114   1.1   itojun 
    115   1.6      uch #endif	/* !_SH3_DB_MACHDEP_H_ */
    116