aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-09 20:37:54 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-09 20:37:54 +0100
commitfc3571602f19d86ca86c25dd204f8662782e62d6 (patch)
treec9dad1178486fe87c4f452f08eb9de5e4998d40f /qtmips_machine
parent3360c7a27865f16441d744fd4559a30e5b5dd7db (diff)
downloadqtmips-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_machine')
-rw-r--r--qtmips_machine/machineconfig.cpp17
-rw-r--r--qtmips_machine/machineconfig.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/qtmips_machine/machineconfig.cpp b/qtmips_machine/machineconfig.cpp
index 36b376f..272a7a6 100644
--- a/qtmips_machine/machineconfig.cpp
+++ b/qtmips_machine/machineconfig.cpp
@@ -187,6 +187,12 @@ MachineConfig::MachineConfig() {
mem_acc_read = DF_MEM_ACC_READ;
mem_acc_write = DF_MEM_ACC_WRITE;
mem_acc_burst = DF_MEM_ACC_BURST;
+ osem_enable = true;
+ osem_known_syscall_stop = true;
+ osem_unknown_syscall_stop = true;
+ osem_interrupt_stop = true;
+ osem_exception_stop = true;
+ osem_fs_root = "";
elf_path = DF_ELF;
cch_program = MachineConfigCache();
cch_data = MachineConfigCache();
@@ -206,6 +212,7 @@ MachineConfig::MachineConfig(const MachineConfig *cc) {
osem_unknown_syscall_stop = cc->osemu_unknown_syscall_stop();
osem_interrupt_stop = cc->osemu_interrupt_stop();
osem_exception_stop = cc->osemu_exception_stop();
+ osem_fs_root = cc->osemu_fs_root();
elf_path = cc->elf();
cch_program = cc->cache_program();
cch_data = cc->cache_data();
@@ -227,6 +234,7 @@ MachineConfig::MachineConfig(const QSettings *sts, const QString &prefix) {
osem_unknown_syscall_stop = sts->value(N("OsemuUnknownSyscallStop"), true).toBool();
osem_interrupt_stop = sts->value(N("OsemuInterruptStop"), true).toBool();
osem_exception_stop = sts->value(N("OsemuExceptionStop"), true).toBool();
+ osem_fs_root = sts->value(N("OsemuFilesystemRoot"), "").toString();
elf_path = sts->value(N("Elf"), DF_ELF).toString();
cch_program = MachineConfigCache(sts, N("ProgramCache_"));
cch_data = MachineConfigCache(sts, N("DataCache_"));
@@ -244,6 +252,7 @@ void MachineConfig::store(QSettings *sts, const QString &prefix) {
sts->setValue(N("OsemuUnknownSyscallStop"), osemu_unknown_syscall_stop());
sts->setValue(N("OsemuInterruptStop"), osemu_interrupt_stop());
sts->setValue(N("OsemuExceptionStop"), osemu_exception_stop());
+ sts->setValue(N("OsemuFilesystemRoot"), osemu_fs_root());
sts->setValue(N("Elf"), elf_path);
cch_program.store(sts, N("ProgramCache_"));
cch_data.store(sts, N("DataCache_"));
@@ -331,6 +340,10 @@ void MachineConfig::set_osemu_exception_stop(bool v) {
osem_exception_stop = v;
}
+void MachineConfig::set_osemu_fs_root(QString v) {
+ osem_fs_root = v;
+}
+
void MachineConfig::set_elf(QString path) {
elf_path = path;
}
@@ -393,6 +406,10 @@ bool MachineConfig::osemu_exception_stop() const {
return osem_exception_stop;
}
+QString MachineConfig::osemu_fs_root() const {
+ return osem_fs_root;
+}
+
QString MachineConfig::elf() const {
return elf_path;
}
diff --git a/qtmips_machine/machineconfig.h b/qtmips_machine/machineconfig.h
index 9fbbf18..b8504b4 100644
--- a/qtmips_machine/machineconfig.h
+++ b/qtmips_machine/machineconfig.h
@@ -133,6 +133,7 @@ public:
void set_osemu_unknown_syscall_stop(bool);
void set_osemu_interrupt_stop(bool);
void set_osemu_exception_stop(bool);
+ void set_osemu_fs_root(QString v);
// Set path to source elf file. This has to be set before core is initialized.
void set_elf(QString path);
// Configure cache
@@ -152,6 +153,7 @@ public:
bool osemu_unknown_syscall_stop() const;
bool osemu_interrupt_stop() const;
bool osemu_exception_stop() const;
+ QString osemu_fs_root() const;
QString elf() const;
const MachineConfigCache &cache_program() const;
const MachineConfigCache &cache_data() const;
@@ -169,6 +171,7 @@ private:
unsigned mem_acc_read, mem_acc_write, mem_acc_burst;
bool osem_enable, osem_known_syscall_stop, osem_unknown_syscall_stop;
bool osem_interrupt_stop, osem_exception_stop;
+ QString osem_fs_root;
QString elf_path;
MachineConfigCache cch_program, cch_data;
};