db_machdep.h revision 83506
1/* $FreeBSD: head/sys/ia64/include/db_machdep.h 83506 2001-09-15 11:06:07Z dfr $ */ 2/* $NetBSD: db_machdep.h,v 1.6 1997/09/06 02:02:25 thorpej Exp $ */ 3 4/* 5 * Copyright (c) 1995 Carnegie-Mellon University. 6 * All rights reserved. 7 * 8 * Author: Chris G. Demetriou 9 * 10 * Permission to use, copy, modify and distribute this software and 11 * its documentation is hereby granted, provided that both the copyright 12 * notice and this permission notice appear in all copies of the 13 * software, derivative works or modified versions, and any portions 14 * thereof, and that both notices appear in supporting documentation. 15 * 16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 19 * 20 * Carnegie Mellon requests users of this software to return to 21 * 22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 23 * School of Computer Science 24 * Carnegie Mellon University 25 * Pittsburgh PA 15213-3890 26 * 27 * any improvements or extensions that they make and grant Carnegie the 28 * rights to redistribute these changes. 29 */ 30 31#ifndef _ALPHA_DB_MACHDEP_H_ 32#define _ALPHA_DB_MACHDEP_H_ 33 34/* 35 * Machine-dependent defines for new kernel debugger. 36 */ 37 38#include <sys/param.h> 39#include <vm/vm.h> 40#include <machine/frame.h> 41 42#define DB_NO_AOUT 43 44struct ia64_bundle { 45 u_int64_t slot[3]; 46 int template; 47}; 48 49typedef vm_offset_t db_addr_t; /* address - unsigned */ 50typedef long db_expr_t; /* expression - signed */ 51typedef struct trapframe db_regs_t; 52db_regs_t ddb_regs; /* register state */ 53#define DDB_REGS (&ddb_regs) 54 55#define PC_REGS(regs) ((db_addr_t)(regs)->tf_cr_iip \ 56 + (((regs)->tf_cr_ipsr >> 41) & 3)) 57 58#define BKPT_WRITE(addr, storage) db_write_breakpoint(addr, storage) 59#define BKPT_CLEAR(addr, storage) db_clear_breakpoint(addr, storage) 60#define BKPT_INST_TYPE u_int64_t 61 62#define BKPT_SKIP db_skip_breakpoint() 63 64#define db_clear_single_step(regs) ddb_regs.tf_cr_ipsr &= ~IA64_PSR_SS 65#define db_set_single_step(regs) ddb_regs.tf_cr_ipsr |= IA64_PSR_SS 66 67#define IS_BREAKPOINT_TRAP(type, code) (type == IA64_VEC_BREAK) 68#define IS_WATCHPOINT_TRAP(type, code) 0 69 70#define inst_trap_return(ins) 0 71#define inst_return(ins) 0 72#define inst_call(ins) 0 73#define inst_branch(ins) 0 74#define inst_load(ins) 0 75#define inst_store(ins) 0 76#define inst_unconditional_flow_transfer(ins) 0 77 78#define branch_taken(ins, pc, regs) pc 79 80/* 81 * Functions needed for software single-stepping. 82 */ 83 84/* No delay slots on Alpha. */ 85#define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4))) 86 87u_long db_register_value(db_regs_t *, int); 88int kdb_trap(int vector, struct trapframe *regs); 89 90u_int64_t *db_rse_current_frame(void); 91u_int64_t *db_rse_previous_frame(u_int64_t *bsp, int sof); 92u_int64_t *db_rse_register_address(u_int64_t *bsp, int regno); 93 94void db_read_bundle(db_addr_t addr, struct ia64_bundle *bp); 95void db_write_bundle(db_addr_t addr, struct ia64_bundle *bp); 96void db_write_breakpoint(db_addr_t addr, u_int64_t *storage); 97void db_clear_breakpoint(db_addr_t addr, u_int64_t *storage); 98void db_skip_breakpoint(void); 99 100/* 101 * Pretty arbitrary 102 */ 103#define DB_SMALL_VALUE_MAX 0x7fffffff 104#define DB_SMALL_VALUE_MIN (-0x400001) 105 106/* 107 * We define some of our own commands. 108 */ 109#define DB_MACHINE_COMMANDS 110 111/* 112 * We use Elf64 symbols in DDB. 113 */ 114#define DB_ELFSIZE 64 115 116#endif /* _ALPHA_DB_MACHDEP_H_ */ 117