]>
git.proxmox.com Git - mirror_qemu.git/blob - target/tricore/gdbstub.c
2 * TriCore gdb server stub
4 * Copyright (c) 2019 Bastian Koppelmann, Paderborn University
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.1 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 "gdbstub/helpers.h"
27 #define PCXI_REGNUM 34
28 #define TRICORE_PSW_REGNUM 35
29 #define TRICORE_PC_REGNUM 36
34 #define SYSCON_REGNUM 41
35 #define PMUCON0_REGNUM 42
36 #define DMUCON_REGNUM 43
38 static uint32_t tricore_cpu_gdb_read_csfr(CPUTriCoreState
*env
, int n
)
47 case TRICORE_PSW_REGNUM
:
49 case TRICORE_PC_REGNUM
:
62 return 0; /* PMUCON0 */
64 return 0; /* DMUCON0 */
70 static void tricore_cpu_gdb_write_csfr(CPUTriCoreState
*env
, int n
,
83 case TRICORE_PSW_REGNUM
:
86 case TRICORE_PC_REGNUM
:
108 int tricore_cpu_gdb_read_register(CPUState
*cs
, GByteArray
*mem_buf
, int n
)
110 CPUTriCoreState
*env
= cpu_env(cs
);
112 if (n
< 16) { /* data registers */
113 return gdb_get_reg32(mem_buf
, env
->gpr_d
[n
]);
114 } else if (n
< 32) { /* address registers */
115 return gdb_get_reg32(mem_buf
, env
->gpr_a
[n
- 16]);
117 return gdb_get_reg32(mem_buf
, tricore_cpu_gdb_read_csfr(env
, n
));
122 int tricore_cpu_gdb_write_register(CPUState
*cs
, uint8_t *mem_buf
, int n
)
124 CPUTriCoreState
*env
= cpu_env(cs
);
127 tmp
= ldl_p(mem_buf
);
129 if (n
< 16) { /* data registers */
131 } else if (n
< 32) { /* address registers */
132 env
->gpr_a
[n
- 16] = tmp
;
134 tricore_cpu_gdb_write_csfr(env
, n
, tmp
);