1139790Simp/*-
2131952Smarcel * Copyright (c) 2004 Marcel Moolenaar
366458Sdfr * All rights reserved.
466458Sdfr *
5131952Smarcel * Redistribution and use in source and binary forms, with or without
6131952Smarcel * modification, are permitted provided that the following conditions
7131952Smarcel * are met:
866458Sdfr *
9131952Smarcel * 1. Redistributions of source code must retain the above copyright
10131952Smarcel *    notice, this list of conditions and the following disclaimer.
11131952Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12131952Smarcel *    notice, this list of conditions and the following disclaimer in the
13131952Smarcel *    documentation and/or other materials provided with the distribution.
1466458Sdfr *
15131952Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16131952Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17131952Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18131952Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19131952Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20131952Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21131952Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22131952Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23131952Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24131952Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2566458Sdfr *
26131952Smarcel * $FreeBSD$
2766458Sdfr */
2866458Sdfr
2996912Smarcel#ifndef	_MACHINE_DB_MACHDEP_H_
3096912Smarcel#define	_MACHINE_DB_MACHDEP_H_
3166458Sdfr
3296912Smarcel#include <machine/ia64_cpu.h>
3366458Sdfr
34131952Smarcel/* We define some of our own commands. */
35131952Smarcel#define	DB_MACHINE_COMMANDS
3666458Sdfr
37131952Smarcel/* We use Elf64 symbols in DDB. */
38131952Smarcel#define	DB_ELFSIZE	64
3983506Sdfr
40131952Smarcel/* Pretty arbitrary. */
41131952Smarcel#define	DB_SMALL_VALUE_MAX	0x7fffffff
42131952Smarcel#define	DB_SMALL_VALUE_MIN	(-0x400001)
43131952Smarcel
4466458Sdfrtypedef	vm_offset_t	db_addr_t;	/* address - unsigned */
4566458Sdfrtypedef	long		db_expr_t;	/* expression - signed */
4666458Sdfr
47131952Smarcel#define	PC_REGS()	((kdb_thrctx->pcb_special.__spare == 0) ?	\
48131952Smarcel	kdb_thrctx->pcb_special.rp :					\
49131952Smarcel	kdb_thrctx->pcb_special.iip + ((kdb_thrctx->pcb_special.psr>>41) & 3))
5066458Sdfr
51131952Smarcel#define BKPT_WRITE(addr, storage)	db_bkpt_write(addr, storage)
52131952Smarcel#define BKPT_CLEAR(addr, storage)	db_bkpt_clear(addr, storage)
53131952Smarcel#define BKPT_SKIP			db_bkpt_skip()
54131952Smarcel#define BKPT_INST_TYPE			uint64_t
5566458Sdfr
56131952Smarcelvoid db_bkpt_write(db_addr_t, BKPT_INST_TYPE *storage);
57131952Smarcelvoid db_bkpt_clear(db_addr_t, uint64_t *storage);
58131952Smarcelvoid db_bkpt_skip(void);
5966458Sdfr
60131952Smarcel#define db_clear_single_step		kdb_cpu_clear_singlestep
61131952Smarcel#define db_set_single_step		kdb_cpu_set_singlestep
6266937Sdfr
6383506Sdfr#define	IS_BREAKPOINT_TRAP(type, code)	(type == IA64_VEC_BREAK)
6466458Sdfr#define	IS_WATCHPOINT_TRAP(type, code)	0
6566458Sdfr
6692124Speter#define	inst_trap_return(ins)	(ins & 0)
6792124Speter#define	inst_return(ins)	(ins & 0)
6892124Speter#define	inst_call(ins)		(ins & 0)
6992124Speter#define	inst_branch(ins)	(ins & 0)
7092124Speter#define	inst_load(ins)		(ins & 0)
7192124Speter#define	inst_store(ins)		(ins & 0)
7292124Speter#define	inst_unconditional_flow_transfer(ins) (ins & 0)
73131952Smarcel
7466937Sdfr#define	branch_taken(ins, pc, regs) pc
7566937Sdfr
76147745Smarcel/* Function call support. */
77147745Smarcel#define	DB_MAXARGS	8	/* Only support arguments in registers. */
78147745Smarcel#define	DB_CALL		db_fncall_ia64
79147745Smarcel
8096912Smarcel#endif	/* _MACHINE_DB_MACHDEP_H_ */
81