15b81b6b3SRodney W. Grimes /* 25b81b6b3SRodney W. Grimes * Mach Operating System 35b81b6b3SRodney W. Grimes * Copyright (c) 1991,1990 Carnegie Mellon University 45b81b6b3SRodney W. Grimes * All Rights Reserved. 55b81b6b3SRodney W. Grimes * 65b81b6b3SRodney W. Grimes * Permission to use, copy, modify and distribute this software and its 75b81b6b3SRodney W. Grimes * documentation is hereby granted, provided that both the copyright 85b81b6b3SRodney W. Grimes * notice and this permission notice appear in all copies of the 95b81b6b3SRodney W. Grimes * software, derivative works or modified versions, and any portions 105b81b6b3SRodney W. Grimes * thereof, and that both notices appear in supporting documentation. 115b81b6b3SRodney W. Grimes * 125b81b6b3SRodney W. Grimes * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 135b81b6b3SRodney W. Grimes * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 145b81b6b3SRodney W. Grimes * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 155b81b6b3SRodney W. Grimes * 165b81b6b3SRodney W. Grimes * Carnegie Mellon requests users of this software to return to 175b81b6b3SRodney W. Grimes * 185b81b6b3SRodney W. Grimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 195b81b6b3SRodney W. Grimes * School of Computer Science 205b81b6b3SRodney W. Grimes * Carnegie Mellon University 215b81b6b3SRodney W. Grimes * Pittsburgh PA 15213-3890 225b81b6b3SRodney W. Grimes * 235b81b6b3SRodney W. Grimes * any improvements or extensions that they make and grant Carnegie Mellon 245b81b6b3SRodney W. Grimes * the rights to redistribute these changes. 255b81b6b3SRodney W. Grimes * 26c3aac50fSPeter Wemm * $FreeBSD$ 275b81b6b3SRodney W. Grimes */ 285b81b6b3SRodney W. Grimes 291e1a3d01SBruce Evans #ifndef _MACHINE_DB_MACHDEP_H_ 301e1a3d01SBruce Evans #define _MACHINE_DB_MACHDEP_H_ 315b81b6b3SRodney W. Grimes 32b667af1dSBruce Evans #include <machine/frame.h> 33576642efSMarcel Moolenaar #include <machine/trap.h> 345b81b6b3SRodney W. Grimes 355b81b6b3SRodney W. Grimes typedef vm_offset_t db_addr_t; /* address - unsigned */ 365b81b6b3SRodney W. Grimes typedef int db_expr_t; /* expression - signed */ 375b81b6b3SRodney W. Grimes 3837224cd3SMarcel Moolenaar #define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_eip) 395b81b6b3SRodney W. Grimes 405b81b6b3SRodney W. Grimes #define BKPT_INST 0xcc /* breakpoint instruction */ 415b81b6b3SRodney W. Grimes #define BKPT_SIZE (1) /* size of breakpoint inst */ 425b81b6b3SRodney W. Grimes #define BKPT_SET(inst) (BKPT_INST) 435b81b6b3SRodney W. Grimes 4437224cd3SMarcel Moolenaar #define BKPT_SKIP kdb_frame->tf_eip += 1 453a0b4f25SDoug Rabson 4637224cd3SMarcel Moolenaar #define FIXUP_PC_AFTER_BREAK kdb_frame->tf_eip -= 1; 475b81b6b3SRodney W. Grimes 4837224cd3SMarcel Moolenaar #define db_clear_single_step kdb_cpu_clear_singlestep 4937224cd3SMarcel Moolenaar #define db_set_single_step kdb_cpu_set_singlestep 505b81b6b3SRodney W. Grimes 515b81b6b3SRodney W. Grimes #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPTFLT) 521e1a3d01SBruce Evans /* 531e1a3d01SBruce Evans * Watchpoints are not supported. The debug exception type is in %dr6 541e1a3d01SBruce Evans * and not yet in the args to this macro. 551e1a3d01SBruce Evans */ 561e1a3d01SBruce Evans #define IS_WATCHPOINT_TRAP(type, code) 0 575b81b6b3SRodney W. Grimes 585b81b6b3SRodney W. Grimes #define I_CALL 0xe8 595b81b6b3SRodney W. Grimes #define I_CALLI 0xff 605b81b6b3SRodney W. Grimes #define I_RET 0xc3 615b81b6b3SRodney W. Grimes #define I_IRET 0xcf 625b81b6b3SRodney W. Grimes 635b81b6b3SRodney W. Grimes #define inst_trap_return(ins) (((ins)&0xff) == I_IRET) 645b81b6b3SRodney W. Grimes #define inst_return(ins) (((ins)&0xff) == I_RET) 655b81b6b3SRodney W. Grimes #define inst_call(ins) (((ins)&0xff) == I_CALL || \ 665b81b6b3SRodney W. Grimes (((ins)&0xff) == I_CALLI && \ 675b81b6b3SRodney W. Grimes ((ins)&0x3800) == 0x1000)) 685b81b6b3SRodney W. Grimes #define inst_load(ins) 0 695b81b6b3SRodney W. Grimes #define inst_store(ins) 0 705b81b6b3SRodney W. Grimes 717d350e72SBruce Evans /* 727d350e72SBruce Evans * There no interesting addresses below _kstack = 0xefbfe000. There 737d350e72SBruce Evans * are small absolute values for GUPROF, but we don't want to see them. 747d350e72SBruce Evans * Treat "negative" addresses below _kstack as non-small to allow for 757d350e72SBruce Evans * future reductions of _kstack and to avoid sign extension problems. 767d350e72SBruce Evans * 777d350e72SBruce Evans * There is one interesting symbol above -db_maxoff = 0xffff0000, 787d350e72SBruce Evans * namely _APTD = 0xfffff000. Accepting this would mess up the 797d350e72SBruce Evans * printing of small negative offsets. The next largest symbol is 807d350e72SBruce Evans * _APTmap = 0xffc00000. Accepting this is OK (unless db_maxoff is 817d350e72SBruce Evans * set to >= 0x400000 - (max stack offset)). 827d350e72SBruce Evans */ 837d350e72SBruce Evans #define DB_SMALL_VALUE_MAX 0x7fffffff 847d350e72SBruce Evans #define DB_SMALL_VALUE_MIN (-0x400001) 857d350e72SBruce Evans 861e1a3d01SBruce Evans #endif /* !_MACHINE_DB_MACHDEP_H_ */ 87