2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2006 Marcel Moolenaar
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef _MACHINE_GDB_MACHDEP_H_
32 #define _MACHINE_GDB_MACHDEP_H_
35 #define PPC_GDB_NREGS0 1
36 #define PPC_GDB_NREGS4 (70 + 1)
37 #define PPC_GDB_NREGS8 (1 + 32)
38 #define PPC_GDB_NREGS16 0
49 * 103 - VSCR, VRSAVE (4)
52 #define PPC_REGNUM_R0 0
53 #define PPC_REGNUM_R31 (PPC_REGNUM_R0 + 31)
54 #define PPC_REGNUM_FR0 32
55 #define PPC_REGNUM_FR31 (PPC_REGNUM_FR0 + 31)
56 #define PPC_REGNUM_PC 64
57 #define PPC_REGNUM_PS 65
58 #define PPC_REGNUM_CR 66
59 #define PPC_REGNUM_LR 67
60 #define PPC_REGNUM_CTR 68
61 #define PPC_REGNUM_XER 69
62 #define PPC_REGNUM_FPSCR 70
63 #define PPC_REGNUM_VR0 71
64 #define PPC_REGNUM_VR31 (PPC_REGNUM_VR0 + 31)
66 #define PPC_GDB_NREGS0 0
69 #define PPC_GDB_NREGS4 5
70 #define PPC_GDB_NREGS8 (64 + 4)
72 #define PPC_GDB_NREGS4 (32 + 7 + 2)
73 #define PPC_GDB_NREGS8 32
76 #define PPC_GDB_NREGS16 32
79 #define GDB_NREGS (PPC_GDB_NREGS0 + PPC_GDB_NREGS4 + \
80 PPC_GDB_NREGS8 + PPC_GDB_NREGS16)
83 #define GDB_BUFSZ (PPC_GDB_NREGS4 * 8 + \
84 PPC_GDB_NREGS8 * 16 + \
87 static __inline size_t
88 gdb_cpu_regsz(int regnum)
94 if (regnum == 71 || regnum >= 73)
98 if ((regnum >= PPC_REGNUM_R0 && regnum <= PPC_REGNUM_PS) ||
99 regnum == PPC_REGNUM_LR || regnum == PPC_REGNUM_CTR)
102 if (regnum >= PPC_REGNUM_FR0 && regnum <= PPC_REGNUM_FR31)
105 if (regnum >= PPC_REGNUM_VR0 && regnum <= PPC_REGNUM_VR31)
118 static __inline void *
119 gdb_begin_write(void)
126 gdb_end_write(void *arg __unused)
132 gdb_cpu_stop_reason(int type __unused, int code __unused)
137 void *gdb_cpu_getreg(int, size_t *);
138 void gdb_cpu_setreg(int, void *);
139 int gdb_cpu_signal(int, int);
140 void gdb_cpu_do_offsets(void);
142 #endif /* !_MACHINE_GDB_MACHDEP_H_ */