system.cc (13396:23277eaae855) | system.cc (13397:9fd4c9dedfda) |
---|---|
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 --- 90 unchanged lines hidden (view full) --- 99 bootldr = bootLoaders[0].get(); 100 } 101 102 if (!bootLoaders.empty() && !bootldr) 103 fatal("Can't find a matching boot loader / kernel combination!"); 104 105 if (bootldr) { 106 bootldr->loadGlobalSymbols(debugSymbolTable); | 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 --- 90 unchanged lines hidden (view full) --- 99 bootldr = bootLoaders[0].get(); 100 } 101 102 if (!bootLoaders.empty() && !bootldr) 103 fatal("Can't find a matching boot loader / kernel combination!"); 104 105 if (bootldr) { 106 bootldr->loadGlobalSymbols(debugSymbolTable); |
107 108 warn_if(bootldr->entryPoint() != _resetAddr, 109 "Bootloader entry point %#x overriding reset address %#x", 110 bootldr->entryPoint(), _resetAddr); 111 const_cast<Addr&>(_resetAddr) = bootldr->entryPoint(); 112 |
|
107 if ((bootldr->getArch() == ObjectFile::Arm64) && !_highestELIs64) { 108 warn("Highest ARM exception-level set to AArch32 but bootloader " 109 "is for AArch64. Assuming you wanted these to match.\n"); 110 _highestELIs64 = true; 111 } else if ((bootldr->getArch() == ObjectFile::Arm) && _highestELIs64) { 112 warn("Highest ARM exception-level set to AArch64 but bootloader " 113 "is for AArch32. Assuming you wanted these to match.\n"); 114 _highestELIs64 = false; --- 12 unchanged lines hidden (view full) --- 127 // Call the initialisation of the super class 128 System::initState(); 129 130 const Params* p = params(); 131 132 if (bootldr) { 133 bootldr->loadSections(physProxy); 134 | 113 if ((bootldr->getArch() == ObjectFile::Arm64) && !_highestELIs64) { 114 warn("Highest ARM exception-level set to AArch32 but bootloader " 115 "is for AArch64. Assuming you wanted these to match.\n"); 116 _highestELIs64 = true; 117 } else if ((bootldr->getArch() == ObjectFile::Arm) && _highestELIs64) { 118 warn("Highest ARM exception-level set to AArch64 but bootloader " 119 "is for AArch32. Assuming you wanted these to match.\n"); 120 _highestELIs64 = false; --- 12 unchanged lines hidden (view full) --- 133 // Call the initialisation of the super class 134 System::initState(); 135 136 const Params* p = params(); 137 138 if (bootldr) { 139 bootldr->loadSections(physProxy); 140 |
135 uint8_t jump_to_bl_32[] = 136 { 137 0x07, 0xf0, 0xa0, 0xe1 // branch to r7 in aarch32 138 }; 139 140 uint8_t jump_to_bl_64[] = 141 { 142 0xe0, 0x00, 0x1f, 0xd6 // instruction "br x7" in aarch64 143 }; 144 145 // write the jump to branch table into address 0 146 if (!_highestELIs64) 147 physProxy.writeBlob(0x0, jump_to_bl_32, sizeof(jump_to_bl_32)); 148 else 149 physProxy.writeBlob(0x0, jump_to_bl_64, sizeof(jump_to_bl_64)); 150 | |
151 inform("Using bootloader at address %#x\n", bootldr->entryPoint()); 152 153 // Put the address of the boot loader into r7 so we know 154 // where to branch to after the reset fault 155 // All other values needed by the boot loader to know what to do 156 if (!p->gic_cpu_addr || !p->flags_addr) 157 fatal("gic_cpu_addr && flags_addr must be set with bootloader\n"); 158 159 for (int i = 0; i < threadContexts.size(); i++) { 160 if (!_highestELIs64) 161 threadContexts[i]->setIntReg(3, (kernelEntry & loadAddrMask) + 162 loadAddrOffset); | 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 146 if (!p->gic_cpu_addr || !p->flags_addr) 147 fatal("gic_cpu_addr && flags_addr must be set with bootloader\n"); 148 149 for (int i = 0; i < threadContexts.size(); i++) { 150 if (!_highestELIs64) 151 threadContexts[i]->setIntReg(3, (kernelEntry & loadAddrMask) + 152 loadAddrOffset); |
153 |
|
163 threadContexts[i]->setIntReg(4, params()->gic_cpu_addr); 164 threadContexts[i]->setIntReg(5, params()->flags_addr); | 154 threadContexts[i]->setIntReg(4, params()->gic_cpu_addr); 155 threadContexts[i]->setIntReg(5, params()->flags_addr); |
165 threadContexts[i]->setIntReg(7, bootldr->entryPoint()); | |
166 } 167 inform("Using kernel entry physical address at %#x\n", 168 (kernelEntry & loadAddrMask) + loadAddrOffset); 169 } else { 170 // Set the initial PC to be at start of the kernel code 171 if (!_highestELIs64) 172 threadContexts[0]->pcState((kernelEntry & loadAddrMask) + 173 loadAddrOffset); --- 144 unchanged lines hidden --- | 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) + 163 loadAddrOffset); --- 144 unchanged lines hidden --- |