system.cc (13397:9fd4c9dedfda) system.cc (13531:e6f1bf55d038)
1/*
2 * Copyright (c) 2010, 2012-2013, 2015,2017-2018 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

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

43#include "arch/arm/system.hh"
44
45#include <iostream>
46
47#include "arch/arm/semihosting.hh"
48#include "base/loader/object_file.hh"
49#include "base/loader/symtab.hh"
50#include "cpu/thread_context.hh"
1/*
2 * Copyright (c) 2010, 2012-2013, 2015,2017-2018 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

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

43#include "arch/arm/system.hh"
44
45#include <iostream>
46
47#include "arch/arm/semihosting.hh"
48#include "base/loader/object_file.hh"
49#include "base/loader/symtab.hh"
50#include "cpu/thread_context.hh"
51#include "dev/arm/gic_v3.hh"
51#include "mem/fs_translating_port_proxy.hh"
52#include "mem/physical.hh"
53#include "sim/full_system.hh"
54
55using namespace std;
56using namespace Linux;
57
58ArmSystem::ArmSystem(Params *p)
59 : System(p),
60 bootLoaders(), bootldr(nullptr),
61 _haveSecurity(p->have_security),
62 _haveLPAE(p->have_lpae),
63 _haveVirtualization(p->have_virtualization),
64 _haveCrypto(p->have_crypto),
65 _genericTimer(nullptr),
52#include "mem/fs_translating_port_proxy.hh"
53#include "mem/physical.hh"
54#include "sim/full_system.hh"
55
56using namespace std;
57using namespace Linux;
58
59ArmSystem::ArmSystem(Params *p)
60 : System(p),
61 bootLoaders(), bootldr(nullptr),
62 _haveSecurity(p->have_security),
63 _haveLPAE(p->have_lpae),
64 _haveVirtualization(p->have_virtualization),
65 _haveCrypto(p->have_crypto),
66 _genericTimer(nullptr),
67 _gic(nullptr),
66 _resetAddr(p->auto_reset_addr ?
67 (kernelEntry & loadAddrMask) + loadAddrOffset :
68 p->reset_addr),
69 _highestELIs64(p->highest_el_is_64),
70 _physAddrRange64(p->phys_addr_range_64),
71 _haveLargeAsid64(p->have_large_asid_64),
72 _m5opRange(p->m5ops_base ?
73 RangeSize(p->m5ops_base, 0x10000) :

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

131 // address map being resolved in the interconnect
132
133 // Call the initialisation of the super class
134 System::initState();
135
136 const Params* p = params();
137
138 if (bootldr) {
68 _resetAddr(p->auto_reset_addr ?
69 (kernelEntry & loadAddrMask) + loadAddrOffset :
70 p->reset_addr),
71 _highestELIs64(p->highest_el_is_64),
72 _physAddrRange64(p->phys_addr_range_64),
73 _haveLargeAsid64(p->have_large_asid_64),
74 _m5opRange(p->m5ops_base ?
75 RangeSize(p->m5ops_base, 0x10000) :

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

133 // address map being resolved in the interconnect
134
135 // Call the initialisation of the super class
136 System::initState();
137
138 const Params* p = params();
139
140 if (bootldr) {
141 bool isGICv3System = dynamic_cast<Gicv3 *>(getGIC()) != nullptr;
139 bootldr->loadSections(physProxy);
140
141 inform("Using bootloader at address %#x\n", bootldr->entryPoint());
142
143 // Put the address of the boot loader into r7 so we know
144 // where to branch to after the reset fault
145 // All other values needed by the boot loader to know what to do
142 bootldr->loadSections(physProxy);
143
144 inform("Using bootloader at address %#x\n", bootldr->entryPoint());
145
146 // Put the address of the boot loader into r7 so we know
147 // where to branch to after the reset fault
148 // All other values needed by the boot loader to know what to do
146 if (!p->gic_cpu_addr || !p->flags_addr)
147 fatal("gic_cpu_addr && flags_addr must be set with bootloader\n");
149 if (!p->flags_addr)
150 fatal("flags_addr must be set with bootloader\n");
148
151
152 if (!p->gic_cpu_addr && !isGICv3System)
153 fatal("gic_cpu_addr must be set with bootloader\n");
154
149 for (int i = 0; i < threadContexts.size(); i++) {
150 if (!_highestELIs64)
151 threadContexts[i]->setIntReg(3, (kernelEntry & loadAddrMask) +
152 loadAddrOffset);
155 for (int i = 0; i < threadContexts.size(); i++) {
156 if (!_highestELIs64)
157 threadContexts[i]->setIntReg(3, (kernelEntry & loadAddrMask) +
158 loadAddrOffset);
153
154 threadContexts[i]->setIntReg(4, params()->gic_cpu_addr);
159 if (!isGICv3System)
160 threadContexts[i]->setIntReg(4, params()->gic_cpu_addr);
155 threadContexts[i]->setIntReg(5, params()->flags_addr);
156 }
157 inform("Using kernel entry physical address at %#x\n",
158 (kernelEntry & loadAddrMask) + loadAddrOffset);
159 } else {
160 // Set the initial PC to be at start of the kernel code
161 if (!_highestELIs64)
162 threadContexts[0]->pcState((kernelEntry & loadAddrMask) +

--- 145 unchanged lines hidden ---
161 threadContexts[i]->setIntReg(5, params()->flags_addr);
162 }
163 inform("Using kernel entry physical address at %#x\n",
164 (kernelEntry & loadAddrMask) + loadAddrOffset);
165 } else {
166 // Set the initial PC to be at start of the kernel code
167 if (!_highestELIs64)
168 threadContexts[0]->pcState((kernelEntry & loadAddrMask) +

--- 145 unchanged lines hidden ---