system.cc (10846:751aa8add0bc) | system.cc (11234:c273990ed9bf) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2010, 2012-2013 ARM Limited | 2 * Copyright (c) 2010, 2012-2013, 2015 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 --- 38 unchanged lines hidden (view full) --- 49#include "mem/physical.hh" 50#include "mem/fs_translating_port_proxy.hh" 51#include "sim/full_system.hh" 52 53using namespace std; 54using namespace Linux; 55 56ArmSystem::ArmSystem(Params *p) | 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 --- 38 unchanged lines hidden (view full) --- 49#include "mem/physical.hh" 50#include "mem/fs_translating_port_proxy.hh" 51#include "sim/full_system.hh" 52 53using namespace std; 54using namespace Linux; 55 56ArmSystem::ArmSystem(Params *p) |
57 : System(p), bootldr(NULL), _haveSecurity(p->have_security), | 57 : System(p), 58 bootLoaders(), bootldr(nullptr), 59 _haveSecurity(p->have_security), |
58 _haveLPAE(p->have_lpae), 59 _haveVirtualization(p->have_virtualization), 60 _genericTimer(nullptr), 61 _highestELIs64(p->highest_el_is_64), 62 _resetAddr64(p->reset_addr_64), 63 _physAddrRange64(p->phys_addr_range_64), 64 _haveLargeAsid64(p->have_large_asid_64), 65 multiProc(p->multi_proc) 66{ 67 // Check if the physical address range is valid 68 if (_highestELIs64 && ( 69 _physAddrRange64 < 32 || 70 _physAddrRange64 > 48 || 71 (_physAddrRange64 % 4 != 0 && _physAddrRange64 != 42))) { 72 fatal("Invalid physical address range (%d)\n", _physAddrRange64); 73 } 74 | 60 _haveLPAE(p->have_lpae), 61 _haveVirtualization(p->have_virtualization), 62 _genericTimer(nullptr), 63 _highestELIs64(p->highest_el_is_64), 64 _resetAddr64(p->reset_addr_64), 65 _physAddrRange64(p->phys_addr_range_64), 66 _haveLargeAsid64(p->have_large_asid_64), 67 multiProc(p->multi_proc) 68{ 69 // Check if the physical address range is valid 70 if (_highestELIs64 && ( 71 _physAddrRange64 < 32 || 72 _physAddrRange64 > 48 || 73 (_physAddrRange64 % 4 != 0 && _physAddrRange64 != 42))) { 74 fatal("Invalid physical address range (%d)\n", _physAddrRange64); 75 } 76 |
75 if (p->boot_loader != "") { 76 bootldr = createObjectFile(p->boot_loader); | 77 bootLoaders.reserve(p->boot_loader.size()); 78 for (const auto &bl : p->boot_loader) { 79 std::unique_ptr<ObjectFile> obj; 80 obj.reset(createObjectFile(bl)); |
77 | 81 |
78 if (!bootldr) 79 fatal("Could not read bootloader: %s\n", p->boot_loader); | 82 fatal_if(!obj, "Could not read bootloader: %s\n", bl); 83 bootLoaders.emplace_back(std::move(obj)); 84 } |
80 | 85 |
86 if (kernel) { 87 bootldr = getBootLoader(kernel); 88 } else if (!bootLoaders.empty()) { 89 // No kernel specified, default to the first boot loader 90 bootldr = bootLoaders[0].get(); 91 } 92 93 if (!bootLoaders.empty() && !bootldr) 94 fatal("Can't find a matching boot loader / kernel combination!"); 95 96 if (bootldr) { 97 bootldr->loadGlobalSymbols(debugSymbolTable); |
|
81 if ((bootldr->getArch() == ObjectFile::Arm64) && !_highestELIs64) { 82 warn("Highest ARM exception-level set to AArch32 but bootloader " 83 "is for AArch64. Assuming you wanted these to match.\n"); 84 _highestELIs64 = true; 85 } else if ((bootldr->getArch() == ObjectFile::Arm) && _highestELIs64) { 86 warn("Highest ARM exception-level set to AArch64 but bootloader " 87 "is for AArch32. Assuming you wanted these to match.\n"); 88 _highestELIs64 = false; 89 } | 98 if ((bootldr->getArch() == ObjectFile::Arm64) && !_highestELIs64) { 99 warn("Highest ARM exception-level set to AArch32 but bootloader " 100 "is for AArch64. Assuming you wanted these to match.\n"); 101 _highestELIs64 = true; 102 } else if ((bootldr->getArch() == ObjectFile::Arm) && _highestELIs64) { 103 warn("Highest ARM exception-level set to AArch64 but bootloader " 104 "is for AArch32. Assuming you wanted these to match.\n"); 105 _highestELIs64 = false; 106 } |
90 91 bootldr->loadGlobalSymbols(debugSymbolTable); 92 | |
93 } | 107 } |
108 |
|
94 debugPrintkEvent = addKernelFuncEvent<DebugPrintkEvent>("dprintk"); 95} 96 97void 98ArmSystem::initState() 99{ 100 // Moved from the constructor to here since it relies on the 101 // address map being resolved in the interconnect --- 61 unchanged lines hidden (view full) --- 163 164 165ArmSystem::~ArmSystem() 166{ 167 if (debugPrintkEvent) 168 delete debugPrintkEvent; 169} 170 | 109 debugPrintkEvent = addKernelFuncEvent<DebugPrintkEvent>("dprintk"); 110} 111 112void 113ArmSystem::initState() 114{ 115 // Moved from the constructor to here since it relies on the 116 // address map being resolved in the interconnect --- 61 unchanged lines hidden (view full) --- 178 179 180ArmSystem::~ArmSystem() 181{ 182 if (debugPrintkEvent) 183 delete debugPrintkEvent; 184} 185 |
186ObjectFile * 187ArmSystem::getBootLoader(ObjectFile *const obj) 188{ 189 for (auto &bl : bootLoaders) { 190 if (bl->getArch() == obj->getArch()) 191 return bl.get(); 192 } 193 194 return nullptr; 195} 196 |
|
171bool 172ArmSystem::haveLPAE(ThreadContext *tc) 173{ 174 if (!FullSystem) 175 return false; 176 177 ArmSystem *a_sys = dynamic_cast<ArmSystem *>(tc->getSystemPtr()); 178 assert(a_sys); --- 72 unchanged lines hidden --- | 197bool 198ArmSystem::haveLPAE(ThreadContext *tc) 199{ 200 if (!FullSystem) 201 return false; 202 203 ArmSystem *a_sys = dynamic_cast<ArmSystem *>(tc->getSystemPtr()); 204 assert(a_sys); --- 72 unchanged lines hidden --- |