Automatic date update in version.in
[binutils-gdb.git] / gdb / ppc-ravenscar-thread.c
blobfd44a9a3ec6a26ca6c699e595055e85e62c3ae40
1 /* Ravenscar PowerPC target support.
3 Copyright (C) 2011-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "gdbcore.h"
21 #include "regcache.h"
22 #include "ppc-tdep.h"
23 #include "inferior.h"
24 #include "ravenscar-thread.h"
25 #include "ppc-ravenscar-thread.h"
27 #define NO_OFFSET -1
29 /* See ppc-tdep.h for register numbers. */
31 static const int powerpc_context_offsets[] =
33 /* R0 - R32 */
34 NO_OFFSET, 0, 4, NO_OFFSET,
35 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
36 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
37 NO_OFFSET, 8, 12, 16,
38 20, 24, 28, 32,
39 36, 40, 44, 48,
40 52, 56, 60, 64,
41 68, 72, 76, 80,
43 /* F0 - F31 */
44 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
45 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
46 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
47 NO_OFFSET, NO_OFFSET, 96, 104,
48 112, 120, 128, 136,
49 144, 152, 160, 168,
50 176, 184, 192, 200,
51 208, 216, 224, 232,
53 /* PC, MSR, CR, LR */
54 88, NO_OFFSET, 84, NO_OFFSET,
56 /* CTR, XER, FPSCR */
57 NO_OFFSET, NO_OFFSET, 240
60 static const int e500_context_offsets[] =
62 /* R0 - R32 */
63 NO_OFFSET, 4, 12, NO_OFFSET,
64 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
65 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
66 NO_OFFSET, 20, 28, 36,
67 44, 52, 60, 68,
68 76, 84, 92, 100,
69 108, 116, 124, 132,
70 140, 148, 156, 164,
72 /* F0 - F31 */
73 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
74 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
75 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
76 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
77 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
78 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
79 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
80 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
82 /* PC, MSR, CR, LR */
83 172, NO_OFFSET, 168, NO_OFFSET,
85 /* CTR, XER, FPSCR, MQ */
86 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
88 /* Upper R0-R32. */
89 NO_OFFSET, 0, 8, NO_OFFSET,
90 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
91 NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
92 NO_OFFSET, 16, 24, 32,
93 40, 48, 56, 64,
94 72, 80, 88, 96,
95 104, 112, 120, 128,
96 136, 144, 152, 160,
98 /* ACC, FSCR */
99 NO_OFFSET, 176
102 /* The ravenscar_arch_ops vector for most PowerPC targets. */
104 static struct ravenscar_arch_ops ppc_ravenscar_powerpc_ops
105 (powerpc_context_offsets);
107 /* Register ppc_ravenscar_powerpc_ops in GDBARCH. */
109 void
110 register_ppc_ravenscar_ops (struct gdbarch *gdbarch)
112 set_gdbarch_ravenscar_ops (gdbarch, &ppc_ravenscar_powerpc_ops);
115 /* The ravenscar_arch_ops vector for E500 targets. */
117 static struct ravenscar_arch_ops ppc_ravenscar_e500_ops (e500_context_offsets);
119 /* Register ppc_ravenscar_e500_ops in GDBARCH. */
121 void
122 register_e500_ravenscar_ops (struct gdbarch *gdbarch)
124 set_gdbarch_ravenscar_ops (gdbarch, &ppc_ravenscar_e500_ops);