Home | History | Annotate | Line # | Download | only in include
db_machdep.h revision 1.2
      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.2  1993/08/10 08:42:37  glass
     30  * fixed problem that caused two consecutive segments to be using the same
     31  * pmeg unknowingly.  still too many printfs, not sure how many are actualy
     32  * in the machine dependent code.  reaches cpu_startup() where it stops
     33  * deliberately. next project: autoconfig(), maybe kgdb
     34  *
     35  * Revision 1.1  93/08/08  12:18:27  glass
     36  * various changes
     37  *
     38  * Revision 2.5  91/07/31  18:12:56  dbg
     39  * 	Changed register save area name.
     40  * 	[91/07/12            dbg]
     41  *
     42  * Revision 2.4  91/01/08  15:52:19  rpd
     43  * 	Added dummy inst_load/inst_store macros.
     44  * 	[91/01/06            rpd]
     45  *
     46  * Revision 2.3  90/10/25  14:47:23  rwd
     47  * 	Added watchpoint support.
     48  * 	[90/10/16            rwd]
     49  *
     50  * Revision 2.2  90/08/27  22:11:31  dbg
     51  * 	Created.
     52  * 	[90/07/25            dbg]
     53  *
     54  */
     55 
     56 /*
     57  * Machine-dependent defines for new kernel debugger.
     58  */
     59 #ifndef	_SUN3_DB_MACHDEP_H_
     60 #define	_SUN3_DB_MACHDEP_H_
     61 
     62 /*#include <mach/sun3/vm_types.h>*/
     63 /*#include <mach/sun3/vm_param.h>*/
     64 /*#include <sun3/thread.h>*/		/* for thread_status */
     65 #include <vm/queue.h>
     66 #include <vm/vm_prot.h>
     67 #include <vm/vm_param.h>
     68 #include <vm/vm_inherit.h>
     69 #include <vm/lock.h>
     70 #include <machine/psl.h>
     71 #include <machine/trap.h>
     72 
     73 
     74 typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
     75 typedef	int		db_expr_t;	/* expression - signed */
     76 struct mc68020_saved_state {
     77         int             d0;             /* data registers */
     78         int             d1;
     79         int             d2;
     80         int             d3;
     81         int             d4;
     82         int             d5;
     83         int             d6;
     84         int             d7;
     85         int             a0;             /* address registers */
     86         int             a1;
     87         int             a2;
     88         int             a3;
     89         int             a4;
     90         int             a5;
     91         int             a6;
     92         int             sp;             /* stack pointer */
     93         unsigned short  sr;             /* status register */
     94         unsigned int    pc;             /* program counter - UNALIGNED!!! */
     95         unsigned int    stkfmt  : 4;    /* rte stack frame format */
     96         unsigned int    vector  : 12;   /* vector number */
     97 };
     98 typedef struct mc68020_saved_state db_regs_t;
     99 db_regs_t	ddb_regs;		/* register state */
    100 #define DDB_REGS	(&ddb_regs)
    101 
    102 #define	PC_REGS(regs)	((db_addr_t)(regs)->pc)
    103 
    104 #define	BKPT_INST	0x4e4f		/* breakpoint instruction */
    105 #define	BKPT_SIZE	(2)		/* size of breakpoint inst */
    106 #define	BKPT_SET(inst)	(BKPT_INST)
    107 
    108 #define	FIXUP_PC_AFTER_BREAK	ddb_regs.pc -= 2;
    109 
    110 #define SR_T1 0x8000
    111 #define	db_clear_single_step(regs)	((regs)->sr &= ~SR_T1)
    112 #define	db_set_single_step(regs)	((regs)->sr |=  SR_T1)
    113 
    114 #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BRKPT)
    115 #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT)
    116 
    117 #define	M_RTS		0xffff0000
    118 #define I_RTS		0x4e750000
    119 #define M_JSR		0xffc00000
    120 #define I_JSR		0x4e800000
    121 #define M_BSR		0xff000000
    122 #define I_BSR		0x61000000
    123 #define	M_RTE		0xffff0000
    124 #define	I_RTE		0x4e730000
    125 
    126 #define	inst_trap_return(ins)	(((ins)&M_RTE) == I_RTE)
    127 #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS)
    128 #define	inst_call(ins)		(((ins)&M_JSR) == I_JSR || \
    129 				 ((ins)&M_BSR) == I_BSR)
    130 #define inst_load(ins)		0
    131 #define inst_store(ins)		0
    132 
    133 #endif	/* _SUN3_DDB_MACHDEP_H_ */
    134