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"
26 #define PCXI_REGNUM 34
27 #define TRICORE_PSW_REGNUM 35
28 #define TRICORE_PC_REGNUM 36
33 #define SYSCON_REGNUM 41
34 #define PMUCON0_REGNUM 42
35 #define DMUCON_REGNUM 43
37 static uint32_t tricore_cpu_gdb_read_csfr(CPUTriCoreState
*env
, int n
)
46 case TRICORE_PSW_REGNUM
:
48 case TRICORE_PC_REGNUM
:
61 return 0; /* PMUCON0 */
63 return 0; /* DMUCON0 */
69 static void tricore_cpu_gdb_write_csfr(CPUTriCoreState
*env
, int n
,
82 case TRICORE_PSW_REGNUM
:
85 case TRICORE_PC_REGNUM
:
107 int tricore_cpu_gdb_read_register(CPUState
*cs
, GByteArray
*mem_buf
, int n
)
109 CPUTriCoreState
*env
= cpu_env(cs
);
111 if (n
< 16) { /* data registers */
112 return gdb_get_reg32(mem_buf
, env
->gpr_d
[n
]);
113 } else if (n
< 32) { /* address registers */
114 return gdb_get_reg32(mem_buf
, env
->gpr_a
[n
- 16]);
116 return gdb_get_reg32(mem_buf
, tricore_cpu_gdb_read_csfr(env
, n
));
121 int tricore_cpu_gdb_write_register(CPUState
*cs
, uint8_t *mem_buf
, int n
)
123 CPUTriCoreState
*env
= cpu_env(cs
);
126 tmp
= ldl_p(mem_buf
);
128 if (n
< 16) { /* data registers */
130 } else if (n
< 32) { /* address registers */
131 env
->gpr_a
[n
- 16] = tmp
;
133 tricore_cpu_gdb_write_csfr(env
, n
, tmp
);