@@ -52,6 +52,8 @@ void create_parser(QCommandLineParser &p) {
5252 p.addOption ({ { " trace-pc" , " tr-pc" }, " Print program counter register changes." });
5353 p.addOption ({ { " trace-wrmem" , " tr-wr" }, " Trace writes into memory." });
5454 p.addOption ({ { " trace-rdmem" , " tr-rd" }, " Trace reads from memory." });
55+ p.addOption ({ { " trace-exception" , " tr-excpt" }, " Trace exceptions." });
56+ p.addOption ({ { " trace-mode-change" , " tr-mode" }, " Trace mode changes." });
5557 p.addOption (
5658 { { " trace-gp" , " tr-gp" },
5759 " Print general purpose register changes. You can use * for "
@@ -120,6 +122,9 @@ void create_parser(QCommandLineParser &p) {
120122 p.addOption (
121123 { { " isa-variant" , " isavariant" }, " Instruction set to emulate (default RV32IMA)" , " STR" });
122124 p.addOption ({ " cycle-limit" , " Limit execution to specified maximum clock cycles" , " NUMBER" });
125+ p.addOption ({ " enable-vm" , " Enable virtual memory support." });
126+ p.addOption ({ " enable-exception" , " Enable exception delivery to the run code." });
127+ p.addOption ({ " enable-interrupt" , " Enable interrupts delivery to the run code." });
123128}
124129
125130void configure_cache (CacheConfig &cacheconf, const QStringList &cachearg, const QString &which) {
@@ -343,6 +348,7 @@ void configure_machine(QCommandLineParser &parser, MachineConfig &config) {
343348 config.modify_isa_word (flag, flag);
344349 }
345350 }
351+ config.set_vm_enabled (parser.isSet (" enable-vm" ));
346352}
347353
348354void configure_tracer (QCommandLineParser &p, Tracer &tr) {
@@ -375,6 +381,8 @@ void configure_tracer(QCommandLineParser &p, Tracer &tr) {
375381
376382 if (p.isSet (" trace-rdmem" )) { tr.trace_rdmem = true ; }
377383 if (p.isSet (" trace-wrmem" )) { tr.trace_wrmem = true ; }
384+ if (p.isSet (" trace-exception" )) { tr.trace_exception = true ; }
385+ if (p.isSet (" trace-mode-change" )) { tr.trace_mode_change = true ; }
378386
379387 QStringList clim = p.values (" cycle-limit" );
380388 if (!clim.empty ()) {
@@ -527,6 +535,24 @@ void configure_osemu(QCommandLineParser &p, MachineConfig &config, Machine *mach
527535 exit (EXIT_FAILURE );
528536 }
529537 }
538+
539+ if (p.isSet (" enable-exception" )) {
540+ config.set_osemu_exception_stop (false );
541+ for (int excause = EXCAUSE_NONE + 1 ; excause < EXCAUSE_COUNT ; excause++) {
542+ if (excause != EXCAUSE_INT_M && excause != EXCAUSE_INT_S ) {
543+ machine->set_step_over_exception (static_cast <ExceptionCause>(excause), false );
544+ machine->set_stop_on_exception (static_cast <ExceptionCause>(excause), false );
545+ }
546+ }
547+ }
548+ if (p.isSet (" enable-interrupt" )) {
549+ config.set_osemu_interrupt_stop (false );
550+ machine->set_step_over_exception (EXCAUSE_INT_M , false );
551+ machine->set_step_over_exception (EXCAUSE_INT_S , false );
552+ machine->set_stop_on_exception (EXCAUSE_INT_M , false );
553+ machine->set_stop_on_exception (EXCAUSE_INT_S , false );
554+ }
555+
530556 const static machine::ExceptionCause ecall_variats[]
531557 = { machine::EXCAUSE_ECALL_ANY , machine::EXCAUSE_ECALL_M , machine::EXCAUSE_ECALL_S ,
532558 machine::EXCAUSE_ECALL_U };
0 commit comments