| @@ -1,293 +1,291 @@ | | | @@ -1,293 +1,291 @@ |
1 | /* Native-dependent code for NetBSD/hppa. | | 1 | /* Native-dependent code for NetBSD/hppa. |
2 | | | 2 | |
3 | Copyright (C) 2008-2016 Free Software Foundation, Inc. | | 3 | Copyright (C) 2008-2016 Free Software Foundation, Inc. |
4 | | | 4 | |
5 | This file is part of GDB. | | 5 | This file is part of GDB. |
6 | | | 6 | |
7 | This program is free software; you can redistribute it and/or modify | | 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 | | 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 | | 9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | | 10 | (at your option) any later version. |
11 | | | 11 | |
12 | This program is distributed in the hope that it will be useful, | | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | | 15 | GNU General Public License for more details. |
16 | | | 16 | |
17 | You should have received a copy of the GNU General Public License | | 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/>. */ | | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | | | 19 | |
20 | #include "defs.h" | | 20 | #include "defs.h" |
21 | #include "inferior.h" | | 21 | #include "inferior.h" |
22 | #include "regcache.h" | | 22 | #include "regcache.h" |
23 | | | 23 | |
24 | #include <sys/types.h> | | 24 | #include <sys/types.h> |
25 | #include <sys/ptrace.h> | | 25 | #include <sys/ptrace.h> |
26 | #include <machine/reg.h> | | 26 | #include <machine/reg.h> |
27 | | | 27 | |
28 | #include "hppa-tdep.h" | | 28 | #include "hppa-tdep.h" |
29 | #include "inf-ptrace.h" | | 29 | #include "inf-ptrace.h" |
30 | | | 30 | |
31 | #include "nbsd-nat.h" | | 31 | #include "nbsd-nat.h" |
32 | | | 32 | |
33 | #ifndef HAVE_GREGSET_T | | 33 | #ifndef HAVE_GREGSET_T |
34 | typedef struct reg gregset_t; | | 34 | typedef struct reg gregset_t; |
35 | #endif | | 35 | #endif |
36 | | | 36 | |
37 | #ifndef HAVE_FPREGSET_T | | 37 | #ifndef HAVE_FPREGSET_T |
38 | typedef struct fpreg fpregset_t; | | 38 | typedef struct fpreg fpregset_t; |
39 | #endif | | 39 | #endif |
40 | | | 40 | |
41 | #include "gregset.h" | | 41 | #include "gregset.h" |
42 | | | 42 | |
43 | static int | | 43 | static int |
44 | hppanbsd_gregset_supplies_p (int regnum) | | 44 | hppanbsd_gregset_supplies_p (int regnum) |
45 | { | | 45 | { |
46 | return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) || | | 46 | return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) || |
47 | (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) || | | 47 | (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) || |
48 | regnum == HPPA_IPSW_REGNUM || | | 48 | regnum == HPPA_IPSW_REGNUM || |
49 | (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5)); | | 49 | (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5)); |
50 | } | | 50 | } |
51 | | | 51 | |
52 | static int | | 52 | static int |
53 | hppanbsd_fpregset_supplies_p (int regnum) | | 53 | hppanbsd_fpregset_supplies_p (int regnum) |
54 | { | | 54 | { |
55 | return (regnum >= HPPA_FP0_REGNUM && regnum <= HPPA_FP31R_REGNUM); | | 55 | return (regnum >= HPPA_FP0_REGNUM && regnum <= HPPA_FP31R_REGNUM); |
56 | } | | 56 | } |
57 | | | 57 | |
58 | /* Supply the general-purpose registers stored in GREGS to REGCACHE. */ | | 58 | /* Supply the general-purpose registers stored in GREGS to REGCACHE. */ |
59 | | | 59 | |
60 | static void | | 60 | static void |
61 | hppanbsd_supply_gregset (struct regcache *regcache, const void *gregs) | | 61 | hppanbsd_supply_gregset (struct regcache *regcache, const void *gregs) |
62 | { | | 62 | { |
63 | const char *regs = gregs; | | 63 | const char *regs = (const char *) gregs; |
64 | const int *r = gregs; | | | |
65 | int regnum; | | 64 | int regnum; |
66 | | | 65 | |
67 | for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++) | | 66 | for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++) |
68 | regcache_raw_supply (regcache, regnum, regs + regnum * 4); | | 67 | regcache_raw_supply (regcache, regnum, regs + regnum * 4); |
69 | | | 68 | |
70 | regcache_raw_supply (regcache, HPPA_SAR_REGNUM, regs + 32 * 4); | | 69 | regcache_raw_supply (regcache, HPPA_SAR_REGNUM, regs + 32 * 4); |
71 | regcache_raw_supply (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4); | | 70 | regcache_raw_supply (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4); |
72 | regcache_raw_supply (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4); | | 71 | regcache_raw_supply (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4); |
73 | regcache_raw_supply (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); | | 72 | regcache_raw_supply (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); |
74 | regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); | | 73 | regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); |
75 | regcache_raw_supply (regcache, HPPA_IPSW_REGNUM, regs); | | 74 | regcache_raw_supply (regcache, HPPA_IPSW_REGNUM, regs); |
76 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM, regs + 41 * 4); | | 75 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM, regs + 41 * 4); |
77 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); | | 76 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); |
78 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); | | 77 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); |
79 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); | | 78 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); |
80 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); | | 79 | regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); |
81 | } | | 80 | } |
82 | | | 81 | |
83 | /* Supply the floating-point registers stored in FPREGS to REGCACHE. */ | | 82 | /* Supply the floating-point registers stored in FPREGS to REGCACHE. */ |
84 | | | 83 | |
85 | static void | | 84 | static void |
86 | hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs) | | 85 | hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs) |
87 | { | | 86 | { |
88 | const char *regs = fpregs; | | 87 | const char *regs = (const char *) fpregs; |
89 | int regnum; | | 88 | int regnum; |
90 | | | 89 | |
91 | for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM; | | 90 | for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM; |
92 | regnum += 2, regs += 8) | | 91 | regnum += 2, regs += 8) |
93 | { | | 92 | { |
94 | regcache_raw_supply (regcache, regnum, regs); | | 93 | regcache_raw_supply (regcache, regnum, regs); |
95 | regcache_raw_supply (regcache, regnum + 1, regs + 4); | | 94 | regcache_raw_supply (regcache, regnum + 1, regs + 4); |
96 | } | | 95 | } |
97 | } | | 96 | } |
98 | | | 97 | |
99 | /* Collect the general-purpose registers from REGCACHE and store them | | 98 | /* Collect the general-purpose registers from REGCACHE and store them |
100 | in GREGS. */ | | 99 | in GREGS. */ |
101 | | | 100 | |
102 | static void | | 101 | static void |
103 | hppanbsd_collect_gregset (const struct regcache *regcache, | | 102 | hppanbsd_collect_gregset (const struct regcache *regcache, |
104 | void *gregs, int regnum) | | 103 | void *gregs, int regnum) |
105 | { | | 104 | { |
106 | char *regs = gregs; | | 105 | char *regs = (char *) gregs; |
107 | int *r = gregs; | | | |
108 | int i; | | 106 | int i; |
109 | | | 107 | |
110 | for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++) | | 108 | for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++) |
111 | { | | 109 | { |
112 | if (regnum == -1 || regnum == i) | | 110 | if (regnum == -1 || regnum == i) |
113 | regcache_raw_collect (regcache, i, regs + i * 4); | | 111 | regcache_raw_collect (regcache, i, regs + i * 4); |
114 | } | | 112 | } |
115 | | | 113 | |
116 | if (regnum == -1 || regnum == HPPA_IPSW_REGNUM) | | 114 | if (regnum == -1 || regnum == HPPA_IPSW_REGNUM) |
117 | regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs); | | 115 | regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs); |
118 | if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM) | | 116 | if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM) |
119 | regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); | | 117 | regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); |
120 | if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM) | | 118 | if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM) |
121 | regcache_raw_collect (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); | | 119 | regcache_raw_collect (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); |
122 | | | 120 | |
123 | if (regnum == -1 || regnum == HPPA_SAR_REGNUM) | | 121 | if (regnum == -1 || regnum == HPPA_SAR_REGNUM) |
124 | regcache_raw_collect (regcache, HPPA_SAR_REGNUM, regs + 32 * 4); | | 122 | regcache_raw_collect (regcache, HPPA_SAR_REGNUM, regs + 32 * 4); |
125 | if (regnum == -1 || regnum == HPPA_PCSQ_HEAD_REGNUM) | | 123 | if (regnum == -1 || regnum == HPPA_PCSQ_HEAD_REGNUM) |
126 | regcache_raw_collect (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4); | | 124 | regcache_raw_collect (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4); |
127 | if (regnum == -1 || regnum == HPPA_PCSQ_TAIL_REGNUM) | | 125 | if (regnum == -1 || regnum == HPPA_PCSQ_TAIL_REGNUM) |
128 | regcache_raw_collect (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4); | | 126 | regcache_raw_collect (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4); |
129 | if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM) | | 127 | if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM) |
130 | regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); | | 128 | regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); |
131 | if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM) | | 129 | if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM) |
132 | regcache_raw_collect (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); | | 130 | regcache_raw_collect (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); |
133 | if (regnum == -1 || regnum == HPPA_IPSW_REGNUM) | | 131 | if (regnum == -1 || regnum == HPPA_IPSW_REGNUM) |
134 | regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs); | | 132 | regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs); |
135 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM) | | 133 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM) |
136 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM, regs + 41 * 4); | | 134 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM, regs + 41 * 4); |
137 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 1) | | 135 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 1) |
138 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); | | 136 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); |
139 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 2) | | 137 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 2) |
140 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); | | 138 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); |
141 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 3) | | 139 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 3) |
142 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); | | 140 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); |
143 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 4) | | 141 | if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 4) |
144 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); | | 142 | regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); |
145 | } | | 143 | } |
146 | | | 144 | |
147 | /* Collect the floating-point registers from REGCACHE and store them | | 145 | /* Collect the floating-point registers from REGCACHE and store them |
148 | in FPREGS. */ | | 146 | in FPREGS. */ |
149 | | | 147 | |
150 | static void | | 148 | static void |
151 | hppanbsd_collect_fpregset (const struct regcache *regcache, | | 149 | hppanbsd_collect_fpregset (const struct regcache *regcache, |
152 | void *fpregs, int regnum) | | 150 | void *fpregs, int regnum) |
153 | { | | 151 | { |
154 | char *regs = fpregs; | | 152 | char *regs = (char *) fpregs; |
155 | int i; | | 153 | int i; |
156 | | | 154 | |
157 | for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8) | | 155 | for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8) |
158 | { | | 156 | { |
159 | if (regnum == -1 || regnum == i || regnum == i + 1) | | 157 | if (regnum == -1 || regnum == i || regnum == i + 1) |
160 | { | | 158 | { |
161 | regcache_raw_collect (regcache, i, regs); | | 159 | regcache_raw_collect (regcache, i, regs); |
162 | regcache_raw_collect (regcache, i + 1, regs + 4); | | 160 | regcache_raw_collect (regcache, i + 1, regs + 4); |
163 | } | | 161 | } |
164 | } | | 162 | } |
165 | } | | 163 | } |
166 | | | 164 | |
167 | | | 165 | |
168 | /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this | | 166 | /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this |
169 | for all registers (including the floating-point registers). */ | | 167 | for all registers (including the floating-point registers). */ |
170 | | | 168 | |
171 | static void | | 169 | static void |
172 | hppanbsd_fetch_registers (struct target_ops *ops, | | 170 | hppanbsd_fetch_registers (struct target_ops *ops, |
173 | struct regcache *regcache, int regnum) | | 171 | struct regcache *regcache, int regnum) |
174 | | | 172 | |
175 | { | | 173 | { |
176 | if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) | | 174 | if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) |
177 | { | | 175 | { |
178 | struct reg regs; | | 176 | struct reg regs; |
179 | | | 177 | |
180 | if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | | 178 | if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), |
181 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) | | 179 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) |
182 | perror_with_name (_("Couldn't get registers")); | | 180 | perror_with_name (_("Couldn't get registers")); |
183 | | | 181 | |
184 | hppanbsd_supply_gregset (regcache, ®s); | | 182 | hppanbsd_supply_gregset (regcache, ®s); |
185 | } | | 183 | } |
186 | | | 184 | |
187 | if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) | | 185 | if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) |
188 | { | | 186 | { |
189 | struct fpreg fpregs; | | 187 | struct fpreg fpregs; |
190 | | | 188 | |
191 | if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | | 189 | if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), |
192 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) | | 190 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) |
193 | perror_with_name (_("Couldn't get floating point status")); | | 191 | perror_with_name (_("Couldn't get floating point status")); |
194 | | | 192 | |
195 | hppanbsd_supply_fpregset (regcache, &fpregs); | | 193 | hppanbsd_supply_fpregset (regcache, &fpregs); |
196 | } | | 194 | } |
197 | } | | 195 | } |
198 | | | 196 | |
199 | /* Store register REGNUM back into the inferior. If REGNUM is -1, do | | 197 | /* Store register REGNUM back into the inferior. If REGNUM is -1, do |
200 | this for all registers (including the floating-point registers). */ | | 198 | this for all registers (including the floating-point registers). */ |
201 | | | 199 | |
202 | static void | | 200 | static void |
203 | hppanbsd_store_registers (struct target_ops *ops, | | 201 | hppanbsd_store_registers (struct target_ops *ops, |
204 | struct regcache *regcache, int regnum) | | 202 | struct regcache *regcache, int regnum) |
205 | { | | 203 | { |
206 | if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) | | 204 | if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) |
207 | { | | 205 | { |
208 | struct reg regs; | | 206 | struct reg regs; |
209 | | | 207 | |
210 | if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), | | 208 | if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), |
211 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) | | 209 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) |
212 | perror_with_name (_("Couldn't get registers")); | | 210 | perror_with_name (_("Couldn't get registers")); |
213 | | | 211 | |
214 | hppanbsd_collect_gregset (regcache, ®s, regnum); | | 212 | hppanbsd_collect_gregset (regcache, ®s, regnum); |
215 | | | 213 | |
216 | if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), | | 214 | if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), |
217 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) | | 215 | (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) |
218 | perror_with_name (_("Couldn't write registers")); | | 216 | perror_with_name (_("Couldn't write registers")); |
219 | } | | 217 | } |
220 | | | 218 | |
221 | if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) | | 219 | if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) |
222 | { | | 220 | { |
223 | struct fpreg fpregs; | | 221 | struct fpreg fpregs; |
224 | | | 222 | |
225 | if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), | | 223 | if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), |
226 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) | | 224 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) |
227 | perror_with_name (_("Couldn't get floating point status")); | | 225 | perror_with_name (_("Couldn't get floating point status")); |
228 | | | 226 | |
229 | hppanbsd_collect_fpregset (regcache, &fpregs, regnum); | | 227 | hppanbsd_collect_fpregset (regcache, &fpregs, regnum); |
230 | | | 228 | |
231 | if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), | | 229 | if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), |
232 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) | | 230 | (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) |
233 | perror_with_name (_("Couldn't write floating point status")); | | 231 | perror_with_name (_("Couldn't write floating point status")); |
234 | } | | 232 | } |
235 | } | | 233 | } |
236 | | | 234 | |
237 | void | | 235 | void |
238 | supply_gregset (struct regcache *regcache, const gregset_t *gregsetp) | | 236 | supply_gregset (struct regcache *regcache, const gregset_t *gregsetp) |
239 | { | | 237 | { |
240 | hppanbsd_supply_gregset (regcache, gregsetp); | | 238 | hppanbsd_supply_gregset (regcache, gregsetp); |
241 | } | | 239 | } |
242 | | | 240 | |
243 | /* Fill register REGNUM (if it is a general-purpose register) in | | 241 | /* Fill register REGNUM (if it is a general-purpose register) in |
244 | *GREGSETP with the value in GDB's register cache. If REGNUM is -1, | | 242 | *GREGSETP with the value in GDB's register cache. If REGNUM is -1, |
245 | do this for all registers. */ | | 243 | do this for all registers. */ |
246 | | | 244 | |
247 | void | | 245 | void |
248 | fill_gregset (const struct regcache *regcache, | | 246 | fill_gregset (const struct regcache *regcache, |
249 | gregset_t *gregsetp, int regnum) | | 247 | gregset_t *gregsetp, int regnum) |
250 | { | | 248 | { |
251 | hppanbsd_collect_gregset (regcache, gregsetp, regnum); | | 249 | hppanbsd_collect_gregset (regcache, gregsetp, regnum); |
252 | } | | 250 | } |
253 | | | 251 | |
254 | /* Transfering floating-point registers between GDB, inferiors and cores. */ | | 252 | /* Transfering floating-point registers between GDB, inferiors and cores. */ |
255 | | | 253 | |
256 | /* Fill GDB's register cache with the floating-point and SSE register | | 254 | /* Fill GDB's register cache with the floating-point and SSE register |
257 | values in *FPREGSETP. */ | | 255 | values in *FPREGSETP. */ |
258 | | | 256 | |
259 | void | | 257 | void |
260 | supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp) | | 258 | supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp) |
261 | { | | 259 | { |
262 | hppanbsd_supply_fpregset (regcache, fpregsetp); | | 260 | hppanbsd_supply_fpregset (regcache, fpregsetp); |
263 | } | | 261 | } |
264 | | | 262 | |
265 | /* Fill register REGNUM (if it is a floating-point or SSE register) in | | 263 | /* Fill register REGNUM (if it is a floating-point or SSE register) in |
266 | *FPREGSETP with the value in GDB's register cache. If REGNUM is | | 264 | *FPREGSETP with the value in GDB's register cache. If REGNUM is |
267 | -1, do this for all registers. */ | | 265 | -1, do this for all registers. */ |
268 | | | 266 | |
269 | void | | 267 | void |
270 | fill_fpregset (const struct regcache *regcache, | | 268 | fill_fpregset (const struct regcache *regcache, |
271 | fpregset_t *fpregsetp, int regnum) | | 269 | fpregset_t *fpregsetp, int regnum) |
272 | { | | 270 | { |
273 | hppanbsd_collect_fpregset (regcache, fpregsetp, regnum); | | 271 | hppanbsd_collect_fpregset (regcache, fpregsetp, regnum); |
274 | } | | 272 | } |
275 | | | 273 | |
276 | /* Provide a prototype to silence -Wmissing-prototypes. */ | | 274 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
277 | void _initialize_hppanbsd_nat (void); | | 275 | void _initialize_hppanbsd_nat (void); |
278 | | | 276 | |
279 | void | | 277 | void |
280 | _initialize_hppanbsd_nat (void) | | 278 | _initialize_hppanbsd_nat (void) |
281 | { | | 279 | { |
282 | struct target_ops *t; | | 280 | struct target_ops *t; |
283 | | | 281 | |
284 | /* Add some extra features to the ptrace target. */ | | 282 | /* Add some extra features to the ptrace target. */ |
285 | t = inf_ptrace_target (); | | 283 | t = inf_ptrace_target (); |
286 | | | 284 | |
287 | t->to_fetch_registers = hppanbsd_fetch_registers; | | 285 | t->to_fetch_registers = hppanbsd_fetch_registers; |
288 | t->to_store_registers = hppanbsd_store_registers; | | 286 | t->to_store_registers = hppanbsd_store_registers; |
289 | | | 287 | |
290 | t->to_pid_to_exec_file = nbsd_pid_to_exec_file; | | 288 | t->to_pid_to_exec_file = nbsd_pid_to_exec_file; |
291 | | | 289 | |
292 | add_target (t); | | 290 | add_target (t); |
293 | } | | 291 | } |