From 3582bab41908a649c975ae98ad97a0d84b48dcde Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 12 Oct 2017 12:07:11 -0700 Subject: Set impebreak. --- riscv/debug_module.cc | 9 ++++++++- riscv/debug_module.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc index b27fe35..981e991 100644 --- a/riscv/debug_module.cc +++ b/riscv/debug_module.cc @@ -26,6 +26,7 @@ debug_module_t::debug_module_t(sim_t *sim, unsigned progbufsize) : dmcontrol = {0}; dmstatus = {0}; + dmstatus.impebreak = true; dmstatus.authenticated = 1; dmstatus.version = 2; @@ -40,7 +41,10 @@ debug_module_t::debug_module_t(sim_t *sim, unsigned progbufsize) : memset(debug_rom_flags, 0, sizeof(debug_rom_flags)); memset(resumeack, 0, sizeof(resumeack)); memset(program_buffer, 0, program_buffer_bytes); - program_buffer[progbufsize] = ebreak(); + program_buffer[4*progbufsize] = ebreak(); + program_buffer[4*progbufsize+1] = ebreak() >> 8; + program_buffer[4*progbufsize+2] = ebreak() >> 16; + program_buffer[4*progbufsize+3] = ebreak() >> 24; memset(dmdata, 0, sizeof(dmdata)); write32(debug_rom_whereto, 0, @@ -65,6 +69,7 @@ void debug_module_t::reset() dmcontrol = {0}; dmstatus = {0}; + dmstatus.impebreak = true; dmstatus.authenticated = 1; dmstatus.version = 2; @@ -301,6 +306,8 @@ bool debug_module_t::dmi_read(unsigned address, uint32_t *value) dmstatus.allresumeack = false; } + result = set_field(result, DMI_DMSTATUS_IMPEBREAK, + dmstatus.impebreak); result = set_field(result, DMI_DMSTATUS_ALLNONEXISTENT, dmstatus.allnonexistant); result = set_field(result, DMI_DMSTATUS_ALLUNAVAIL, dmstatus.allunavail); result = set_field(result, DMI_DMSTATUS_ALLRUNNING, dmstatus.allrunning); diff --git a/riscv/debug_module.h b/riscv/debug_module.h index f6f2009..00c66cc 100644 --- a/riscv/debug_module.h +++ b/riscv/debug_module.h @@ -18,6 +18,7 @@ typedef struct { } dmcontrol_t; typedef struct { + bool impebreak; bool allnonexistant; bool anynonexistant; bool allunavail; -- cgit v1.1