Home | History | Annotate | Line # | Download | only in include
db_machdep.h revision 1.1
      1 /*	$OpenBSD: db_machdep.h,v 1.2 1997/03/21 00:48:48 niklas Exp $	*/
      2 /*	$NetBSD: db_machdep.h,v 1.1 1997/10/14 06:48:14 sakamoto Exp $	*/
      3 
      4 /*
      5  * Mach Operating System
      6  * Copyright (c) 1992 Carnegie Mellon University
      7  * All Rights Reserved.
      8  *
      9  * Permission to use, copy, modify and distribute this software and its
     10  * documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     17  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie Mellon
     27  * the rights to redistribute these changes.
     28  */
     29 
     30 /*
     31  * Machine-dependent defines for new kernel debugger.
     32  */
     33 #ifndef	_PPC_DB_MACHDEP_H_
     34 #define	_PPC_DB_MACHDEP_H_
     35 
     36 #include <vm/vm_prot.h>
     37 #include <vm/vm_param.h>
     38 #include <vm/vm_inherit.h>
     39 #include <machine/trap.h>
     40 
     41 #define	DB_ELF_SYMBOLS
     42 #define	DB_ELFSIZE	32
     43 
     44 typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
     45 typedef	int		db_expr_t;	/* expression - signed */
     46 struct powerpc_saved_state {
     47 	u_int32_t	r0;		/* data registers */
     48 	u_int32_t	r1;
     49 	u_int32_t	r2;
     50 	u_int32_t	r3;
     51 	u_int32_t	r4;
     52 	u_int32_t	r5;
     53 	u_int32_t	r6;
     54 	u_int32_t	r7;
     55 	u_int32_t	r8;
     56 	u_int32_t	r9;
     57 	u_int32_t	r10;
     58 	u_int32_t	r11;
     59 	u_int32_t	r12;
     60 	u_int32_t	r13;
     61 	u_int32_t	r14;
     62 	u_int32_t	r15;
     63 	u_int32_t	r16;
     64 	u_int32_t	r17;
     65 	u_int32_t	r18;
     66 	u_int32_t	r19;
     67 	u_int32_t	r20;
     68 	u_int32_t	r21;
     69 	u_int32_t	r22;
     70 	u_int32_t	r23;
     71 	u_int32_t	r24;
     72 	u_int32_t	r25;
     73 	u_int32_t	r26;
     74 	u_int32_t	r27;
     75 	u_int32_t	r28;
     76 	u_int32_t	r29;
     77 	u_int32_t	r30;
     78 	u_int32_t	r31;
     79 	u_int32_t	r32;
     80 	u_int32_t	iar;
     81 	u_int32_t	msr;
     82 };
     83 typedef struct powerpc_saved_state db_regs_t;
     84 db_regs_t	ddb_regs;		/* register state */
     85 #define DDB_REGS	(&ddb_regs)
     86 
     87 #define	PC_REGS(regs)	((db_addr_t)(regs)->iar)
     88 
     89 #define	BKPT_INST	0x7C810808	/* breakpoint instruction */
     90 
     91 #define	BKPT_SIZE	(4)		/* size of breakpoint inst */
     92 #define	BKPT_SET(inst)	(BKPT_INST)
     93 
     94 #define	FIXUP_PC_AFTER_BREAK(regs)	((regs)->iar -= 4)
     95 
     96 #define SR_SINGLESTEP	0x400
     97 #define	db_clear_single_step(regs)	((regs)->msr &= ~SR_SINGLESTEP)
     98 #define	db_set_single_step(regs)	((regs)->msr |=  SR_SINGLESTEP)
     99 
    100 #define T_BREAKPOINT	0xffff
    101 #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BREAKPOINT)
    102 
    103 #define T_WATCHPOINT	0xeeee
    104 #ifdef T_WATCHPOINT
    105 #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT)
    106 #else
    107 #define	IS_WATCHPOINT_TRAP(type, code)	0
    108 #endif
    109 
    110 #define	M_RTS		0xfc0007fe
    111 #define I_RTS		0x4c000020
    112 #define M_BC		0xfc000000
    113 #define I_BC		0x40000000
    114 #define M_B		0xfc000000
    115 #define I_B		0x50000000
    116 #define	M_RFI		0xfc0007fe
    117 #define	I_RFI		0x4c000064
    118 
    119 #define	inst_trap_return(ins)	(((ins)&M_RFI) == I_RFI)
    120 #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS)
    121 #define	inst_call(ins)		(((ins)&M_BC ) == I_BC  || \
    122 				 ((ins)&M_B  ) == I_B )
    123 #define inst_load(ins)		0
    124 #define inst_store(ins)		0
    125 
    126 #ifdef _KERNEL
    127 
    128 void	kdb_kintr __P((void *));
    129 int	kdb_trap __P((int, void *));
    130 
    131 #endif /* _KERNEL */
    132 
    133 #endif	/* _PPC_DB_MACHDEP_H_ */
    134