1161588Smarcel/*-
2161588Smarcel * Copyright (c) 2006 Marcel Moolenaar
3161588Smarcel * All rights reserved.
4161588Smarcel *
5161588Smarcel * Redistribution and use in source and binary forms, with or without
6161588Smarcel * modification, are permitted provided that the following conditions
7161588Smarcel * are met:
8161588Smarcel *
9161588Smarcel * 1. Redistributions of source code must retain the above copyright
10161588Smarcel *    notice, this list of conditions and the following disclaimer.
11161588Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12161588Smarcel *    notice, this list of conditions and the following disclaimer in the
13161588Smarcel *    documentation and/or other materials provided with the distribution.
14161588Smarcel *
15161588Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16161588Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17161588Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18161588Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19161588Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20161588Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21161588Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22161588Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23161588Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24161588Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25161588Smarcel *
26161588Smarcel * $FreeBSD$
27161588Smarcel */
28161588Smarcel
29161588Smarcel#ifndef _MACHINE_GDB_MACHDEP_H_
30161588Smarcel#define	_MACHINE_GDB_MACHDEP_H_
31161588Smarcel
32250864Smarcel#ifdef BOOKE
33250864Smarcel#define	PPC_GDB_NREGS0	1
34250864Smarcel#define	PPC_GDB_NREGS4	(70 + 1)
35250864Smarcel#define	PPC_GDB_NREGS8	(1 + 32)
36250864Smarcel#define	PPC_GDB_NREGS16	0
37250864Smarcel#else
38250864Smarcel#define	PPC_GDB_NREGS0	0
39177288Smarcel#define	PPC_GDB_NREGS4	(32 + 7 + 2)
40177288Smarcel#define	PPC_GDB_NREGS8	32
41177288Smarcel#define	PPC_GDB_NREGS16	32
42250864Smarcel#endif
43177288Smarcel
44250864Smarcel#define GDB_NREGS	(PPC_GDB_NREGS0 + PPC_GDB_NREGS4 + \
45250864Smarcel			 PPC_GDB_NREGS8 + PPC_GDB_NREGS16)
46161588Smarcel#define	GDB_REG_PC	64
47161588Smarcel
48177288Smarcel#define	GDB_BUFSZ	(PPC_GDB_NREGS4 * 8 +	\
49177288Smarcel			 PPC_GDB_NREGS8 * 16 +	\
50177288Smarcel			 PPC_GDB_NREGS16 * 32)
51161588Smarcel
52161588Smarcelstatic __inline size_t
53161588Smarcelgdb_cpu_regsz(int regnum)
54161588Smarcel{
55177288Smarcel
56250864Smarcel#ifdef BOOKE
57250864Smarcel	if (regnum == 70)
58250864Smarcel		return (0);
59250864Smarcel	if (regnum == 71 || regnum >= 73)
60250864Smarcel		return (8);
61250864Smarcel#else
62177288Smarcel	if (regnum >= 32 && regnum <= 63)
63177288Smarcel		return (8);
64177288Smarcel	if (regnum >= 71 && regnum <= 102)
65177288Smarcel		return (16);
66250864Smarcel#endif
67177288Smarcel	return (4);
68161588Smarcel}
69161588Smarcel
70161588Smarcelstatic __inline int
71161588Smarcelgdb_cpu_query(void)
72161588Smarcel{
73177288Smarcel
74161588Smarcel	return (0);
75161588Smarcel}
76161588Smarcel
77161588Smarcelvoid *gdb_cpu_getreg(int, size_t *);
78161588Smarcelvoid gdb_cpu_setreg(int, void *);
79161588Smarcelint gdb_cpu_signal(int, int);
80161588Smarcel
81161588Smarcel#endif /* !_MACHINE_GDB_MACHDEP_H_ */
82