target: e2k: initial gdb support
This commit is contained in:
parent
6bcd4980e9
commit
c7b6b7f8bf
@ -66,6 +66,27 @@ void cpu_loop(CPUE2KState *env)
|
||||
env->ip = env->nip;
|
||||
break;
|
||||
}
|
||||
/* QEMU common interrupts */
|
||||
case EXCP_INTERRUPT:
|
||||
/* just indicate that signals should be handled asap */
|
||||
break;
|
||||
case EXCP_DEBUG:
|
||||
{
|
||||
target_siginfo_t info;
|
||||
info.si_signo = TARGET_SIGTRAP;
|
||||
info.si_errno = 0;
|
||||
info.si_code = TARGET_TRAP_BRKPT;
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
break;
|
||||
}
|
||||
case EXCP_ATOMIC:
|
||||
cpu_exec_step_atomic(cs);
|
||||
break;
|
||||
case EXCP_HLT:
|
||||
case EXCP_HALTED:
|
||||
case EXCP_YIELD:
|
||||
fprintf(stderr, "Unhandled QEMU trap: 0x%x\n", trapnr);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
|
||||
cpu_dump_state(cs, stderr, 0);
|
||||
|
@ -224,6 +224,10 @@ static void e2k_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->class_by_name = e2k_cpu_class_by_name;
|
||||
cc->disas_set_info = cpu_e2k_disas_set_info;
|
||||
cc->tcg_initialize = e2k_tcg_initialize;
|
||||
|
||||
cc->gdb_read_register = e2k_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = e2k_cpu_gdb_write_register;
|
||||
cc->gdb_num_core_regs = 300; /* TODO: bogus value, depends on e2k-linux-gdb */
|
||||
}
|
||||
|
||||
static const TypeInfo e2k_cpu_type_info = {
|
||||
|
@ -266,6 +266,8 @@ static inline void cpu_get_tb_cpu_state(CPUE2KState *env, target_ulong *pc,
|
||||
}
|
||||
|
||||
int e2k_cpu_signal_handler(int host_signum, void *pinfo, void *puc);
|
||||
int e2k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n);
|
||||
int e2k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n);
|
||||
|
||||
#define cpu_signal_handler e2k_cpu_signal_handler
|
||||
|
||||
|
47
target/e2k/gdbstub.c
Normal file
47
target/e2k/gdbstub.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Elbrus 2000 gdb server stub
|
||||
*
|
||||
* Copyright (c) 2003-2005 Fabrice Bellard
|
||||
* Copyright (c) 2013 SUSE LINUX Products GmbH
|
||||
* Copyright (c) 2020 Alibek Omarov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/gdbstub.h"
|
||||
|
||||
/* TODO: reverse engineer e2k-linux-gdb register ids */
|
||||
|
||||
int e2k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
E2KCPU *cpu = E2K_CPU(cs);
|
||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||
CPUE2KState *env = &cpu->env;
|
||||
|
||||
fprintf(stderr, "%s: unknown register %d\n", __FUNCTION__, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int e2k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
E2KCPU *cpu = E2K_CPU(cs);
|
||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||
CPUE2KState *env = &cpu->env;
|
||||
|
||||
fprintf(stderr, "%s: unknown register %d\n", __FUNCTION__, n);
|
||||
|
||||
/* TODO */
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
e2k_ss = ss.source_set()
|
||||
e2k_ss.add(files(
|
||||
'cpu.c',
|
||||
'gdbstub.c',
|
||||
'helper.c',
|
||||
'helper_int.c',
|
||||
'translate.c',
|
||||
|
Loading…
Reference in New Issue
Block a user