system.cc (9934:b105ac205021) system.cc (10037:5cac77888310)
1/*
1/*
2 * Copyright (c) 2010-2012 ARM Limited
2 * Copyright (c) 2010-2013 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

--- 47 unchanged lines hidden (view full) ---

58#include "sim/stat_control.hh"
59
60using namespace ArmISA;
61using namespace Linux;
62
63LinuxArmSystem::LinuxArmSystem(Params *p)
64 : ArmSystem(p),
65 enableContextSwitchStatsDump(p->enable_context_switch_stats_dump),
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

--- 47 unchanged lines hidden (view full) ---

58#include "sim/stat_control.hh"
59
60using namespace ArmISA;
61using namespace Linux;
62
63LinuxArmSystem::LinuxArmSystem(Params *p)
64 : ArmSystem(p),
65 enableContextSwitchStatsDump(p->enable_context_switch_stats_dump),
66 kernelPanicEvent(NULL), kernelOopsEvent(NULL)
66 kernelPanicEvent(NULL), kernelOopsEvent(NULL),
67 bootReleaseAddr(p->boot_release_addr)
67{
68 if (p->panic_on_panic) {
69 kernelPanicEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
70 "panic", "Kernel panic in simulated kernel");
71 } else {
72#ifndef NDEBUG
73 kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
74#endif

--- 18 unchanged lines hidden (view full) ---

93 "__loop_const_udelay", "__const_udelay", 1000, 107374);
94 if(!constUDelaySkipEvent)
95 constUDelaySkipEvent = addKernelFuncEventOrPanic<UDelayEvent>(
96 "__const_udelay", "__const_udelay", 1000, 107374);
97
98 secDataPtrAddr = 0;
99 secDataAddr = 0;
100 penReleaseAddr = 0;
68{
69 if (p->panic_on_panic) {
70 kernelPanicEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
71 "panic", "Kernel panic in simulated kernel");
72 } else {
73#ifndef NDEBUG
74 kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
75#endif

--- 18 unchanged lines hidden (view full) ---

94 "__loop_const_udelay", "__const_udelay", 1000, 107374);
95 if(!constUDelaySkipEvent)
96 constUDelaySkipEvent = addKernelFuncEventOrPanic<UDelayEvent>(
97 "__const_udelay", "__const_udelay", 1000, 107374);
98
99 secDataPtrAddr = 0;
100 secDataAddr = 0;
101 penReleaseAddr = 0;
102
101 kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
102 kernelSymtab->findAddress("secondary_data", secDataAddr);
103 kernelSymtab->findAddress("pen_release", penReleaseAddr);
103 kernelSymtab->findAddress("__secondary_data", secDataPtrAddr);
104 kernelSymtab->findAddress("secondary_data", secDataAddr);
105 kernelSymtab->findAddress("pen_release", penReleaseAddr);
106 kernelSymtab->findAddress("secondary_holding_pen_release", pen64ReleaseAddr);
104
105 secDataPtrAddr &= ~ULL(0x7F);
106 secDataAddr &= ~ULL(0x7F);
107 penReleaseAddr &= ~ULL(0x7F);
107
108 secDataPtrAddr &= ~ULL(0x7F);
109 secDataAddr &= ~ULL(0x7F);
110 penReleaseAddr &= ~ULL(0x7F);
111 pen64ReleaseAddr &= ~ULL(0x7F);
112 bootReleaseAddr = (bootReleaseAddr & ~ULL(0x7F)) + loadAddrOffset;
113
108}
109
110bool
111LinuxArmSystem::adderBootUncacheable(Addr a)
112{
113 Addr block = a & ~ULL(0x7F);
114}
115
116bool
117LinuxArmSystem::adderBootUncacheable(Addr a)
118{
119 Addr block = a & ~ULL(0x7F);
120
114 if (block == secDataPtrAddr || block == secDataAddr ||
121 if (block == secDataPtrAddr || block == secDataAddr ||
115 block == penReleaseAddr)
122 block == penReleaseAddr || pen64ReleaseAddr == block ||
123 block == bootReleaseAddr)
116 return true;
124 return true;
125
117 return false;
118}
119
120void
121LinuxArmSystem::initState()
122{
123 // Moved from the constructor to here since it relies on the
124 // address map being resolved in the interconnect

--- 15 unchanged lines hidden (view full) ---

140 // device trees.
141 bool kernel_has_fdt_support =
142 kernelSymtab->findAddress("unflatten_device_tree", addr);
143 bool dtb_file_specified = params()->dtb_filename != "";
144
145 if (kernel_has_fdt_support && dtb_file_specified) {
146 // Kernel supports flattened device tree and dtb file specified.
147 // Using Device Tree Blob to describe system configuration.
126 return false;
127}
128
129void
130LinuxArmSystem::initState()
131{
132 // Moved from the constructor to here since it relies on the
133 // address map being resolved in the interconnect

--- 15 unchanged lines hidden (view full) ---

149 // device trees.
150 bool kernel_has_fdt_support =
151 kernelSymtab->findAddress("unflatten_device_tree", addr);
152 bool dtb_file_specified = params()->dtb_filename != "";
153
154 if (kernel_has_fdt_support && dtb_file_specified) {
155 // Kernel supports flattened device tree and dtb file specified.
156 // Using Device Tree Blob to describe system configuration.
148 inform("Loading DTB file: %s\n", params()->dtb_filename);
157 inform("Loading DTB file: %s at address %#x\n", params()->dtb_filename,
158 params()->atags_addr + loadAddrOffset);
149
150 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true);
151 if (!dtb_file) {
152 fatal("couldn't load DTB file: %s\n", params()->dtb_filename);
153 }
154
155 DtbObject *_dtb_file = dynamic_cast<DtbObject*>(dtb_file);
156
157 if (_dtb_file) {
158 if (!_dtb_file->addBootCmdLine(params()->boot_osflags.c_str(),
159 params()->boot_osflags.size())) {
160 warn("couldn't append bootargs to DTB file: %s\n",
161 params()->dtb_filename);
162 }
163 } else {
164 warn("dtb_file cast failed; couldn't append bootargs "
165 "to DTB file: %s\n", params()->dtb_filename);
166 }
167
159
160 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true);
161 if (!dtb_file) {
162 fatal("couldn't load DTB file: %s\n", params()->dtb_filename);
163 }
164
165 DtbObject *_dtb_file = dynamic_cast<DtbObject*>(dtb_file);
166
167 if (_dtb_file) {
168 if (!_dtb_file->addBootCmdLine(params()->boot_osflags.c_str(),
169 params()->boot_osflags.size())) {
170 warn("couldn't append bootargs to DTB file: %s\n",
171 params()->dtb_filename);
172 }
173 } else {
174 warn("dtb_file cast failed; couldn't append bootargs "
175 "to DTB file: %s\n", params()->dtb_filename);
176 }
177
168 dtb_file->setTextBase(params()->atags_addr);
178 dtb_file->setTextBase(params()->atags_addr + loadAddrOffset);
169 dtb_file->loadSections(physProxy);
170 delete dtb_file;
171 } else {
172 // Using ATAGS
173 // Warn if the kernel supports FDT and we haven't specified one
174 if (kernel_has_fdt_support) {
175 assert(!dtb_file_specified);
176 warn("Kernel supports device tree, but no DTB file specified\n");

--- 33 unchanged lines hidden (view full) ---

210 offset += ac.copyOut(boot_data + offset);
211 offset += am.copyOut(boot_data + offset);
212 offset += ad.copyOut(boot_data + offset);
213 offset += an.copyOut(boot_data + offset);
214
215 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
216 DDUMP(Loader, boot_data, size << 2);
217
179 dtb_file->loadSections(physProxy);
180 delete dtb_file;
181 } else {
182 // Using ATAGS
183 // Warn if the kernel supports FDT and we haven't specified one
184 if (kernel_has_fdt_support) {
185 assert(!dtb_file_specified);
186 warn("Kernel supports device tree, but no DTB file specified\n");

--- 33 unchanged lines hidden (view full) ---

220 offset += ac.copyOut(boot_data + offset);
221 offset += am.copyOut(boot_data + offset);
222 offset += ad.copyOut(boot_data + offset);
223 offset += an.copyOut(boot_data + offset);
224
225 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
226 DDUMP(Loader, boot_data, size << 2);
227
218 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2);
228 physProxy.writeBlob(params()->atags_addr + loadAddrOffset, boot_data,
229 size << 2);
219
220 delete[] boot_data;
221 }
222
230
231 delete[] boot_data;
232 }
233
234 // Kernel boot requirements to set up r0, r1 and r2 in ARMv7
223 for (int i = 0; i < threadContexts.size(); i++) {
224 threadContexts[i]->setIntReg(0, 0);
225 threadContexts[i]->setIntReg(1, params()->machine_type);
235 for (int i = 0; i < threadContexts.size(); i++) {
236 threadContexts[i]->setIntReg(0, 0);
237 threadContexts[i]->setIntReg(1, params()->machine_type);
226 threadContexts[i]->setIntReg(2, params()->atags_addr);
238 threadContexts[i]->setIntReg(2, params()->atags_addr + loadAddrOffset);
227 }
228}
229
230LinuxArmSystem::~LinuxArmSystem()
231{
232 if (uDelaySkipEvent)
233 delete uDelaySkipEvent;
234 if (constUDelaySkipEvent)

--- 103 unchanged lines hidden ---
239 }
240}
241
242LinuxArmSystem::~LinuxArmSystem()
243{
244 if (uDelaySkipEvent)
245 delete uDelaySkipEvent;
246 if (constUDelaySkipEvent)

--- 103 unchanged lines hidden ---