db_machdep.h revision 96912
166458Sdfr/* $FreeBSD: head/sys/ia64/include/db_machdep.h 96912 2002-05-19 04:42:19Z marcel $ */
266458Sdfr/* $NetBSD: db_machdep.h,v 1.6 1997/09/06 02:02:25 thorpej Exp $ */
366458Sdfr
466458Sdfr/*
566458Sdfr * Copyright (c) 1995 Carnegie-Mellon University.
666458Sdfr * All rights reserved.
766458Sdfr *
866458Sdfr * Author: Chris G. Demetriou
966458Sdfr *
1066458Sdfr * Permission to use, copy, modify and distribute this software and
1166458Sdfr * its documentation is hereby granted, provided that both the copyright
1266458Sdfr * notice and this permission notice appear in all copies of the
1366458Sdfr * software, derivative works or modified versions, and any portions
1466458Sdfr * thereof, and that both notices appear in supporting documentation.
1566458Sdfr *
1666458Sdfr * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1766458Sdfr * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
1866458Sdfr * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1966458Sdfr *
2066458Sdfr * Carnegie Mellon requests users of this software to return to
2166458Sdfr *
2266458Sdfr *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
2366458Sdfr *  School of Computer Science
2466458Sdfr *  Carnegie Mellon University
2566458Sdfr *  Pittsburgh PA 15213-3890
2666458Sdfr *
2766458Sdfr * any improvements or extensions that they make and grant Carnegie the
2866458Sdfr * rights to redistribute these changes.
2966458Sdfr */
3066458Sdfr
3196912Smarcel#ifndef	_MACHINE_DB_MACHDEP_H_
3296912Smarcel#define	_MACHINE_DB_MACHDEP_H_
3366458Sdfr
3466458Sdfr/*
3566458Sdfr * Machine-dependent defines for new kernel debugger.
3666458Sdfr */
3766458Sdfr
3866458Sdfr#include <sys/param.h>
3966458Sdfr#include <vm/vm.h>
4066458Sdfr#include <machine/frame.h>
4196912Smarcel#include <machine/ia64_cpu.h>
4266458Sdfr
4366458Sdfr#define DB_NO_AOUT
4466458Sdfr
4585109Sdfrstruct ia64_bundle;
4683506Sdfr
4766458Sdfrtypedef	vm_offset_t	db_addr_t;	/* address - unsigned */
4866458Sdfrtypedef	long		db_expr_t;	/* expression - signed */
4966458Sdfrtypedef struct trapframe db_regs_t;
5089491Smarcelextern db_regs_t	ddb_regs;	/* register state */
5166458Sdfr#define	DDB_REGS	(&ddb_regs)
5266458Sdfr
5366937Sdfr#define	PC_REGS(regs)	((db_addr_t)(regs)->tf_cr_iip \
5466937Sdfr			 + (((regs)->tf_cr_ipsr >> 41) & 3))
5566458Sdfr
5683506Sdfr#define BKPT_WRITE(addr, storage)	db_write_breakpoint(addr, storage)
5783506Sdfr#define BKPT_CLEAR(addr, storage)	db_clear_breakpoint(addr, storage)
5883506Sdfr#define BKPT_INST_TYPE			u_int64_t
5966458Sdfr
6083506Sdfr#define BKPT_SKIP			db_skip_breakpoint()
6166458Sdfr
6283506Sdfr#define db_clear_single_step(regs)	ddb_regs.tf_cr_ipsr &= ~IA64_PSR_SS
6383506Sdfr#define db_set_single_step(regs)	ddb_regs.tf_cr_ipsr |= IA64_PSR_SS
6466937Sdfr
6583506Sdfr#define	IS_BREAKPOINT_TRAP(type, code)	(type == IA64_VEC_BREAK)
6666458Sdfr#define	IS_WATCHPOINT_TRAP(type, code)	0
6766458Sdfr
6892124Speter#define	inst_trap_return(ins)	(ins & 0)
6992124Speter#define	inst_return(ins)	(ins & 0)
7092124Speter#define	inst_call(ins)		(ins & 0)
7192124Speter#define	inst_branch(ins)	(ins & 0)
7292124Speter#define	inst_load(ins)		(ins & 0)
7392124Speter#define	inst_store(ins)		(ins & 0)
7492124Speter#define	inst_unconditional_flow_transfer(ins) (ins & 0)
7566937Sdfr
7666937Sdfr#define	branch_taken(ins, pc, regs) pc
7766937Sdfr
7866458Sdfr/*
7966458Sdfr * Functions needed for software single-stepping.
8066458Sdfr */
8166458Sdfr
8266458Sdfr/* No delay slots on Alpha. */
8366458Sdfr#define	next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4)))
8466458Sdfr
8566937Sdfru_long	db_register_value(db_regs_t *, int);
8666937Sdfrint	kdb_trap(int vector, struct trapframe *regs);
8766458Sdfr
8875666Sdfru_int64_t *db_rse_current_frame(void);
8975666Sdfru_int64_t *db_rse_previous_frame(u_int64_t *bsp, int sof);
9075666Sdfru_int64_t *db_rse_register_address(u_int64_t *bsp, int regno);
9175666Sdfr
9283506Sdfrvoid	db_read_bundle(db_addr_t addr, struct ia64_bundle *bp);
9383506Sdfrvoid	db_write_bundle(db_addr_t addr, struct ia64_bundle *bp);
9483506Sdfrvoid	db_write_breakpoint(db_addr_t addr, u_int64_t *storage);
9583506Sdfrvoid	db_clear_breakpoint(db_addr_t addr, u_int64_t *storage);
9683506Sdfrvoid	db_skip_breakpoint(void);
9783506Sdfr
9866458Sdfr/*
9966458Sdfr * Pretty arbitrary
10066458Sdfr */
10166458Sdfr#define	DB_SMALL_VALUE_MAX	0x7fffffff
10266458Sdfr#define	DB_SMALL_VALUE_MIN	(-0x400001)
10366458Sdfr
10466458Sdfr/*
10566458Sdfr * We define some of our own commands.
10666458Sdfr */
10766458Sdfr#define	DB_MACHINE_COMMANDS
10866458Sdfr
10966458Sdfr/*
11066458Sdfr * We use Elf64 symbols in DDB.
11166458Sdfr */
11266458Sdfr#define	DB_ELFSIZE	64
11366458Sdfr
11496912Smarcel#endif	/* _MACHINE_DB_MACHDEP_H_ */
115