From 913f0b045e4f79c633f5c530ba83e5126d7db5b8 Mon Sep 17 00:00:00 2001 From: ragge Date: Fri, 16 Jun 1995 15:17:27 +0000 Subject: [PATCH] DDB support. splddb() and trapcode for ddb. --- sys/arch/vax/include/db_machdep.h | 73 +++++++++++++++++++++++++++++++ sys/arch/vax/include/param.h | 3 +- sys/arch/vax/include/trap.h | 6 +-- 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 sys/arch/vax/include/db_machdep.h diff --git a/sys/arch/vax/include/db_machdep.h b/sys/arch/vax/include/db_machdep.h new file mode 100644 index 000000000000..b2a9fd686423 --- /dev/null +++ b/sys/arch/vax/include/db_machdep.h @@ -0,0 +1,73 @@ +/* $NetBSD: db_machdep.h,v 1.1 1995/06/16 15:17:27 ragge Exp $ */ + +/* + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +#ifndef _VAX_DB_MACHDEP_H_ +#define _VAX_DB_MACHDEP_H_ + +/* + * Machine-dependent defines for new kernel debugger. + * Modified for vax out of i386 code. + */ + +#include +#include +#include + +typedef vm_offset_t db_addr_t; /* address - unsigned */ +typedef int db_expr_t; /* expression - signed */ + +typedef struct trapframe db_regs_t; +db_regs_t ddb_regs; /* register state */ +#define DDB_REGS (&ddb_regs) + +#define PC_REGS(regs) ((db_addr_t)(regs)->pc) + +#define BKPT_INST 0x03 /* breakpoint instruction */ +#define BKPT_SIZE (1) /* size of breakpoint inst */ +#define BKPT_SET(inst) (BKPT_INST) + +#define FIXUP_PC_AFTER_BREAK ddb_regs.pc -= BKPT_SIZE; + +#define db_clear_single_step(regs) ((regs)->psl &= ~PSL_T) +#define db_set_single_step(regs) ((regs)->psl |= PSL_T) + +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) +#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_TRCTRAP) + +#define I_CALL 0xfb +#define I_RET 0x04 +#define I_IRET 0x02 + +#define inst_trap_return(ins) (((ins)&0xff) == I_IRET) +#define inst_return(ins) (((ins)&0xff) == I_RET) +#define inst_call(ins) (((ins)&0xff) == I_CALL) + +#define inst_load(ins) 0 +#define inst_store(ins) 0 + +#endif /* _VAX_DB_MACHDEP_H_ */ diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h index 752ce4ce2f2b..e643dfc0921a 100644 --- a/sys/arch/vax/include/param.h +++ b/sys/arch/vax/include/param.h @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.8 1995/05/03 19:53:46 ragge Exp $ */ +/* $NetBSD: param.h,v 1.9 1995/06/16 15:17:33 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -184,6 +184,7 @@ #define spl0() splx(0) /* IPL0 */ #define splsoftclock() splx(8) /* IPL08 */ #define splnet() splx(0xc) /* IPL0C */ +#define splddb() splx(0xf) /* IPL0F */ #define spl4() splx(0x14) /* IPL14 */ #define spltty() splx(0x15) /* IPL15 */ #define splbio() splx(0x15) /* IPL15 */ diff --git a/sys/arch/vax/include/trap.h b/sys/arch/vax/include/trap.h index 7f01984584f8..b1cafc137852 100644 --- a/sys/arch/vax/include/trap.h +++ b/sys/arch/vax/include/trap.h @@ -1,4 +1,4 @@ -/* $NetBSD: trap.h,v 1.7 1995/06/05 17:18:00 ragge Exp $ */ +/* $NetBSD: trap.h,v 1.8 1995/06/16 15:17:40 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -59,9 +59,9 @@ #define T_ACCFLT 12 /* Access violation fault */ /* #define T_TABLEFLT 13 /* page table fault */ /* #define T_ALIGNFLT 14 /* alignment fault */ -/* #define T_KSPNOTVAL 15 /* kernel stack pointer not valid */ +#define T_KSPNOTVAL 15 /* kernel stack pointer not valid */ /* #define T_BUSERR 16 /* bus error */ -/* #define T_KDBTRAP 17 /* kernel debugger trap */ +#define T_KDBTRAP 17 /* kernel debugger trap */ /* #define T_DIVIDE 18 /* integer divide fault */ /* #define T_NMI 19 /* non-maskable trap */