30#include "debug/Loader.hh"
31#include "params/KernelWorkload.hh"
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",
98 auto &phys_mem =
system->physProxy;
102 auto mapper = [
this](
Addr a) {
105 if (
params().object_file !=
"") {
106 if (
params().addr_check) {
107 auto memory_size =
system->memSize();
110 fatal_if((kernel_size > memory_size),
111 "Kernel is mapped to invalid location (not memory). start"
112 " (%#lx) - end (%#lx) %#lx:%#lx\n"
113 "The kernel size (%ld bytes, %ld MB) appears to be larger "
114 "than total system memory (%ld bytes, %ld MB). Try increasing"
116 kernel_size, kernel_size>>20, memory_size, memory_size>>20);
119 "Kernel is mapped to invalid location (not memory). start"
120 " (%#lx) - end (%#lx) %#lx:%#lx\n",
_start,
_end,
125 image.write(phys_mem);
130 DPRINTF(Loader,
"Kernel loaded...\n");
134 if (extras_addrs.empty())
136 for (
int idx = 0; idx <
extras.size(); idx++) {
137 const Addr load_addr = extras_addrs[idx];
143 image.write(phys_mem);
loader::SymbolTable kernelSymtab
const std::string commandLine
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
Workload(const WorkloadParams ¶ms)
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 Arm Limited All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.