From fc3571602f19d86ca86c25dd204f8662782e62d6 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sat, 9 Mar 2019 20:37:54 +0100 Subject: 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 --- qtmips_machine/machineconfig.cpp | 17 +++++++++++++++++ qtmips_machine/machineconfig.h | 3 +++ 2 files changed, 20 insertions(+) (limited to 'qtmips_machine') 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; }; -- cgit v1.2.3