]> git.proxmox.com Git - mirror_qemu.git/blame - target-m68k/gdbstub.c
target-xtensa: Move cpu_gdb_{read,write}_register()
[mirror_qemu.git] / target-m68k / gdbstub.c
CommitLineData
c88de14c
AF
1/*
2 * m68k gdb server stub
3 *
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 * Copyright (c) 2013 SUSE LINUX Products GmbH
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21static int cpu_gdb_read_register(CPUM68KState *env, uint8_t *mem_buf, int n)
22{
23 if (n < 8) {
24 /* D0-D7 */
25 GET_REG32(env->dregs[n]);
26 } else if (n < 16) {
27 /* A0-A7 */
28 GET_REG32(env->aregs[n - 8]);
29 } else {
30 switch (n) {
31 case 16:
32 GET_REG32(env->sr);
33 case 17:
34 GET_REG32(env->pc);
35 }
36 }
37 /* FP registers not included here because they vary between
38 ColdFire and m68k. Use XML bits for these. */
39 return 0;
40}
41
42static int cpu_gdb_write_register(CPUM68KState *env, uint8_t *mem_buf, int n)
43{
44 uint32_t tmp;
45
46 tmp = ldl_p(mem_buf);
47
48 if (n < 8) {
49 /* D0-D7 */
50 env->dregs[n] = tmp;
51 } else if (n < 16) {
52 /* A0-A7 */
53 env->aregs[n - 8] = tmp;
54 } else {
55 switch (n) {
56 case 16:
57 env->sr = tmp;
58 break;
59 case 17:
60 env->pc = tmp;
61 break;
62 default:
63 return 0;
64 }
65 }
66 return 4;
67}