> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 1 12:35:11 UTC 2024 x86_64 GNU/Linux 16:10:36 up 5:46, 2 users, load average: 0.80, 0.80, 0.57
This commit is contained in:
parent
bdd1069c6e
commit
c34f132985
3 changed files with 21 additions and 12 deletions
|
@ -74,4 +74,7 @@ uint64_t get_time();
|
|||
} while (0)
|
||||
|
||||
|
||||
IFDEF(CONFIG_ITRACE, void log_itrace_print());
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* See the Mulan PSL v2 for more details.
|
||||
***************************************************************************************/
|
||||
|
||||
#include "utils.h"
|
||||
#include <cpu/cpu.h>
|
||||
#include <cpu/decode.h>
|
||||
#include <cpu/difftest.h>
|
||||
|
@ -29,9 +30,8 @@ CPU_state cpu = {};
|
|||
uint64_t g_nr_guest_inst = 0;
|
||||
static uint64_t g_timer = 0; // unit: us
|
||||
static bool g_print_step = false;
|
||||
|
||||
IFDEF(CONFIG_ITRACE, char logbuf[CONFIG_ITRACE_BUFFER][128]);
|
||||
IFDEF(CONFIG_ITRACE, int logbuf_rear);
|
||||
IFDEF(CONFIG_ITRACE, extern char logbuf[CONFIG_ITRACE_BUFFER][128]);
|
||||
IFDEF(CONFIG_ITRACE, extern int logbuf_rear);
|
||||
|
||||
void device_update();
|
||||
bool wp_eval_all();
|
||||
|
@ -132,16 +132,10 @@ void cpu_exec(uint64_t n) {
|
|||
ANSI_FMT("HIT BAD TRAP", ANSI_FG_RED))),
|
||||
nemu_state.halt_pc);
|
||||
nemu_state.halt_ret = 1;
|
||||
#ifdef CONFIG_ITRACE
|
||||
if (nemu_state.halt_ret != 0) {
|
||||
puts("ITRACE buffer:");
|
||||
for (int i = (logbuf_rear + 1) % CONFIG_ITRACE_BUFFER; i != logbuf_rear; i = (i + 1) % CONFIG_ITRACE_BUFFER) {
|
||||
puts(logbuf[i]);
|
||||
}
|
||||
if(nemu_state.halt_ret != 0) {
|
||||
log_itrace_print();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// fall through
|
||||
} // fall through
|
||||
case NEMU_QUIT: statistic();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,3 +35,15 @@ bool log_enable() {
|
|||
(g_nr_guest_inst <= CONFIG_TRACE_END), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
IFDEF(CONFIG_ITRACE, char logbuf[CONFIG_ITRACE_BUFFER][128]);
|
||||
IFDEF(CONFIG_ITRACE, int logbuf_rear);
|
||||
|
||||
#ifdef CONFIG_ITRACE
|
||||
void log_itrace_print() {
|
||||
puts("ITRACE buffer:");
|
||||
for (int i = (logbuf_rear + 1) % CONFIG_ITRACE_BUFFER; i != logbuf_rear; i = (i + 1) % CONFIG_ITRACE_BUFFER) {
|
||||
puts(logbuf[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue