6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "qemu-common.h"
23 #include "exec/gdbstub.h"
25 int hppa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
27 HPPACPU *cpu = HPPA_CPU(cs);
28 CPUHPPAState *env = &cpu->env;
33 val = cpu_hppa_get_psw(env);
39 val = env->cr[CR_SAR];
54 val = extract64(env->fr[(n - 64) / 2], (n & 1 ? 0 : 32), 32);
65 if (TARGET_REGISTER_BITS == 64) {
66 return gdb_get_reg64(mem_buf, val);
68 return gdb_get_reg32(mem_buf, val);
72 int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
74 HPPACPU *cpu = HPPA_CPU(cs);
75 CPUHPPAState *env = &cpu->env;
78 if (TARGET_REGISTER_BITS == 64) {
86 cpu_hppa_put_psw(env, val);
92 env->cr[CR_SAR] = val;
107 env->fr[0] = deposit64(env->fr[0], 32, 32, val);
108 cpu_hppa_loaded_fr0(env);
112 uint64_t *fr = &env->fr[(n - 64) / 2];
113 *fr = deposit64(*fr, val, (n & 1 ? 0 : 32), 32);
122 return sizeof(target_ureg);