diff options
author | Rupert Swarbrick <rswarbrick@gmail.com> | 2022-02-19 00:02:11 +0000 |
---|---|---|
committer | Rupert Swarbrick <rswarbrick@gmail.com> | 2022-03-18 15:30:41 +0000 |
commit | b742ddc66fd4ccb6cec98cbd8ebb705fe93ca735 (patch) | |
tree | a5c2f32b7c7996732f72b8142971610eb68f2a67 /riscv/sim.h | |
parent | 1fea2afbf46d2641d77f2db3d6108e0897431a84 (diff) | |
download | spike-b742ddc66fd4ccb6cec98cbd8ebb705fe93ca735.zip spike-b742ddc66fd4ccb6cec98cbd8ebb705fe93ca735.tar.gz spike-b742ddc66fd4ccb6cec98cbd8ebb705fe93ca735.tar.bz2 |
Initial step towards factoring out command line configuration
This commit defines a "cfg_t" structure, which currently just holds
the initrd address range. It will be augmented in future commits to
hold other configuration arguments as well.
To represent a configuration argument, we define an arg_t base class.
This holds a current value, together with a flag that tells us whether
the value has been updated from the default. The idea is that in
future we're going to use that flag when reading a DTB file: if an
argument has actually been specified on the command line, we need to
take it into account; if not, we can ignore the default and use the
DTB file's supplied value.
Diffstat (limited to 'riscv/sim.h')
-rw-r--r-- | riscv/sim.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/riscv/sim.h b/riscv/sim.h index 518d75e..31c9254 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -11,6 +11,7 @@ #include <boost/asio.hpp> #endif +#include "cfg.h" #include "debug_module.h" #include "devices.h" #include "log_file.h" @@ -31,9 +32,9 @@ class remote_bitbang_t; class sim_t : public htif_t, public simif_t { public: - sim_t(const char* isa, const char* priv, const char* varch, size_t _nprocs, - bool halted, bool real_time_clint, - reg_t initrd_start, reg_t initrd_end, const char* bootargs, + sim_t(const cfg_t *cfg, + const char* isa, const char* priv, const char* varch, size_t _nprocs, + bool halted, bool real_time_clint, const char* bootargs, reg_t start_pc, std::vector<std::pair<reg_t, mem_t*>> mems, std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices, const std::vector<std::string>& args, const std::vector<int> hartids, @@ -71,12 +72,12 @@ public: private: isa_parser_t isa; + const cfg_t * const cfg; std::vector<std::pair<reg_t, mem_t*>> mems; std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices; mmu_t* debug_mmu; // debug port into main memory std::vector<processor_t*> procs; - reg_t initrd_start; - reg_t initrd_end; + std::pair<reg_t, reg_t> initrd_range; const char* bootargs; reg_t start_pc; std::string dts; |