30#include "debug/Loader.hh"
31#include "params/KernelWorkload.hh"
38 _loadAddrMask(
p.load_addr_mask), _loadAddrOffset(
p.load_addr_offset),
39 commandLine(
p.command_line)
41 if (
params().object_file ==
"") {
42 inform(
"No kernel set for full system simulation. "
43 "Assuming you know what you're doing.");
49 "Could not load kernel file %s",
params().object_file);
69 ->rename([](
const std::string &
name) {
70 return "kernel_init." +
name;
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",
102 auto mapper = [
this](
Addr a) {
105 if (
params().object_file !=
"") {
106 if (
params().addr_check) {
110 "Kernel is mapped to invalid location (not memory). "
111 "start (%#x) - end (%#x) %#x:%#x\n",
120 DPRINTF(Loader,
"Kernel loaded...\n");
124 if (extras_addrs.empty())
126 for (
int idx = 0; idx <
extras.size(); idx++) {
127 const Addr load_addr = extras_addrs[idx];
loader::SymbolTable kernelSymtab
void serialize(CheckpointOut &cp) const override
Serialize an object.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
loader::ObjectFile * kernelObj
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Addr _loadAddrOffset
Offset that should be used for binary/symbol loading.
Addr _loadAddrMask
Mask that should be anded for binary/symbol loading.
loader::MemoryImage image
KernelWorkload(const Params &p)
std::vector< loader::ObjectFile * > extras
virtual std::string name() const
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.
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
virtual MemoryImage buildImage() const =0
MemoryImage & offset(Addr by)
bool write(const PortProxy &proxy) const
MemoryImage & move(std::function< Addr(Addr)> mapper)
const SymbolTable & symtab() const
void unserialize(const std::string &base, CheckpointIn &cp, Symbol::Binding default_binding=Symbol::Binding::Global)
Populate the table by unserializing a checkpoint.
SymbolTablePtr mask(Addr m) const
Generate a new table by a mask to the symbols of the current table.
void serialize(const std::string &base, CheckpointOut &cp) const
Serialize the table's contents.
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
const Params & params() const
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
ObjectFile * createObjectFile(const std::string &fname, bool raw)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.