> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.1.75 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 25 23:27:52 UTC 2024 x86_64 GNU/Linux 19:25:40 up 1 day 5:01, 2 users, load average: 1.09, 0.92, 0.80
This commit is contained in:
parent
53baebe06d
commit
0531eb060a
2 changed files with 7 additions and 4 deletions
|
@ -31,7 +31,7 @@ static uint64_t g_timer = 0; // unit: us
|
||||||
static bool g_print_step = false;
|
static bool g_print_step = false;
|
||||||
|
|
||||||
void device_update();
|
void device_update();
|
||||||
void wp_eval_all();
|
bool wp_eval_all();
|
||||||
|
|
||||||
static void trace_and_difftest(Decode *_this, vaddr_t dnpc) {
|
static void trace_and_difftest(Decode *_this, vaddr_t dnpc) {
|
||||||
#ifdef CONFIG_ITRACE_COND
|
#ifdef CONFIG_ITRACE_COND
|
||||||
|
@ -78,6 +78,8 @@ static void execute(uint64_t n) {
|
||||||
exec_once(&s, cpu.pc);
|
exec_once(&s, cpu.pc);
|
||||||
g_nr_guest_inst ++;
|
g_nr_guest_inst ++;
|
||||||
trace_and_difftest(&s, cpu.pc);
|
trace_and_difftest(&s, cpu.pc);
|
||||||
|
if (wp_eval_all()) break;
|
||||||
|
|
||||||
if (nemu_state.state != NEMU_RUNNING) break;
|
if (nemu_state.state != NEMU_RUNNING) break;
|
||||||
IFDEF(CONFIG_DEVICE, device_update());
|
IFDEF(CONFIG_DEVICE, device_update());
|
||||||
}
|
}
|
||||||
|
@ -114,8 +116,6 @@ void cpu_exec(uint64_t n) {
|
||||||
uint64_t timer_end = get_time();
|
uint64_t timer_end = get_time();
|
||||||
g_timer += timer_end - timer_start;
|
g_timer += timer_end - timer_start;
|
||||||
|
|
||||||
wp_eval_all();
|
|
||||||
|
|
||||||
switch (nemu_state.state) {
|
switch (nemu_state.state) {
|
||||||
case NEMU_RUNNING: nemu_state.state = NEMU_STOP; break;
|
case NEMU_RUNNING: nemu_state.state = NEMU_STOP; break;
|
||||||
|
|
||||||
|
|
|
@ -136,12 +136,15 @@ static bool wp_check_change(WP* wp) {
|
||||||
/*
|
/*
|
||||||
Check if watchpoint value changed after execution
|
Check if watchpoint value changed after execution
|
||||||
*/
|
*/
|
||||||
void wp_eval_all() {
|
bool wp_eval_all() {
|
||||||
WP *wp;
|
WP *wp;
|
||||||
|
bool value_change = false;
|
||||||
for (wp = head; wp != NULL; wp = wp->next) {
|
for (wp = head; wp != NULL; wp = wp->next) {
|
||||||
int prev_val = wp->val;
|
int prev_val = wp->val;
|
||||||
if (wp_check_change(wp)) {
|
if (wp_check_change(wp)) {
|
||||||
printf("Watchpoint %d: %s\n %u -> %u\n", wp->NO, wp->expr, prev_val, wp->val);
|
printf("Watchpoint %d: %s\n %u -> %u\n", wp->NO, wp->expr, prev_val, wp->val);
|
||||||
|
value_change = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return value_change;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue