Home | History | Annotate | Line # | Download | only in include
db_machdep.h revision 1.1
      1 /*
      2  * Mach Operating System
      3  * Copyright (c) 1992 Carnegie Mellon University
      4  * All Rights Reserved.
      5  *
      6  * Permission to use, copy, modify and distribute this software and its
      7  * documentation is hereby granted, provided that both the copyright
      8  * notice and this permission notice appear in all copies of the
      9  * software, derivative works or modified versions, and any portions
     10  * thereof, and that both notices appear in supporting documentation.
     11  *
     12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     15  *
     16  * Carnegie Mellon requests users of this software to return to
     17  *
     18  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     19  *  School of Computer Science
     20  *  Carnegie Mellon University
     21  *  Pittsburgh PA 15213-3890
     22  *
     23  * any improvements or extensions that they make and grant Carnegie Mellon
     24  * the rights to redistribute these changes.
     25  */
     26 /*
     27  * HISTORY
     28  * $Log: db_machdep.h,v $
     29  * Revision 1.1  1993/08/08 12:18:27  glass
     30  * various changes
     31  *
     32  * Revision 2.5  91/07/31  18:12:56  dbg
     33  * 	Changed register save area name.
     34  * 	[91/07/12            dbg]
     35  *
     36  * Revision 2.4  91/01/08  15:52:19  rpd
     37  * 	Added dummy inst_load/inst_store macros.
     38  * 	[91/01/06            rpd]
     39  *
     40  * Revision 2.3  90/10/25  14:47:23  rwd
     41  * 	Added watchpoint support.
     42  * 	[90/10/16            rwd]
     43  *
     44  * Revision 2.2  90/08/27  22:11:31  dbg
     45  * 	Created.
     46  * 	[90/07/25            dbg]
     47  *
     48  */
     49 
     50 /*
     51  * Machine-dependent defines for new kernel debugger.
     52  */
     53 #ifndef	_SUN3_DB_MACHDEP_H_
     54 #define	_SUN3_DB_MACHDEP_H_
     55 
     56 /*#include <mach/sun3/vm_types.h>*/
     57 /*#include <mach/sun3/vm_param.h>*/
     58 /*#include <sun3/thread.h>*/		/* for thread_status */
     59 #include <vm/queue.h>
     60 #include <vm/vm_prot.h>
     61 #include <vm/vm_param.h>
     62 #include <vm/vm_inherit.h>
     63 #include <vm/lock.h>
     64 #include <machine/psl.h>
     65 #include <machine/trap.h>
     66 
     67 
     68 typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
     69 typedef	int		db_expr_t;	/* expression - signed */
     70 struct mc68020_saved_state {
     71         int             d0;             /* data registers */
     72         int             d1;
     73         int             d2;
     74         int             d3;
     75         int             d4;
     76         int             d5;
     77         int             d6;
     78         int             d7;
     79         int             a0;             /* address registers */
     80         int             a1;
     81         int             a2;
     82         int             a3;
     83         int             a4;
     84         int             a5;
     85         int             a6;
     86         int             sp;             /* stack pointer */
     87         unsigned short  sr;             /* status register */
     88         unsigned int    pc;             /* program counter - UNALIGNED!!! */
     89         unsigned int    stkfmt  : 4;    /* rte stack frame format */
     90         unsigned int    vector  : 12;   /* vector number */
     91 };
     92 typedef struct mc68020_saved_state db_regs_t;
     93 db_regs_t	ddb_regs;		/* register state */
     94 #define DDB_REGS	(&ddb_regs)
     95 
     96 #define	PC_REGS(regs)	((db_addr_t)(regs)->pc)
     97 
     98 #define	BKPT_INST	0x4e4f		/* breakpoint instruction */
     99 #define	BKPT_SIZE	(2)		/* size of breakpoint inst */
    100 #define	BKPT_SET(inst)	(BKPT_INST)
    101 
    102 #define	FIXUP_PC_AFTER_BREAK	ddb_regs.pc -= 2;
    103 
    104 #define	db_clear_single_step(regs)	((regs)->sr &= ~SR_T1)
    105 #define	db_set_single_step(regs)	((regs)->sr |=  SR_T1)
    106 
    107 #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BRKPT)
    108 #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT)
    109 
    110 #define	M_RTS		0xffff0000
    111 #define I_RTS		0x4e750000
    112 #define M_JSR		0xffc00000
    113 #define I_JSR		0x4e800000
    114 #define M_BSR		0xff000000
    115 #define I_BSR		0x61000000
    116 #define	M_RTE		0xffff0000
    117 #define	I_RTE		0x4e730000
    118 
    119 #define	inst_trap_return(ins)	(((ins)&M_RTE) == I_RTE)
    120 #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS)
    121 #define	inst_call(ins)		(((ins)&M_JSR) == I_JSR || \
    122 				 ((ins)&M_BSR) == I_BSR)
    123 #define inst_load(ins)		0
    124 #define inst_store(ins)		0
    125 
    126 #endif	/* _SUN3_DDB_MACHDEP_H_ */
    127