1/*-
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29#ifndef	_MACHINE_DB_MACHDEP_H_
30#define	_MACHINE_DB_MACHDEP_H_
31
32#include <machine/ia64_cpu.h>
33
34/* We define some of our own commands. */
35#define	DB_MACHINE_COMMANDS
36
37/* We use Elf64 symbols in DDB. */
38#define	DB_ELFSIZE	64
39
40/* Pretty arbitrary. */
41#define	DB_SMALL_VALUE_MAX	0x7fffffff
42#define	DB_SMALL_VALUE_MIN	(-0x400001)
43
44typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
45typedef	long		db_expr_t;	/* expression - signed */
46
47#define	PC_REGS()	((kdb_thrctx->pcb_special.__spare == 0) ?	\
48	kdb_thrctx->pcb_special.rp :					\
49	kdb_thrctx->pcb_special.iip + ((kdb_thrctx->pcb_special.psr>>41) & 3))
50
51#define BKPT_WRITE(addr, storage)	db_bkpt_write(addr, storage)
52#define BKPT_CLEAR(addr, storage)	db_bkpt_clear(addr, storage)
53#define BKPT_SKIP			db_bkpt_skip()
54#define BKPT_INST_TYPE			uint64_t
55
56void db_bkpt_write(db_addr_t, BKPT_INST_TYPE *storage);
57void db_bkpt_clear(db_addr_t, uint64_t *storage);
58void db_bkpt_skip(void);
59
60#define db_clear_single_step		kdb_cpu_clear_singlestep
61#define db_set_single_step		kdb_cpu_set_singlestep
62
63#define	IS_BREAKPOINT_TRAP(type, code)	(type == IA64_VEC_BREAK)
64#define	IS_WATCHPOINT_TRAP(type, code)	0
65
66#define	inst_trap_return(ins)	(ins & 0)
67#define	inst_return(ins)	(ins & 0)
68#define	inst_call(ins)		(ins & 0)
69#define	inst_branch(ins)	(ins & 0)
70#define	inst_load(ins)		(ins & 0)
71#define	inst_store(ins)		(ins & 0)
72#define	inst_unconditional_flow_transfer(ins) (ins & 0)
73
74#define	branch_taken(ins, pc, regs) pc
75
76/* Function call support. */
77#define	DB_MAXARGS	8	/* Only support arguments in registers. */
78#define	DB_CALL		db_fncall_ia64
79
80#endif	/* _MACHINE_DB_MACHDEP_H_ */
81