]>
git.proxmox.com Git - qemu.git/blob - target-sh4/gdbstub.c
38bc630f3ae0e35dee5321d076c01bc8cec6ed0e
2 * SuperH gdb server stub
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 * Copyright (c) 2013 SUSE LINUX Products GmbH
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.
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.
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/>.
21 /* Hint: Use "set architecture sh4" in GDB to see fpu registers */
22 /* FIXME: We should use XML for this. */
24 static int cpu_gdb_read_register(CPUSH4State
*env
, uint8_t *mem_buf
, int n
)
28 if ((env
->sr
& (SR_MD
| SR_RB
)) == (SR_MD
| SR_RB
)) {
29 GET_REGL(env
->gregs
[n
+ 16]);
31 GET_REGL(env
->gregs
[n
]);
34 GET_REGL(env
->gregs
[n
]);
54 if (env
->fpscr
& FPSCR_FR
) {
55 stfl_p(mem_buf
, env
->fregs
[n
- 9]);
57 stfl_p(mem_buf
, env
->fregs
[n
- 25]);
65 GET_REGL(env
->gregs
[n
- 43]);
67 GET_REGL(env
->gregs
[n
- (51 - 16)]);
73 static int cpu_gdb_write_register(CPUSH4State
*env
, uint8_t *mem_buf
, int n
)
77 if ((env
->sr
& (SR_MD
| SR_RB
)) == (SR_MD
| SR_RB
)) {
78 env
->gregs
[n
+ 16] = ldl_p(mem_buf
);
80 env
->gregs
[n
] = ldl_p(mem_buf
);
84 env
->gregs
[n
] = ldl_p(mem_buf
);
87 env
->pc
= ldl_p(mem_buf
);
90 env
->pr
= ldl_p(mem_buf
);
93 env
->gbr
= ldl_p(mem_buf
);
96 env
->vbr
= ldl_p(mem_buf
);
99 env
->mach
= ldl_p(mem_buf
);
102 env
->macl
= ldl_p(mem_buf
);
105 env
->sr
= ldl_p(mem_buf
);
108 env
->fpul
= ldl_p(mem_buf
);
111 env
->fpscr
= ldl_p(mem_buf
);
114 if (env
->fpscr
& FPSCR_FR
) {
115 env
->fregs
[n
- 9] = ldfl_p(mem_buf
);
117 env
->fregs
[n
- 25] = ldfl_p(mem_buf
);
121 env
->ssr
= ldl_p(mem_buf
);
124 env
->spc
= ldl_p(mem_buf
);
127 env
->gregs
[n
- 43] = ldl_p(mem_buf
);
130 env
->gregs
[n
- (51 - 16)] = ldl_p(mem_buf
);