diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-09 20:37:54 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-09 20:37:54 +0100 |
commit | fc3571602f19d86ca86c25dd204f8662782e62d6 (patch) | |
tree | c9dad1178486fe87c4f452f08eb9de5e4998d40f /qtmips_gui | |
parent | 3360c7a27865f16441d744fd4559a30e5b5dd7db (diff) | |
download | qtmips-fc3571602f19d86ca86c25dd204f8662782e62d6.tar.gz qtmips-fc3571602f19d86ca86c25dd204f8662782e62d6.tar.bz2 qtmips-fc3571602f19d86ca86c25dd204f8662782e62d6.zip |
Updated read and write, added open, close, ftruncate syscalls and fs_root option.
When operating system emulation root directory (fs_root) are selected
then open() syscall opens real host system files in this limited
subtree. When fs_root is not set then console is mapped to all
read, write, open and close calls.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/NewDialog.ui | 21 | ||||
-rw-r--r-- | qtmips_gui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | qtmips_gui/newdialog.cpp | 22 | ||||
-rw-r--r-- | qtmips_gui/newdialog.h | 3 |
4 files changed, 48 insertions, 1 deletions
diff --git a/qtmips_gui/NewDialog.ui b/qtmips_gui/NewDialog.ui index 1189e21..b494ffa 100644 --- a/qtmips_gui/NewDialog.ui +++ b/qtmips_gui/NewDialog.ui @@ -355,6 +355,27 @@ </widget> </item> <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_fs_root"> + <property name="text"> + <string>Filesystem root:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="osemu_fs_root"/> + </item> + <item> + <widget class="QPushButton" name="osemu_fs_root_browse"> + <property name="text"> + <string>Browse</string> + </property> + </widget> + </item> + </layout> + </item> + <item> <spacer name="verticalSpacer_4"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index d6d0b35..2c9883d 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -156,7 +156,8 @@ void MainWindow::create_core(const machine::MachineConfig &config) { if (config.osemu_enable()) { osemu::OsSyscallExceptionHandler *osemu_handler = new osemu::OsSyscallExceptionHandler(config.osemu_known_syscall_stop(), - config.osemu_unknown_syscall_stop()); + config.osemu_unknown_syscall_stop(), + config.osemu_fs_root()); 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&)), diff --git a/qtmips_gui/newdialog.cpp b/qtmips_gui/newdialog.cpp index 53b2a05..67d3f1d 100644 --- a/qtmips_gui/newdialog.cpp +++ b/qtmips_gui/newdialog.cpp @@ -55,6 +55,7 @@ NewDialog::NewDialog(QWidget *parent, QSettings *settings) : QDialog(parent) { connect(ui->pushButton_load, SIGNAL(clicked(bool)), this, SLOT(create())); connect(ui->pushButton_cancel, SIGNAL(clicked(bool)), this, SLOT(cancel())); connect(ui->pushButton_browse, SIGNAL(clicked(bool)), this, SLOT(browse_elf())); + connect(ui->elf_file, SIGNAL(textChanged(QString)), this, SLOT(elf_change(QString))); connect(ui->preset_no_pipeline, SIGNAL(toggled(bool)), this, SLOT(set_preset())); connect(ui->preset_no_pipeline_cache, SIGNAL(toggled(bool)), this, SLOT(set_preset())); connect(ui->preset_pipelined_bare, SIGNAL(toggled(bool)), this, SLOT(set_preset())); @@ -77,6 +78,8 @@ NewDialog::NewDialog(QWidget *parent, QSettings *settings) : QDialog(parent) { 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))); + connect(ui->osemu_fs_root_browse, SIGNAL(clicked(bool)), this, SLOT(browse_osemu_fs_root())); + connect(ui->osemu_fs_root, SIGNAL(textChanged(QString)), this, SLOT(osemu_fs_root_change(QString))); cache_handler_d = new NewDialogCacheHandler(this, ui_cache_d); cache_handler_p = new NewDialogCacheHandler(this, ui_cache_p); @@ -144,6 +147,10 @@ void NewDialog::browse_elf() { // Elf shouldn't have any other effect so we skip config_gui here } +void NewDialog::elf_change(QString val) { + config->set_elf(val); +} + void NewDialog::set_preset() { unsigned pres_n = preset_number(); if (pres_n > 0) { @@ -222,6 +229,20 @@ void NewDialog::osemu_exception_stop_change(bool v) { config->set_osemu_exception_stop(v); } +void NewDialog::browse_osemu_fs_root() { + QFileDialog osemu_fs_root_dialog(this); + osemu_fs_root_dialog.setFileMode(QFileDialog::DirectoryOnly); + if (osemu_fs_root_dialog.exec()) { + QString path = osemu_fs_root_dialog.selectedFiles()[0]; + ui->osemu_fs_root->setText(path); + config->set_osemu_fs_root(path); + } +} + +void NewDialog::osemu_fs_root_change(QString val) { + config->set_osemu_fs_root(val); +} + void NewDialog::config_gui() { // Basic ui->elf_file->setText(config->elf()); @@ -246,6 +267,7 @@ void NewDialog::config_gui() { 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()); + ui->osemu_fs_root->setText(config->osemu_fs_root()); // 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 edd633e..6e6ed8a 100644 --- a/qtmips_gui/newdialog.h +++ b/qtmips_gui/newdialog.h @@ -61,6 +61,7 @@ private slots: void cancel(); void create(); void browse_elf(); + void elf_change(QString val); void set_preset(); void pipelined_change(bool); void delay_slot_change(bool); @@ -75,6 +76,8 @@ private slots: void osemu_unknown_syscall_stop_change(bool); void osemu_interrupt_stop_change(bool); void osemu_exception_stop_change(bool); + void browse_osemu_fs_root(); + void osemu_fs_root_change(QString val); private: Ui::NewDialog *ui; |