30 #include "debug/Loader.hh" 31 #include "params/KernelWorkload.hh" 35 _loadAddrMask(p.load_addr_mask), _loadAddrOffset(p.load_addr_offset),
36 kernelSymtab(new
Loader::SymbolTable), commandLine(p.command_line)
38 if (
params().object_file ==
"") {
39 inform(
"No kernel set for full system simulation. " 40 "Assuming you know what you're doing.");
46 "Could not load kernel file %s",
params().object_file);
65 "Could not load kernel symbols.");
68 "Could not load kernel local symbols.");
71 "Could not load kernel symbols.");
74 "Could not load kernel local symbols.");
81 if (extras_addrs.empty())
82 extras_addrs.resize(p.extras.size(),
MaxAddr);
83 fatal_if(p.extras.size() != extras_addrs.size(),
84 "Additional kernel objects, not all load addresses specified\n");
85 for (
int ker_idx = 0; ker_idx < p.extras.size(); ker_idx++) {
86 const std::string &obj_name = p.extras[ker_idx];
87 const bool raw = extras_addrs[ker_idx] !=
MaxAddr;
89 fatal_if(!obj,
"Failed to build additional kernel object '%s'.\n",
107 auto mapper = [
this](
Addr a) {
110 if (
params().object_file !=
"") {
111 if (
params().addr_check) {
115 "Kernel is mapped to invalid location (not memory). " 116 "start (%#x) - end (%#x) %#x:%#x\n",
129 if (extras_addrs.empty())
131 for (
int idx = 0; idx <
extras.size(); idx++) {
132 const Addr load_addr = extras_addrs[idx];
155 KernelWorkloadParams::create()
virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=MaxAddr)
Loader::SymbolTable * kernelSymtab
ObjectFile * createObjectFile(const std::string &fname, bool raw)
KernelWorkloadParams Params
std::vector< Loader::ObjectFile * > extras
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual MemoryImage buildImage() const =0
MemoryImage & move(std::function< Addr(Addr)> mapper)
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
const Params & params() const
Addr _loadAddrMask
Mask that should be anded for binary/symbol loading.
Loader::ObjectFile * kernelObj
Loader::MemoryImage image
bool write(const PortProxy &proxy) const
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
void unserialize(const std::string &base, CheckpointIn &cp, Symbol::Binding default_binding=Symbol::Binding::Global)
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map...
MemoryImage & offset(Addr by)
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::ostream CheckpointOut
void serialize(const std::string &base, CheckpointOut &cp) const
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Addr _loadAddrOffset
Offset that should be used for binary/symbol loading.
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=MaxAddr)
KernelWorkload(const Params &p)