diff options
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/NewDialog.ui | 47 | ||||
-rw-r--r-- | qtmips_gui/mainwindow.cpp | 20 | ||||
-rw-r--r-- | qtmips_gui/newdialog.cpp | 32 | ||||
-rw-r--r-- | qtmips_gui/newdialog.h | 5 |
4 files changed, 96 insertions, 8 deletions
diff --git a/qtmips_gui/NewDialog.ui b/qtmips_gui/NewDialog.ui index 411b075..1189e21 100644 --- a/qtmips_gui/NewDialog.ui +++ b/qtmips_gui/NewDialog.ui @@ -305,9 +305,52 @@ </attribute> <layout class="QVBoxLayout" name="verticalLayout_7"> <item> - <widget class="QCheckBox" name="osemu_enablecheck"> + <widget class="QCheckBox" name="osemu_enable"> <property name="text"> - <string>Enable OS Emulation</string> + <string>Enable emulation of operating system services</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="osemu_known_syscall_stop"> + <property name="text"> + <string>Stop on known system call</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="osemu_unknown_syscall_stop"> + <property name="text"> + <string>Stop on unknown system call</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="osemu_interrupt_stop"> + <property name="text"> + <string>Stop on interrupt entry</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="osemu_exception_stop"> + <property name="text"> + <string>Stop and step over exceptions (overflow, etc.)</string> + </property> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index 3cefe94..d6d0b35 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -153,13 +153,21 @@ void MainWindow::create_core(const machine::MachineConfig &config) { set_speed(); // Update machine speed to current settings -#if 1 - osemu::OsSyscallExceptionHandler *osemu_handler = new osemu::OsSyscallExceptionHandler; - machine->register_exception_handler(machine::EXCAUSE_SYSCALL, osemu_handler); - connect(osemu_handler, SIGNAL(char_written(int,uint)), terminal, SLOT(tx_byte(int,uint))); - connect(osemu_handler, SIGNAL(rx_byte_pool(int,uint&,bool&)), + if (config.osemu_enable()) { + osemu::OsSyscallExceptionHandler *osemu_handler = + new osemu::OsSyscallExceptionHandler(config.osemu_known_syscall_stop(), + config.osemu_unknown_syscall_stop()); + machine->register_exception_handler(machine::EXCAUSE_SYSCALL, osemu_handler); + connect(osemu_handler, SIGNAL(char_written(int,uint)), terminal, SLOT(tx_byte(int,uint))); + connect(osemu_handler, SIGNAL(rx_byte_pool(int,uint&,bool&)), terminal, SLOT(rx_byte_pool(int,uint&,bool&))); -#endif + machine->set_step_over_exception(machine::EXCAUSE_SYSCALL, true); + machine->set_stop_on_exception(machine::EXCAUSE_SYSCALL, false); + } else { + machine->set_step_over_exception(machine::EXCAUSE_SYSCALL, false); + machine->set_stop_on_exception(machine::EXCAUSE_SYSCALL, + config.osemu_exception_stop()); + } // Connect machine signals and slots connect(ui->actionRun, SIGNAL(triggered(bool)), machine, SLOT(play())); diff --git a/qtmips_gui/newdialog.cpp b/qtmips_gui/newdialog.cpp index 3e37357..53b2a05 100644 --- a/qtmips_gui/newdialog.cpp +++ b/qtmips_gui/newdialog.cpp @@ -72,6 +72,12 @@ NewDialog::NewDialog(QWidget *parent, QSettings *settings) : QDialog(parent) { connect(ui->mem_time_write, SIGNAL(valueChanged(int)), this, SLOT(mem_time_write_change(int))); connect(ui->mem_time_burst, SIGNAL(valueChanged(int)), this, SLOT(mem_time_burst_change(int))); + connect(ui->osemu_enable, SIGNAL(clicked(bool)), this, SLOT(osemu_enable_change(bool))); + connect(ui->osemu_known_syscall_stop, SIGNAL(clicked(bool)), this, SLOT(osemu_known_syscall_stop_change(bool))); + connect(ui->osemu_unknown_syscall_stop, SIGNAL(clicked(bool)), this, SLOT(osemu_unknown_syscall_stop_change(bool))); + connect(ui->osemu_interrupt_stop, SIGNAL(clicked(bool)), this, SLOT(osemu_interrupt_stop_change(bool))); + connect(ui->osemu_exception_stop, SIGNAL(clicked(bool)), this, SLOT(osemu_exception_stop_change(bool))); + cache_handler_d = new NewDialogCacheHandler(this, ui_cache_d); cache_handler_p = new NewDialogCacheHandler(this, ui_cache_p); @@ -196,6 +202,26 @@ void NewDialog::mem_time_burst_change(int v) { } } +void NewDialog::osemu_enable_change(bool v) { + config->set_osemu_enable(v); +} + +void NewDialog::osemu_known_syscall_stop_change(bool v) { + config->set_osemu_known_syscall_stop(v); +} + +void NewDialog::osemu_unknown_syscall_stop_change(bool v) { + config->set_osemu_unknown_syscall_stop(v); +} + +void NewDialog::osemu_interrupt_stop_change(bool v) { + config->set_osemu_interrupt_stop(v); +} + +void NewDialog::osemu_exception_stop_change(bool v) { + config->set_osemu_exception_stop(v); +} + void NewDialog::config_gui() { // Basic ui->elf_file->setText(config->elf()); @@ -214,6 +240,12 @@ void NewDialog::config_gui() { // Cache cache_handler_d->config_gui(); cache_handler_p->config_gui(); + // Operating system and exceptions + ui->osemu_enable->setChecked(config->osemu_enable()); + ui->osemu_known_syscall_stop->setChecked(config->osemu_known_syscall_stop()); + ui->osemu_unknown_syscall_stop->setChecked(config->osemu_unknown_syscall_stop()); + ui->osemu_interrupt_stop->setChecked(config->osemu_interrupt_stop()); + ui->osemu_exception_stop->setChecked(config->osemu_exception_stop()); // Disable various sections according to configuration ui->delay_slot->setEnabled(!config->pipelined()); diff --git a/qtmips_gui/newdialog.h b/qtmips_gui/newdialog.h index 2b1b7c4..edd633e 100644 --- a/qtmips_gui/newdialog.h +++ b/qtmips_gui/newdialog.h @@ -70,6 +70,11 @@ private slots: void mem_time_read_change(int); void mem_time_write_change(int); void mem_time_burst_change(int); + void osemu_enable_change(bool); + void osemu_known_syscall_stop_change(bool); + void osemu_unknown_syscall_stop_change(bool); + void osemu_interrupt_stop_change(bool); + void osemu_exception_stop_change(bool); private: Ui::NewDialog *ui; |