Go to the documentation of this file.
54 #include "debug/Loader.hh"
61 using namespace Linux;
67 enableContextSwitchStatsDump(
p->enable_context_switch_stats_dump)
78 if (
params()->early_kernel_symbols) {
87 bool kernel_has_fdt_support =
89 bool dtb_file_specified =
params()->dtb_filename !=
"";
91 if (kernel_has_fdt_support && dtb_file_specified) {
94 inform(
"Loading DTB file: %s at address %#x\n",
params()->dtb_filename,
97 auto *dtb_file = new ::Loader::DtbFile(
params()->dtb_filename);
99 if (!dtb_file->addBootCmdLine(
101 warn(
"couldn't append bootargs to DTB file: %s\n",
105 dtb_file->buildImage().
112 if (kernel_has_fdt_support) {
113 assert(!dtb_file_specified);
114 warn(
"Kernel supports device tree, but no DTB file specified\n");
117 if (dtb_file_specified) {
118 assert(!kernel_has_fdt_support);
119 warn(
"DTB file specified, but no device tree support in kernel\n");
129 "Expected a single ATAG memory entry but got %d",
132 am.memSize(atagRanges.begin()->size());
133 am.memStart(atagRanges.begin()->start());
143 uint32_t size =
ac.size() +
am.size() + ad.
size() + an.
size();
145 uint8_t *boot_data =
new uint8_t[size << 2];
152 DPRINTF(
Loader,
"Boot atags was %d bytes in total\n", size << 2);
156 boot_data, size << 2);
164 tc->setIntReg(1,
params()->machine_type);
187 dumpStats = addKernelFuncEvent<DumpStats64>(
"__switch_to");
189 dumpStats = addKernelFuncEvent<DumpStats>(
"__switch_to");
193 std::string task_filename =
"tasks.txt";
197 uint32_t pid = tc->getCpuPtr()->getPid();
200 tc->getCpuPtr()->taskId(
taskMap[pid]);
205 const std::string dmesg_output =
name() +
".dmesg";
206 if (
params()->panic_on_panic) {
207 kernelPanic = addKernelFuncEventOrPanic<Linux::KernelPanic>(
208 "panic",
"Kernel panic in simulated kernel", dmesg_output);
210 kernelPanic = addKernelFuncEventOrPanic<Linux::DmesgDump>(
211 "panic",
"Kernel panic in simulated kernel", dmesg_output);
214 if (
params()->panic_on_oops) {
215 kernelOops = addKernelFuncEventOrPanic<Linux::KernelPanic>(
216 "oops_exit",
"Kernel oops in guest", dmesg_output);
218 kernelOops = addKernelFuncEventOrPanic<Linux::DmesgDump>(
219 "oops_exit",
"Kernel oops in guest", dmesg_output);
224 skipUDelay = addKernelFuncEvent<SkipUDelay<SkipFunc>>(
225 "__loop_udelay",
"__udelay", 1000, 0);
227 skipUDelay = addKernelFuncEventOrPanic<SkipUDelay<SkipFunc>>(
228 "__udelay",
"__udelay", 1000, 0);
233 "__loop_const_udelay",
"__const_udelay", 1000, 107374);
236 "__const_udelay",
"__const_udelay", 1000, 107374);
252 std::map<uint32_t, uint32_t>::iterator itr =
taskMap.find(pid);
254 uint32_t map_size =
taskMap.size();
256 warn_once(
"Error out of identifiers for cache occupancy stats");
280 uint32_t &tgid, std::string &next_task_str, int32_t &
mm) {
284 pid =
ti.curTaskPID(task_descriptor);
285 tgid =
ti.curTaskTGID(task_descriptor);
286 next_task_str =
ti.curTaskName(task_descriptor);
290 mm =
ti.curTaskMm(task_descriptor);
302 uint32_t &tgid, std::string &next_task_str, int32_t &
mm) {
306 pid =
ti.curTaskPIDFromTaskStruct(task_struct);
307 tgid =
ti.curTaskTGIDFromTaskStruct(task_struct);
308 next_task_str =
ti.curTaskNameFromTaskStruct(task_struct);
312 mm =
ti.curTaskMmFromTaskStruct(task_struct);
323 std::string next_task_str;
328 bool is_kernel = (
mm == 0);
329 if (is_kernel && (pid != 0)) {
332 next_task_str =
"kernel";
336 panic_if(!wl,
"System workload is not ARM Linux!");
337 std::map<uint32_t, uint32_t>& taskMap = wl->
taskMap;
351 "tick=%lld %d cpu_id=%d next_pid=%d next_tgid=%d next_task=%s\n",
352 curTick(), taskMap[pid], tc->
cpuId(), (
int)pid, (
int)tgid,
354 taskFile->
stream()->flush();
363 ArmFsLinuxParams::create()
bool enableContextSwitchStatsDump
When enabled, dump stats/task info on context switches for Streamline and per-thread cache occupancy ...
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
const Params * params() const
T * addKernelFuncEvent(const char *lbl, Args... args)
Add a function-based event to a kernel symbol.
PCEvent * kernelOops
Event to halt the simulator if the kernel calls oopses
PCEvent * debugPrintk
PC based event to skip the dprink() call and emulate its functionality.
OutputStream * taskFile
This is a file that is placed in the run directory that prints out mappings between taskIds and OS pr...
ArmFsWorkloadParams Params
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
void process(ThreadContext *tc) override
This function is called whenever the the kernel function "__switch_to" is called to change running ta...
static const uint32_t invldPid
Invalid or unknown Pid.
PhysicalMemory & getPhysMem()
Get a pointer to access the physical memory of the system.
const_iterator find(Addr address) const
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
virtual void startup()
startup() is the final initialization call before simulation.
Loader::SymbolTable kernelSymtab
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
Workload * workload
OS kernel.
const SymbolTable & symtab() const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Addr _loadAddrOffset
Offset that should be used for binary/symbol loading.
void mapPid(ThreadContext *tc, uint32_t pid)
This function creates a new task Id for the given pid.
std::ostream * stream() const
Get the output underlying output stream.
PCEvent * skipConstUDelay
Another PC based skip event for const_udelay().
virtual int cpuId() const =0
void setPid(uint32_t pid)
void startup() override
startup() is the final initialization call before simulation.
Loader::ObjectFile * kernelObj
Loader::Arch getArch() const override
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual void getTaskDetails(ThreadContext *tc, uint32_t &pid, uint32_t &tgid, std::string &next_task_str, int32_t &mm)
Extracts the information used by the DumpStatsPCEvent by reading the thread_info pointer passed to __...
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
SymbolTablePtr globals() const
std::map< uint32_t, uint32_t > taskMap
This map stores a mapping of OS process IDs to internal Task IDs.
uint32_t taskId() const
Get cpu task id.
void dumpDmesg()
Dump the kernel's dmesg buffer to stdout.
virtual const std::string name() const
void cmdline(const std::string &s)
const_iterator end() const
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
PCEvent * skipUDelay
PC based event to skip udelay(<time>) calls and quiesce the processor for the appropriate amount of t...
PCEvent * kernelPanic
Event to halt the simulator if the kernel calls panic()
void ccprintf(cp::Print &print)
void dumpDmesg(ThreadContext *tc, std::ostream &os)
Dump Linux's dmesg log buffer to the an output stream.
bool insert(const Symbol &symbol)
AddrRangeList getConfAddrRanges() const
Get the memory ranges for all memories that are to be reported to the configuration table.
const std::string commandLine
virtual RegVal readIntReg(RegIndex reg_idx) const =0
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual BaseCPU * getCpuPtr()=0
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
virtual System * getSystemPtr()=0
Addr _loadAddrMask
Mask that should be anded for binary/symbol loading.
Tick curTick()
The current simulated tick.
void getTaskDetails(ThreadContext *tc, uint32_t &pid, uint32_t &tgid, std::string &next_task_str, int32_t &mm) override
Extracts the information used by the DumpStatsPCEvent64 by reading the task_struct pointer passed to ...
Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17