refactor: drop internal difftest support
This commit is contained in:
parent
f852ee8689
commit
422ff9e006
21 changed files with 192 additions and 433 deletions
|
@ -13,20 +13,19 @@
|
|||
* See the Mulan PSL v2 for more details.
|
||||
***************************************************************************************/
|
||||
|
||||
#include <utils.h>
|
||||
#include <cpu/ifetch.h>
|
||||
#include <difftest.h>
|
||||
#include <isa.h>
|
||||
#include <cpu/difftest.h>
|
||||
#include <utils.h>
|
||||
|
||||
void set_nemu_state(int state, vaddr_t pc, int halt_ret) {
|
||||
difftest_skip_ref();
|
||||
nemu_do_difftest = false;
|
||||
nemu_state.state = state;
|
||||
nemu_state.halt_pc = pc;
|
||||
nemu_state.halt_ret = halt_ret;
|
||||
}
|
||||
|
||||
__attribute__((noinline))
|
||||
void invalid_inst(vaddr_t thispc) {
|
||||
__attribute__((noinline)) void invalid_inst(vaddr_t thispc) {
|
||||
uint32_t temp[2];
|
||||
vaddr_t pc = thispc;
|
||||
temp[0] = inst_fetch(&pc, 4);
|
||||
|
@ -34,18 +33,24 @@ void invalid_inst(vaddr_t thispc) {
|
|||
|
||||
uint8_t *p = (uint8_t *)temp;
|
||||
printf("invalid opcode(PC = " FMT_WORD "):\n"
|
||||
"\t%02x %02x %02x %02x %02x %02x %02x %02x ...\n"
|
||||
"\t%08x %08x...\n",
|
||||
thispc, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], temp[0], temp[1]);
|
||||
"\t%02x %02x %02x %02x %02x %02x %02x %02x ...\n"
|
||||
"\t%08x %08x...\n",
|
||||
thispc, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], temp[0],
|
||||
temp[1]);
|
||||
|
||||
printf("There are two cases which will trigger this unexpected exception:\n"
|
||||
"1. The instruction at PC = " FMT_WORD " is not implemented.\n"
|
||||
"2. Something is implemented incorrectly.\n", thispc);
|
||||
printf("Find this PC(" FMT_WORD ") in the disassembling result to distinguish which case it is.\n\n", thispc);
|
||||
"1. The instruction at PC = " FMT_WORD " is not implemented.\n"
|
||||
"2. Something is implemented incorrectly.\n",
|
||||
thispc);
|
||||
printf("Find this PC(" FMT_WORD
|
||||
") in the disassembling result to distinguish which case it is.\n\n",
|
||||
thispc);
|
||||
printf(ANSI_FMT("If it is the first case, see\n%s\nfor more details.\n\n"
|
||||
"If it is the second case, remember:\n"
|
||||
"* The machine is always right!\n"
|
||||
"* Every line of untested code is always wrong!\n\n", ANSI_FG_RED), isa_logo);
|
||||
"If it is the second case, remember:\n"
|
||||
"* The machine is always right!\n"
|
||||
"* Every line of untested code is always wrong!\n\n",
|
||||
ANSI_FG_RED),
|
||||
isa_logo);
|
||||
|
||||
set_nemu_state(NEMU_ABORT, thispc, -1);
|
||||
}
|
||||
|
|
|
@ -17,17 +17,22 @@
|
|||
#include <cpu/cpu.h>
|
||||
#include <gdbstub.h>
|
||||
|
||||
void sdb_mainloop();
|
||||
int gdbstub_loop();
|
||||
extern bool enable_gdbstub;
|
||||
|
||||
void engine_start() {
|
||||
#ifdef CONFIG_TARGET_AM
|
||||
cpu_exec(-1);
|
||||
#else
|
||||
/* Receive commands from user. */
|
||||
int nemu_gdbstub_run();
|
||||
if (nemu_gdbstub_run()) {
|
||||
Error("gdbstub exited abnormally");
|
||||
exit(1);
|
||||
int ret = 0;
|
||||
if (enable_gdbstub) {
|
||||
if ((ret = gdbstub_loop())) {
|
||||
Error("gdbstub exited abnormally");
|
||||
exit(ret);
|
||||
}
|
||||
} else {
|
||||
cpu_exec(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue