1 /* $OpenBSD: db_machdep.h,v 1.20 2021/08/30 08:11:12 jasper Exp $ */ 2 /* 3 * Mach Operating System 4 * Copyright (c) 1993-1991 Carnegie Mellon University 5 * Copyright (c) 1991 OMRON Corporation 6 * All Rights Reserved. 7 * 8 * Permission to use, copy, modify and distribute this software and its 9 * documentation is hereby granted, provided that both the copyright 10 * notice and this permission notice appear in all copies of the 11 * software, derivative works or modified versions, and any portions 12 * thereof, and that both notices appear in supporting documentation. 13 * 14 * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND 16 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 * 18 * Carnegie Mellon requests users of this software to return to 19 * 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * School of Computer Science 22 * Carnegie Mellon University 23 * Pittsburgh PA 15213-3890 24 * 25 * any improvements or extensions that they make and grant Carnegie the 26 * rights to redistribute these changes. 27 */ 28 29 #ifndef _M88K_DB_MACHDEP_H_ 30 #define _M88K_DB_MACHDEP_H_ 31 32 /* trap numbers used by ddb */ 33 #define DDB_ENTRY_BKPT_NO 130 34 #define DDB_ENTRY_TRACE_NO 131 35 #define DDB_ENTRY_TRAP_NO 132 36 37 #ifndef _LOCORE 38 39 #include <machine/reg.h> 40 #include <machine/trap.h> 41 42 #include <uvm/uvm_param.h> 43 44 #define SET_PC_REGS(regs, value) \ 45 do { \ 46 (regs)->sxip = (value); \ 47 (regs)->snip = (value) + 4; \ 48 } while (0) 49 50 #ifdef DDB 51 52 #define BKPT_SIZE (4) /* number of bytes in bkpt inst. */ 53 #define BKPT_INST (0xf000d000 | DDB_ENTRY_BKPT_NO) /* tb0, 0,r0, 130 */ 54 #define BKPT_SET(inst) (BKPT_INST) 55 56 /* Entry trap for the debugger - used for inline assembly breaks*/ 57 #define ENTRY_ASM "tb0 0, %r0, 132" 58 59 typedef long db_expr_t; 60 typedef struct reg db_regs_t; 61 extern db_regs_t ddb_regs; /* register state */ 62 63 int ddb_break_trap(int, db_regs_t *); 64 int ddb_entry_trap(int, db_regs_t *); 65 void m88k_print_instruction(int, u_int, u_int32_t); /* db_disasm.c */ 66 67 /* 68 * inst_call(ins) - is the instruction a function call. 69 * Could be either bsr or jsr. 70 */ 71 #define inst_call(I) \ 72 (((I) & 0xf8000000) == 0xc8000000 /* bsr */ || \ 73 ((I) & 0xfffffbe0) == 0xf400c800 /* jsr */) 74 /* 75 * inst_return(ins) - is the instruction a function call return. 76 * Not mutually exclusive with inst_branch. Should be a jmp r1. 77 */ 78 #define inst_return(I) (((I) & 0xfffffbff) == 0xf400c001) 79 80 /* 81 * inst_trap_return(ins) - is the instruction a return from trap. 82 * Should be a rte. 83 */ 84 #define inst_trap_return(I) ((I) == 0xf400c000) 85 86 /* breakpoint/watchpoint foo */ 87 #define IS_BREAKPOINT_TRAP(type,code) ((type)==T_KDB_BREAK) 88 #define IS_WATCHPOINT_TRAP(type,code) 0 89 90 /* machine specific commands have been added to ddb */ 91 #define DB_MACHINE_COMMANDS 92 93 #ifdef MULTIPROCESSOR 94 extern cpuid_t ddb_mp_nextcpu; 95 #endif 96 97 #endif /* DDB */ 98 #endif /* _LOCORE */ 99 100 #endif /* _M88K_DB_MACHDEP_H_ */ 101