e2k: v8.1.3 fixes

This commit is contained in:
Denis Drakhnia 2023-12-06 18:00:31 +02:00
parent d15261fdd1
commit d0f51e05de
10 changed files with 200 additions and 810 deletions

View File

@ -1516,12 +1516,6 @@ static void handle_query_supported(GArray *params, void *user_ctx)
gdbserver_state.multiprocess = true;
}
#ifdef TARGET_E2K
// TODO: qXfer:tags:write+
// TODO: qXfer:packed_tags:read+
g_string_append(gdbserver_state.str_buf, ";qXfer:tags:read+");
#endif
g_string_append(gdbserver_state.str_buf, ";vContSupported+;multiprocess+");
gdb_put_strbuf();
}
@ -1587,32 +1581,6 @@ static void handle_query_qemu_supported(GArray *params, void *user_ctx)
gdb_put_strbuf();
}
#ifdef TARGET_E2K
static void handle_query_e2k_tags_read(GArray *params, void *user_ctx)
{
E2KCPU *cpu = E2K_CPU(gdbserver_state.g_cpu);
CPUE2KState *env = &cpu->env;
target_ulong addr = get_param(params, 0)->val_ull;
unsigned long len = get_param(params, 1)->val_ul;
unsigned int i;
int tags = 0;
g_string_assign(gdbserver_state.str_buf, "l");
if (env->psp.base <= addr && addr < (env->psp.base + env->psp.size)) {
target_ulong offset = addr - env->psp.base;
tags = cpu_ldub_data(env, env->psp.base_tag + offset / 8);
}
for (i = 0; i < len; i++) {
int tag = (tags >> (i * 2)) & 0x3;
g_string_append_c(gdbserver_state.str_buf, tag);
}
put_packet_binary(gdbserver_state.str_buf->str,
gdbserver_state.str_buf->len, true);
}
#endif
static const GdbCmdParseEntry gdb_gen_query_set_common_table[] = {
/* Order is important if has same prefix */
{
@ -1715,14 +1683,6 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = {
.cmd = "qemu.PhyMemMode",
},
#endif
#ifdef TARGET_E2K
{
.handler = handle_query_e2k_tags_read,
.cmd = "Xfer:tags:read::",
.cmd_startswith = 1,
.schema = "L,l0",
},
#endif
};
static const GdbCmdParseEntry gdb_gen_set_table[] = {

View File

@ -0,0 +1,33 @@
#ifndef LINUX_USER_E2K_TARGET_MMAN_H
#define LINUX_USER_E2K_TARGET_MMAN_H
#ifdef TARGET_E2K64
# define TARGET_TASK_SIZE 0xd00000000000UL
#else
# define TARGET_TASK_SIZE 0xf0000000UL
#endif
#define TASK_UNMAPPED_BASE TARGET_PAGE_ALIGN(TARGET_TASK_SIZE / 3)
#define ELF_ET_DYN_BASE (2 * TARGET_TASK_SIZE / 3)
#define TARGET_MAP_ANONYMOUS 0x000010 /* don't use a file */
#define TARGET_MAP_FIXED 0x000100 /* Interpret addr exactly */
#define TARGET_MAP_DENYWRITE 0x000800 /* ETXTBSY */
#define TARGET_MAP_GROWSDOWN 0x001000 /* stack-like segment */
#define TARGET_MAP_GROWSUP 0x002000 /* register stack-like segment */
#define TARGET_MAP_EXECUTABLE 0x004000 /* mark it as an executable */
#define TARGET_MAP_LOCKED 0x008000 /* pages are locked */
#define TARGET_MAP_NORESERVE 0x010000 /* don't check for reservations */
#define TARGET_MAP_POPULATE 0x020000 /* populate (prefault) pagetables */
#define TARGET_MAP_NONBLOCK 0x040000 /* do not block on IO */
#define TARGET_MAP_FIRST32 0x080000 /* in protected mode map in */
/* first 2 ** 32 area */
#define TARGET_MAP_WRITECOMBINED 0x100000 /* Write combine */
#define TARGET_MAP_HUGETLB 0x200000 /* create a huge page mapping */
#define TARGET_MAP_FIXED_NOREPLACE 0x400000 /* MAP_FIXED which doesn't unmap */
/* underlying mapping */
#define TARGET_MAP_STACK TARGET_MAP_GROWSDOWN
#include "../generic/target_mman.h"
#endif /* LINUX_USER_E2K_TARGET_MMAN_H */

View File

@ -65,14 +65,6 @@ struct target_pt_regs {
uint16_t gext[32];
};
// FIXME: Is it right place for these constants?
#if TARGET_LONG_BITS == 64
#define TARGET_PAGE_OFFSET 0x0000d00000000000UL
#define TARGET_TASK_SIZE TARGET_PAGE_OFFSET
#else
#define TARGET_TASK_SIZE 0xe0000000UL
#endif
/* modes for sys_access_hw_stacks */
enum {
READ_CHAIN_STACK,

View File

@ -15,6 +15,5 @@
#define TARGET_PAGE_BITS 12 /* 4k */
#define TARGET_PHYS_ADDR_SPACE_BITS 40
#define TARGET_VIRT_ADDR_SPACE_BITS 48
#define NB_MMU_MODES 4
#endif

View File

@ -147,6 +147,15 @@ static void e2k_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb
cpu->env.ip = tb->pc;
}
static void e2k_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb,
const uint64_t *data)
{
E2KCPU *cpu = E2K_CPU(cs);
CPUE2KState *env = &cpu->env;
env->ip = data[0];
}
static bool e2k_cpu_has_work(CPUState *cs)
{
// TODO: e2k_cpu_has_work
@ -223,6 +232,8 @@ static gchar* e2k_cpu_gdb_arch_name(CPUState *cs)
static struct TCGCPUOps e2k_tcg_ops = {
.initialize = e2k_tcg_initialize,
.synchronize_from_tb = e2k_cpu_synchronize_from_tb,
.restore_state_to_opc = e2k_restore_state_to_opc,
.do_interrupt = e2k_cpu_do_interrupt,
#ifdef CONFIG_SOFTMMU
.cpu_exec_interrupt = e2k_cpu_exec_interrupt,

View File

@ -925,8 +925,8 @@ struct ArchCPU {
CPUE2KState env;
};
static inline void cpu_get_tb_cpu_state(CPUE2KState *env, target_ulong *pc,
target_ulong *cs_base, uint32_t *pflags)
static inline void cpu_get_tb_cpu_state(CPUE2KState *env, vaddr *pc,
uint64_t *cs_base, uint32_t *pflags)
{
*pc = env->ip;
*cs_base = 0;

View File

@ -23,6 +23,7 @@
#include "cpu.h"
#include "helper-tcg.h"
#include "exec/gdbstub.h"
#include "gdbstub/helpers.h"
/* TODO: reverse engineer e2k-linux-gdb register ids */

View File

@ -62,7 +62,7 @@ target_ulong HELPER(mova_ptr)(CPUE2KState *env, int chan, int area, int ind,
void *ignore;
int flags;
flags = probe_access_flags(env, page, MMU_DATA_LOAD, mmu_idx,
flags = probe_access_flags(env, page, 0, MMU_DATA_LOAD, mmu_idx,
true, &ignore, 0);
as->last_page = page;
as->last_page_valid = !(flags & TLB_INVALID_MASK);

View File

@ -12,13 +12,13 @@ static int e2k_probe_access(CPUE2KState *env, target_ulong addr, int size,
int flags;
void *ignore;
flags = probe_access_flags(env, addr, access_type, mmu_idx,
flags = probe_access_flags(env, addr, 0, access_type, mmu_idx,
true, &ignore, 0);
if (flags & TLB_INVALID_MASK) {
return 0;
} else if ((addr & TARGET_PAGE_MASK) != (addr_end & TARGET_PAGE_MASK)) {
flags = probe_access_flags(env, addr_end, access_type, mmu_idx, true,
flags = probe_access_flags(env, addr_end, 0, access_type, mmu_idx, true,
&ignore, 0);
return !(flags & TLB_INVALID_MASK);
}

File diff suppressed because it is too large Load Diff