xref: /openbsd/sys/arch/sh/include/db_machdep.h (revision 42cc9952)
1*42cc9952Sjasper /*	$OpenBSD: db_machdep.h,v 1.11 2021/08/30 08:11:12 jasper Exp $	*/
295c7671fSmiod /*	$NetBSD: db_machdep.h,v 1.12 2006/05/10 06:24:03 skrll Exp $	*/
395c7671fSmiod 
495c7671fSmiod /*
595c7671fSmiod  * Mach Operating System
695c7671fSmiod  * Copyright (c) 1991,1990 Carnegie Mellon University
795c7671fSmiod  * All Rights Reserved.
895c7671fSmiod  *
995c7671fSmiod  * Permission to use, copy, modify and distribute this software and its
1095c7671fSmiod  * documentation is hereby granted, provided that both the copyright
1195c7671fSmiod  * notice and this permission notice appear in all copies of the
1295c7671fSmiod  * software, derivative works or modified versions, and any portions
1395c7671fSmiod  * thereof, and that both notices appear in supporting documentation.
1495c7671fSmiod  *
1595c7671fSmiod  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1695c7671fSmiod  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
1795c7671fSmiod  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1895c7671fSmiod  *
1995c7671fSmiod  * Carnegie Mellon requests users of this software to return to
2095c7671fSmiod  *
2195c7671fSmiod  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
2295c7671fSmiod  *  School of Computer Science
2395c7671fSmiod  *  Carnegie Mellon University
2495c7671fSmiod  *  Pittsburgh PA 15213-3890
2595c7671fSmiod  *
2695c7671fSmiod  * any improvements or extensions that they make and grant Carnegie Mellon
2795c7671fSmiod  * the rights to redistribute these changes.
2895c7671fSmiod  */
2995c7671fSmiod 
3095c7671fSmiod #ifndef	_SH_DB_MACHDEP_H_
3195c7671fSmiod #define	_SH_DB_MACHDEP_H_
3295c7671fSmiod 
3395c7671fSmiod /*
3495c7671fSmiod  * Machine-dependent defines for the kernel debugger.
3595c7671fSmiod  */
3695c7671fSmiod 
3795c7671fSmiod #include <sys/param.h>
3895c7671fSmiod #include <uvm/uvm_extern.h>
3995c7671fSmiod #include <sh/trap.h>
4095c7671fSmiod 
4195c7671fSmiod typedef	long		db_expr_t;	/* expression - signed */
4295c7671fSmiod 
4395c7671fSmiod typedef struct trapframe db_regs_t;
4495c7671fSmiod extern db_regs_t	ddb_regs;	/* register state */
4595c7671fSmiod 
4652de38dfSmpi #define	PC_REGS(regs)	((vaddr_t)(regs)->tf_spc)
4795c7671fSmiod #define PC_ADVANCE(regs) ((regs)->tf_spc += BKPT_SIZE)
4895c7671fSmiod 
4995c7671fSmiod #define	BKPT_INST	0xc3c3		/* breakpoint instruction */
5095c7671fSmiod #define	BKPT_SIZE	2		/* size of breakpoint inst */
5195c7671fSmiod #define	BKPT_SET(inst)	BKPT_INST
5295c7671fSmiod 
5395c7671fSmiod #define	FIXUP_PC_AFTER_BREAK(regs)	((regs)->tf_spc -= BKPT_SIZE)
5495c7671fSmiod 
55c9644400Smickey #define	IS_BREAKPOINT_TRAP(type, code)	((type) == EXPEVT_TRAPA)
5695c7671fSmiod #define	IS_WATCHPOINT_TRAP(type, code)	(0) /* XXX (msaitoh) */
5795c7671fSmiod 
58a1a7d5d9Smpi int db_ktrap(int, int, db_regs_t *);
59f99a70a5Smickey void db_machine_init (void);
601d47df55Smpi int inst_call(int);
611d47df55Smpi int inst_return(int);
621d47df55Smpi int inst_trap_return(int);
6395c7671fSmiod 
6495c7671fSmiod /*
6595c7671fSmiod  * We have machine-dependent commands.
6695c7671fSmiod  */
6795c7671fSmiod #define	DB_MACHINE_COMMANDS
6895c7671fSmiod 
6995c7671fSmiod #endif	/* !_SH_DB_MACHDEP_H_ */
70