1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 24 unchanged lines hidden (view full) --- 33 34#include "arch/alpha/ev5.hh" 35#include "arch/alpha/system.hh" 36#include "arch/vtophys.hh" 37#include "base/loader/object_file.hh" 38#include "base/loader/symtab.hh" 39#include "base/trace.hh" 40#include "debug/Loader.hh" |
41#include "mem/physical.hh" 42#include "mem/vport.hh" |
43#include "params/AlphaSystem.hh" 44#include "sim/byteswap.hh" 45 46using namespace AlphaISA; 47 48AlphaSystem::AlphaSystem(Params *p) |
49 : System(p), intrFreq(0) |
50{ 51 consoleSymtab = new SymbolTable; 52 palSymtab = new SymbolTable; 53 54 55 /** 56 * Load the pal, and console code into memory 57 */ 58 // Load Console Code 59 console = createObjectFile(params()->console); 60 if (console == NULL) 61 fatal("Could not load console file %s", params()->console); 62 63 // Load pal file 64 pal = createObjectFile(params()->pal); 65 if (pal == NULL) 66 fatal("Could not load PALcode file %s", params()->pal); |
67 |
68 |
69 // Load program sections into memory |
70 pal->loadSections(functionalPort, loadAddrMask); 71 console->loadSections(functionalPort, loadAddrMask); |
72 73 // load symbols 74 if (!console->loadGlobalSymbols(consoleSymtab)) 75 panic("could not load console symbols\n"); 76 77 if (!pal->loadGlobalSymbols(palSymtab)) 78 panic("could not load pal symbols\n"); 79 --- 16 unchanged lines hidden (view full) --- 96 97 /** 98 * Copy the osflags (kernel arguments) into the consoles 99 * memory. (Presently Linux does not use the console service 100 * routine to get these command line arguments, but Tru64 and 101 * others do.) 102 */ 103 if (consoleSymtab->findAddress("env_booted_osflags", addr)) { |
104 virtPort->writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(), 105 strlen(params()->boot_osflags.c_str())); |
106 } 107 108 /** 109 * Set the hardware reset parameter block system type and revision 110 * information to Tsunami. 111 */ 112 if (consoleSymtab->findAddress("m5_rpb", addr)) { 113 uint64_t data; 114 data = htog(params()->system_type); |
115 virtPort->write(addr+0x50, data); |
116 data = htog(params()->system_rev); |
117 virtPort->write(addr+0x58, data); |
118 } else 119 panic("could not find hwrpb\n"); 120} 121 |
122AlphaSystem::~AlphaSystem() 123{ 124 delete consoleSymtab; 125 delete console; 126 delete pal; 127#ifdef DEBUG 128 delete consolePanicEvent; 129#endif 130} 131 |
132/** 133 * This function fixes up addresses that are used to match PCs for 134 * hooking simulator events on to target function executions. 135 * 136 * Alpha binaries may have multiple global offset table (GOT) 137 * sections. A function that uses the GOT starts with a 138 * two-instruction prolog which sets the global pointer (gp == r29) to 139 * the appropriate GOT section. The proper gp value is calculated --- 25 unchanged lines hidden (view full) --- 165{ 166 // mask for just the opcode, Ra, and Rb fields (not the offset) 167 const uint32_t inst_mask = 0xffff0000; 168 // ldah gp,X(pv): opcode 9, Ra = 29, Rb = 27 169 const uint32_t gp_ldah_pattern = (9 << 26) | (29 << 21) | (27 << 16); 170 // lda gp,Y(gp): opcode 8, Ra = 29, rb = 29 171 const uint32_t gp_lda_pattern = (8 << 26) | (29 << 21) | (29 << 16); 172 |
173 uint32_t i1 = virtPort->read<uint32_t>(addr); 174 uint32_t i2 = virtPort->read<uint32_t>(addr + sizeof(MachInst)); |
175 176 if ((i1 & inst_mask) == gp_ldah_pattern && 177 (i2 & inst_mask) == gp_lda_pattern) { 178 Addr new_addr = addr + 2 * sizeof(MachInst); 179 DPRINTF(Loader, "fixFuncEventAddr: %p -> %p", addr, new_addr); 180 return new_addr; 181 } else { 182 return addr; 183 } 184} 185 186void 187AlphaSystem::setAlphaAccess(Addr access) 188{ 189 Addr addr = 0; 190 if (consoleSymtab->findAddress("m5AlphaAccess", addr)) { |
191 virtPort->write(addr, htog(Phys2K0Seg(access))); |
192 } else { 193 panic("could not find m5AlphaAccess\n"); 194 } 195} 196 197void 198AlphaSystem::serialize(std::ostream &os) 199{ --- 18 unchanged lines hidden --- |