Go to the documentation of this file.
53 #include "debug/Loader.hh"
63 using namespace linux;
69 enableContextSwitchStatsDump(
p.enable_context_switch_stats_dump)
80 if (
params().early_kernel_symbols) {
89 bool kernel_has_fdt_support =
91 bool dtb_file_specified =
params().dtb_filename !=
"";
93 if (kernel_has_fdt_support && dtb_file_specified) {
96 inform(
"Loading DTB file: %s at address %#x\n",
params().dtb_filename,
101 if (!dtb_file->addBootCmdLine(
103 warn(
"couldn't append bootargs to DTB file: %s\n",
107 dtb_file->buildImage().offset(
params().dtb_addr)
113 if (kernel_has_fdt_support) {
114 assert(!dtb_file_specified);
115 warn(
"Kernel supports device tree, but no DTB file specified\n");
118 if (dtb_file_specified) {
119 assert(!kernel_has_fdt_support);
120 warn(
"DTB file specified, but no device tree support in kernel\n");
130 "Expected a single ATAG memory entry but got %d",
133 am.memSize(atagRanges.begin()->size());
134 am.memStart(atagRanges.begin()->start());
139 DPRINTF(Loader,
"boot command line %d bytes: %s\n",
144 uint32_t size =
ac.size() +
am.size() + ad.
size() + an.
size();
146 uint8_t *boot_data =
new uint8_t[size << 2];
153 DPRINTF(Loader,
"Boot atags was %d bytes in total\n", size << 2);
154 DDUMP(Loader, boot_data, size << 2);
157 boot_data, size << 2);
167 tc->setIntReg(0,
params().dtb_addr);
168 tc->setIntReg(5,
params().cpu_release_addr);
174 tc->setIntReg(1,
params().machine_type);
175 tc->setIntReg(2,
params().dtb_addr);
198 dumpStats = addKernelFuncEvent<DumpStats64>(
"__switch_to");
200 dumpStats = addKernelFuncEvent<DumpStats>(
"__switch_to");
204 std::string task_filename =
"tasks.txt";
208 uint32_t pid = tc->getCpuPtr()->getPid();
211 tc->getCpuPtr()->taskId(
taskMap[pid]);
216 const std::string dmesg_output =
name() +
".dmesg";
217 if (
params().panic_on_panic) {
218 kernelPanic = addKernelFuncEventOrPanic<linux::KernelPanic>(
219 "panic",
"Kernel panic in simulated kernel", dmesg_output);
221 kernelPanic = addKernelFuncEventOrPanic<linux::DmesgDump>(
222 "panic",
"Kernel panic in simulated kernel", dmesg_output);
225 if (
params().panic_on_oops) {
226 kernelOops = addKernelFuncEventOrPanic<linux::KernelPanic>(
227 "oops_exit",
"Kernel oops in guest", dmesg_output);
229 kernelOops = addKernelFuncEventOrPanic<linux::DmesgDump>(
230 "oops_exit",
"Kernel oops in guest", dmesg_output);
236 "__loop_udelay",
"__udelay", 1000, 0);
239 "__udelay",
"__udelay", 1000, 0);
245 "__loop_const_udelay",
"__const_udelay", 1000, 107374);
248 "__const_udelay",
"__const_udelay", 1000, 107374);
258 std::map<uint32_t, uint32_t>::iterator itr =
taskMap.find(pid);
260 uint32_t map_size =
taskMap.size();
262 warn_once(
"Error out of identifiers for cache occupancy stats");
286 uint32_t &tgid, std::string &next_task_str, int32_t &
mm) {
290 pid =
ti.curTaskPID(task_descriptor);
291 tgid =
ti.curTaskTGID(task_descriptor);
292 next_task_str =
ti.curTaskName(task_descriptor);
296 mm =
ti.curTaskMm(task_descriptor);
308 uint32_t &tgid, std::string &next_task_str, int32_t &
mm) {
312 pid =
ti.curTaskPIDFromTaskStruct(task_struct);
313 tgid =
ti.curTaskTGIDFromTaskStruct(task_struct);
314 next_task_str =
ti.curTaskNameFromTaskStruct(task_struct);
318 mm =
ti.curTaskMmFromTaskStruct(task_struct);
329 std::string next_task_str;
334 bool is_kernel = (
mm == 0);
335 if (is_kernel && (pid != 0)) {
338 next_task_str =
"kernel";
342 panic_if(!wl,
"System workload is not ARM Linux!");
343 std::map<uint32_t, uint32_t>& taskMap = wl->
taskMap;
357 "tick=%lld %d cpu_id=%d next_pid=%d next_tgid=%d next_task=%s\n",
358 curTick(), taskMap[pid], tc->
cpuId(), (
int)pid, (
int)tgid,
360 taskFile->
stream()->flush();
Tick curTick()
The universal simulation clock.
Addr _loadAddrMask
Mask that should be anded for binary/symbol loading.
virtual System * getSystemPtr()=0
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
SymbolTablePtr globals() const
Generates a new symbol table containing only global symbols.
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 __...
PCEvent * skipUDelay
PC based event to skip udelay(<time>) calls and quiesce the processor for the appropriate amount of t...
PCEvent * skipConstUDelay
Another PC based skip event for const_udelay().
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
const std::string commandLine
void mapPid(ThreadContext *tc, uint32_t pid)
This function creates a new task Id for the given pid.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
const_iterator end() const
bool enableContextSwitchStatsDump
When enabled, dump stats/task info on context switches for Streamline and per-thread cache occupancy ...
static const uint32_t invldPid
Invalid or unknown Pid.
Workload * workload
OS kernel.
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
const SymbolTable & symtab() const
loader::ObjectFile * kernelObj
virtual int cpuId() const =0
void setPid(uint32_t pid)
void ccprintf(cp::Print &print)
std::map< uint32_t, uint32_t > taskMap
This map stores a mapping of OS process IDs to internal Task IDs.
PCEvent * debugPrintk
PC based event to skip the dprink() call and emulate its functionality.
std::ostream * stream() const
Get the output underlying output stream.
uint32_t taskId() const
Get cpu task id.
PCEvent * kernelPanic
Event to halt the simulator if the kernel calls panic()
void startup() override
startup() is the final initialization call before simulation.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual std::string name() const
const Params & params() const
loader::SymbolTable kernelSymtab
void dumpDmesg()
Dump the kernel's dmesg buffer to stdout.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual RegVal readIntReg(RegIndex reg_idx) const =0
loader::Arch getArch() const override
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
void dumpDmesg(ThreadContext *tc, std::ostream &os)
Dump Linux's dmesg log buffer to the an output stream.
const_iterator find(Addr address) const
Search for a symbol by its address.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
OutputStream * taskFile
This is a file that is placed in the run directory that prints out mappings between taskIds and OS pr...
void cmdline(const std::string &s)
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
void process(ThreadContext *tc) override
This function is called whenever the the kernel function "__switch_to" is called to change running ta...
PCEvent * kernelOops
Event to halt the simulator if the kernel calls oopses
void startup() override
startup() is the final initialization call before simulation.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
virtual BaseCPU * getCpuPtr()=0
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 ...
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
memory::PhysicalMemory & getPhysMem()
Get a pointer to access the physical memory of the system.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
AddrRangeList getConfAddrRanges() const
Get the memory ranges for all memories that are to be reported to the configuration table.
void schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
Schedule statistics dumping.
Generated on Tue Sep 21 2021 12:24:31 for gem5 by doxygen 1.8.17