system.cc (9332:ae2a5329ce96) system.cc (9405:c0a0593510db)
1/*
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2002-2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 */
42
43#include "arch/arm/linux/atag.hh"
44#include "arch/arm/linux/system.hh"
45#include "arch/arm/isa_traits.hh"
46#include "arch/arm/utility.hh"
47#include "arch/generic/linux/threadinfo.hh"
48#include "base/loader/object_file.hh"
49#include "base/loader/symtab.hh"
50#include "cpu/base.hh"
51#include "cpu/pc_event.hh"
52#include "cpu/thread_context.hh"
53#include "debug/Loader.hh"
54#include "kern/linux/events.hh"
55#include "mem/fs_translating_port_proxy.hh"
56#include "mem/physical.hh"
57#include "sim/stat_control.hh"
58
59using namespace ArmISA;
60using namespace Linux;
61
62LinuxArmSystem::LinuxArmSystem(Params *p)
63 : ArmSystem(p),
64 enableContextSwitchStatsDump(p->enable_context_switch_stats_dump)
65{
66#ifndef NDEBUG
67 kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
68 if (!kernelPanicEvent)
69 panic("could not find kernel symbol \'panic\'");
70#endif
71
72 // With ARM udelay() is #defined to __udelay
73 Addr addr = 0;
74 if (kernelSymtab->findAddress("__udelay", addr)) {
75 uDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__udelay",
76 fixFuncEventAddr(addr), 1000, 0);
77 } else {
78 panic("couldn't find kernel symbol \'udelay\'");
79 }
80
81 // constant arguments to udelay() have some precomputation done ahead of
82 // time. Constant comes from code.
83 if (kernelSymtab->findAddress("__const_udelay", addr)) {
84 constUDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__const_udelay",
85 fixFuncEventAddr(addr), 1000, 107374);
86 } else {
87 panic("couldn't find kernel symbol \'udelay\'");
88 }
89
90 secDataPtrAddr = 0;
91 secDataAddr = 0;
92 penReleaseAddr = 0;
93 kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
94 kernelSymtab->findAddress("secondary_data", secDataAddr);
95 kernelSymtab->findAddress("pen_release", penReleaseAddr);
96
97 secDataPtrAddr &= ~ULL(0x7F);
98 secDataAddr &= ~ULL(0x7F);
99 penReleaseAddr &= ~ULL(0x7F);
100}
101
102bool
103LinuxArmSystem::adderBootUncacheable(Addr a)
104{
105 Addr block = a & ~ULL(0x7F);
106 if (block == secDataPtrAddr || block == secDataAddr ||
107 block == penReleaseAddr)
108 return true;
109 return false;
110}
111
112void
113LinuxArmSystem::initState()
114{
115 // Moved from the constructor to here since it relies on the
116 // address map being resolved in the interconnect
117
118 // Call the initialisation of the super class
119 ArmSystem::initState();
120
121 // Load symbols at physical address, we might not want
122 // to do this permanently, for but early bootup work
123 // it is helpful.
124 if (params()->early_kernel_symbols) {
125 kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask);
126 kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask);
127 }
128
129 // Setup boot data structure
130 Addr addr = 0;
131 // Check if the kernel image has a symbol that tells us it supports
132 // device trees.
133 bool kernel_has_fdt_support =
134 kernelSymtab->findAddress("unflatten_device_tree", addr);
135 bool dtb_file_specified = params()->dtb_filename != "";
136
137 if (kernel_has_fdt_support && dtb_file_specified) {
138 // Kernel supports flattened device tree and dtb file specified.
139 // Using Device Tree Blob to describe system configuration.
140 inform("Loading DTB file: %s\n", params()->dtb_filename);
141
142 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true);
143 if (!dtb_file) {
144 fatal("couldn't load DTB file: %s\n", params()->dtb_filename);
145 }
146 dtb_file->setTextBase(params()->atags_addr);
147 dtb_file->loadSections(physProxy);
148 delete dtb_file;
149 } else {
150 // Using ATAGS
151 // Warn if the kernel supports FDT and we haven't specified one
152 if (kernel_has_fdt_support) {
153 assert(!dtb_file_specified);
154 warn("Kernel supports device tree, but no DTB file specified\n");
155 }
156 // Warn if the kernel doesn't support FDT and we have specified one
157 if (dtb_file_specified) {
158 assert(!kernel_has_fdt_support);
159 warn("DTB file specified, but no device tree support in kernel\n");
160 }
161
162 AtagCore ac;
163 ac.flags(1); // read-only
164 ac.pagesize(8192);
165 ac.rootdev(0);
166
167 AddrRangeList atagRanges = physmem.getConfAddrRanges();
168 if (atagRanges.size() != 1) {
169 fatal("Expected a single ATAG memory entry but got %d\n",
170 atagRanges.size());
171 }
172 AtagMem am;
173 am.memSize(atagRanges.begin()->size());
1/*
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2002-2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 */
42
43#include "arch/arm/linux/atag.hh"
44#include "arch/arm/linux/system.hh"
45#include "arch/arm/isa_traits.hh"
46#include "arch/arm/utility.hh"
47#include "arch/generic/linux/threadinfo.hh"
48#include "base/loader/object_file.hh"
49#include "base/loader/symtab.hh"
50#include "cpu/base.hh"
51#include "cpu/pc_event.hh"
52#include "cpu/thread_context.hh"
53#include "debug/Loader.hh"
54#include "kern/linux/events.hh"
55#include "mem/fs_translating_port_proxy.hh"
56#include "mem/physical.hh"
57#include "sim/stat_control.hh"
58
59using namespace ArmISA;
60using namespace Linux;
61
62LinuxArmSystem::LinuxArmSystem(Params *p)
63 : ArmSystem(p),
64 enableContextSwitchStatsDump(p->enable_context_switch_stats_dump)
65{
66#ifndef NDEBUG
67 kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
68 if (!kernelPanicEvent)
69 panic("could not find kernel symbol \'panic\'");
70#endif
71
72 // With ARM udelay() is #defined to __udelay
73 Addr addr = 0;
74 if (kernelSymtab->findAddress("__udelay", addr)) {
75 uDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__udelay",
76 fixFuncEventAddr(addr), 1000, 0);
77 } else {
78 panic("couldn't find kernel symbol \'udelay\'");
79 }
80
81 // constant arguments to udelay() have some precomputation done ahead of
82 // time. Constant comes from code.
83 if (kernelSymtab->findAddress("__const_udelay", addr)) {
84 constUDelaySkipEvent = new UDelayEvent(&pcEventQueue, "__const_udelay",
85 fixFuncEventAddr(addr), 1000, 107374);
86 } else {
87 panic("couldn't find kernel symbol \'udelay\'");
88 }
89
90 secDataPtrAddr = 0;
91 secDataAddr = 0;
92 penReleaseAddr = 0;
93 kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
94 kernelSymtab->findAddress("secondary_data", secDataAddr);
95 kernelSymtab->findAddress("pen_release", penReleaseAddr);
96
97 secDataPtrAddr &= ~ULL(0x7F);
98 secDataAddr &= ~ULL(0x7F);
99 penReleaseAddr &= ~ULL(0x7F);
100}
101
102bool
103LinuxArmSystem::adderBootUncacheable(Addr a)
104{
105 Addr block = a & ~ULL(0x7F);
106 if (block == secDataPtrAddr || block == secDataAddr ||
107 block == penReleaseAddr)
108 return true;
109 return false;
110}
111
112void
113LinuxArmSystem::initState()
114{
115 // Moved from the constructor to here since it relies on the
116 // address map being resolved in the interconnect
117
118 // Call the initialisation of the super class
119 ArmSystem::initState();
120
121 // Load symbols at physical address, we might not want
122 // to do this permanently, for but early bootup work
123 // it is helpful.
124 if (params()->early_kernel_symbols) {
125 kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask);
126 kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask);
127 }
128
129 // Setup boot data structure
130 Addr addr = 0;
131 // Check if the kernel image has a symbol that tells us it supports
132 // device trees.
133 bool kernel_has_fdt_support =
134 kernelSymtab->findAddress("unflatten_device_tree", addr);
135 bool dtb_file_specified = params()->dtb_filename != "";
136
137 if (kernel_has_fdt_support && dtb_file_specified) {
138 // Kernel supports flattened device tree and dtb file specified.
139 // Using Device Tree Blob to describe system configuration.
140 inform("Loading DTB file: %s\n", params()->dtb_filename);
141
142 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true);
143 if (!dtb_file) {
144 fatal("couldn't load DTB file: %s\n", params()->dtb_filename);
145 }
146 dtb_file->setTextBase(params()->atags_addr);
147 dtb_file->loadSections(physProxy);
148 delete dtb_file;
149 } else {
150 // Using ATAGS
151 // Warn if the kernel supports FDT and we haven't specified one
152 if (kernel_has_fdt_support) {
153 assert(!dtb_file_specified);
154 warn("Kernel supports device tree, but no DTB file specified\n");
155 }
156 // Warn if the kernel doesn't support FDT and we have specified one
157 if (dtb_file_specified) {
158 assert(!kernel_has_fdt_support);
159 warn("DTB file specified, but no device tree support in kernel\n");
160 }
161
162 AtagCore ac;
163 ac.flags(1); // read-only
164 ac.pagesize(8192);
165 ac.rootdev(0);
166
167 AddrRangeList atagRanges = physmem.getConfAddrRanges();
168 if (atagRanges.size() != 1) {
169 fatal("Expected a single ATAG memory entry but got %d\n",
170 atagRanges.size());
171 }
172 AtagMem am;
173 am.memSize(atagRanges.begin()->size());
174 am.memStart(atagRanges.begin()->start);
174 am.memStart(atagRanges.begin()->start());
175
176 AtagCmdline ad;
177 ad.cmdline(params()->boot_osflags);
178
179 DPRINTF(Loader, "boot command line %d bytes: %s\n",
180 ad.size() <<2, params()->boot_osflags.c_str());
181
182 AtagNone an;
183
184 uint32_t size = ac.size() + am.size() + ad.size() + an.size();
185 uint32_t offset = 0;
186 uint8_t *boot_data = new uint8_t[size << 2];
187
188 offset += ac.copyOut(boot_data + offset);
189 offset += am.copyOut(boot_data + offset);
190 offset += ad.copyOut(boot_data + offset);
191 offset += an.copyOut(boot_data + offset);
192
193 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
194 DDUMP(Loader, boot_data, size << 2);
195
196 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
197
198 delete[] boot_data;
199 }
200
201 for (int i = 0; i < threadContexts.size(); i++) {
202 threadContexts[i]->setIntReg(0, 0);
203 threadContexts[i]->setIntReg(1, params()->machine_type);
204 threadContexts[i]->setIntReg(2, params()->atags_addr);
205 }
206}
207
208LinuxArmSystem::~LinuxArmSystem()
209{
210 if (uDelaySkipEvent)
211 delete uDelaySkipEvent;
212 if (constUDelaySkipEvent)
213 delete constUDelaySkipEvent;
214
215 if (dumpStatsPCEvent)
216 delete dumpStatsPCEvent;
217}
218
219LinuxArmSystem *
220LinuxArmSystemParams::create()
221{
222 return new LinuxArmSystem(this);
223}
224
225void
226LinuxArmSystem::startup()
227{
228 if (enableContextSwitchStatsDump) {
229 dumpStatsPCEvent = addKernelFuncEvent<DumpStatsPCEvent>("__switch_to");
230 if (!dumpStatsPCEvent)
231 panic("dumpStatsPCEvent not created!");
232
233 std::string task_filename = "tasks.txt";
234 taskFile = simout.create(name() + "." + task_filename);
235
236 for (int i = 0; i < _numContexts; i++) {
237 ThreadContext *tc = threadContexts[i];
238 uint32_t pid = tc->getCpuPtr()->getPid();
239 if (pid != Request::invldPid) {
240 mapPid(tc, pid);
241 tc->getCpuPtr()->taskId(taskMap[pid]);
242 }
243 }
244 }
245}
246
247void
248LinuxArmSystem::mapPid(ThreadContext *tc, uint32_t pid)
249{
250 // Create a new unique identifier for this pid
251 std::map<uint32_t, uint32_t>::iterator itr = taskMap.find(pid);
252 if (itr == taskMap.end()) {
253 uint32_t map_size = taskMap.size();
254 if (map_size > ContextSwitchTaskId::MaxNormalTaskId + 1) {
255 warn_once("Error out of identifiers for cache occupancy stats");
256 taskMap[pid] = ContextSwitchTaskId::Unknown;
257 } else {
258 taskMap[pid] = map_size;
259 }
260 }
261}
262
263/** This function is called whenever the the kernel function
264 * "__switch_to" is called to change running tasks.
265 *
266 * r0 = task_struct of the previously running process
267 * r1 = task_info of the previously running process
268 * r2 = task_info of the next process to run
269 */
270void
271DumpStatsPCEvent::process(ThreadContext *tc)
272{
273 Linux::ThreadInfo ti(tc);
274 Addr task_descriptor = tc->readIntReg(2);
275 uint32_t pid = ti.curTaskPID(task_descriptor);
276 uint32_t tgid = ti.curTaskTGID(task_descriptor);
277 std::string next_task_str = ti.curTaskName(task_descriptor);
278
279 // Streamline treats pid == -1 as the kernel process.
280 // Also pid == 0 implies idle process (except during Linux boot)
281 int32_t mm = ti.curTaskMm(task_descriptor);
282 bool is_kernel = (mm == 0);
283 if (is_kernel && (pid != 0)) {
284 pid = -1;
285 tgid = -1;
286 next_task_str = "kernel";
287 }
288
289 LinuxArmSystem* sys = dynamic_cast<LinuxArmSystem *>(tc->getSystemPtr());
290 if (!sys) {
291 panic("System is not LinuxArmSystem while getting Linux process info!");
292 }
293 std::map<uint32_t, uint32_t>& taskMap = sys->taskMap;
294
295 // Create a new unique identifier for this pid
296 sys->mapPid(tc, pid);
297
298 // Set cpu task id, output process info, and dump stats
299 tc->getCpuPtr()->taskId(taskMap[pid]);
300 tc->getCpuPtr()->setPid(pid);
301
302 std::ostream* taskFile = sys->taskFile;
303
304 // Task file is read by cache occupancy plotting script or
305 // Streamline conversion script.
306 ccprintf(*taskFile,
307 "tick=%lld %d cpu_id=%d next_pid=%d next_tgid=%d next_task=%s\n",
308 curTick(), taskMap[pid], tc->cpuId(), (int) pid, (int) tgid,
309 next_task_str);
310 taskFile->flush();
311
312 // Dump and reset statistics
313 Stats::schedStatEvent(true, true, curTick(), 0);
314}
315
175
176 AtagCmdline ad;
177 ad.cmdline(params()->boot_osflags);
178
179 DPRINTF(Loader, "boot command line %d bytes: %s\n",
180 ad.size() <<2, params()->boot_osflags.c_str());
181
182 AtagNone an;
183
184 uint32_t size = ac.size() + am.size() + ad.size() + an.size();
185 uint32_t offset = 0;
186 uint8_t *boot_data = new uint8_t[size << 2];
187
188 offset += ac.copyOut(boot_data + offset);
189 offset += am.copyOut(boot_data + offset);
190 offset += ad.copyOut(boot_data + offset);
191 offset += an.copyOut(boot_data + offset);
192
193 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
194 DDUMP(Loader, boot_data, size << 2);
195
196 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
197
198 delete[] boot_data;
199 }
200
201 for (int i = 0; i < threadContexts.size(); i++) {
202 threadContexts[i]->setIntReg(0, 0);
203 threadContexts[i]->setIntReg(1, params()->machine_type);
204 threadContexts[i]->setIntReg(2, params()->atags_addr);
205 }
206}
207
208LinuxArmSystem::~LinuxArmSystem()
209{
210 if (uDelaySkipEvent)
211 delete uDelaySkipEvent;
212 if (constUDelaySkipEvent)
213 delete constUDelaySkipEvent;
214
215 if (dumpStatsPCEvent)
216 delete dumpStatsPCEvent;
217}
218
219LinuxArmSystem *
220LinuxArmSystemParams::create()
221{
222 return new LinuxArmSystem(this);
223}
224
225void
226LinuxArmSystem::startup()
227{
228 if (enableContextSwitchStatsDump) {
229 dumpStatsPCEvent = addKernelFuncEvent<DumpStatsPCEvent>("__switch_to");
230 if (!dumpStatsPCEvent)
231 panic("dumpStatsPCEvent not created!");
232
233 std::string task_filename = "tasks.txt";
234 taskFile = simout.create(name() + "." + task_filename);
235
236 for (int i = 0; i < _numContexts; i++) {
237 ThreadContext *tc = threadContexts[i];
238 uint32_t pid = tc->getCpuPtr()->getPid();
239 if (pid != Request::invldPid) {
240 mapPid(tc, pid);
241 tc->getCpuPtr()->taskId(taskMap[pid]);
242 }
243 }
244 }
245}
246
247void
248LinuxArmSystem::mapPid(ThreadContext *tc, uint32_t pid)
249{
250 // Create a new unique identifier for this pid
251 std::map<uint32_t, uint32_t>::iterator itr = taskMap.find(pid);
252 if (itr == taskMap.end()) {
253 uint32_t map_size = taskMap.size();
254 if (map_size > ContextSwitchTaskId::MaxNormalTaskId + 1) {
255 warn_once("Error out of identifiers for cache occupancy stats");
256 taskMap[pid] = ContextSwitchTaskId::Unknown;
257 } else {
258 taskMap[pid] = map_size;
259 }
260 }
261}
262
263/** This function is called whenever the the kernel function
264 * "__switch_to" is called to change running tasks.
265 *
266 * r0 = task_struct of the previously running process
267 * r1 = task_info of the previously running process
268 * r2 = task_info of the next process to run
269 */
270void
271DumpStatsPCEvent::process(ThreadContext *tc)
272{
273 Linux::ThreadInfo ti(tc);
274 Addr task_descriptor = tc->readIntReg(2);
275 uint32_t pid = ti.curTaskPID(task_descriptor);
276 uint32_t tgid = ti.curTaskTGID(task_descriptor);
277 std::string next_task_str = ti.curTaskName(task_descriptor);
278
279 // Streamline treats pid == -1 as the kernel process.
280 // Also pid == 0 implies idle process (except during Linux boot)
281 int32_t mm = ti.curTaskMm(task_descriptor);
282 bool is_kernel = (mm == 0);
283 if (is_kernel && (pid != 0)) {
284 pid = -1;
285 tgid = -1;
286 next_task_str = "kernel";
287 }
288
289 LinuxArmSystem* sys = dynamic_cast<LinuxArmSystem *>(tc->getSystemPtr());
290 if (!sys) {
291 panic("System is not LinuxArmSystem while getting Linux process info!");
292 }
293 std::map<uint32_t, uint32_t>& taskMap = sys->taskMap;
294
295 // Create a new unique identifier for this pid
296 sys->mapPid(tc, pid);
297
298 // Set cpu task id, output process info, and dump stats
299 tc->getCpuPtr()->taskId(taskMap[pid]);
300 tc->getCpuPtr()->setPid(pid);
301
302 std::ostream* taskFile = sys->taskFile;
303
304 // Task file is read by cache occupancy plotting script or
305 // Streamline conversion script.
306 ccprintf(*taskFile,
307 "tick=%lld %d cpu_id=%d next_pid=%d next_tgid=%d next_task=%s\n",
308 curTick(), taskMap[pid], tc->cpuId(), (int) pid, (int) tgid,
309 next_task_str);
310 taskFile->flush();
311
312 // Dump and reset statistics
313 Stats::schedStatEvent(true, true, curTick(), 0);
314}
315