4 * Copyright (c) 2016 Richard Henderson <rth@twiddle.net>
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
);
54 val
= extract64(env
->fr
[(n
- 64) / 2], (n
& 1 ? 0 : 32), 32);
64 return gdb_get_regl(mem_buf
, val
);
67 int hppa_cpu_gdb_write_register(CPUState
*cs
, uint8_t *mem_buf
, int n
)
69 HPPACPU
*cpu
= HPPA_CPU(cs
);
70 CPUHPPAState
*env
= &cpu
->env
;
71 target_ulong val
= ldtul_p(mem_buf
);
75 cpu_hppa_put_psw(env
, val
);
95 env
->fr
[0] = deposit64(env
->fr
[0], 32, 32, val
);
96 cpu_hppa_loaded_fr0(env
);
100 uint64_t *fr
= &env
->fr
[(n
- 64) / 2];
101 *fr
= deposit64(*fr
, val
, (n
& 1 ? 0 : 32), 32);
110 return sizeof(target_ulong
);