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;

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

37#include "arch/vtophys.hh"
38#include "base/loader/object_file.hh"
39#include "base/loader/symtab.hh"
40#include "base/trace.hh"
41#include "mem/physical.hh"
42#include "params/AlphaSystem.hh"
43#include "sim/byteswap.hh"
44
45using namespace AlphaISA;
46
46using namespace LittleEndianGuest;
47
47AlphaSystem::AlphaSystem(Params *p)
48 : System(p)
49{
50 consoleSymtab = new SymbolTable;
51 palSymtab = new SymbolTable;
52
53
54 /**

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

61
62 // Load pal file
63 pal = createObjectFile(params()->pal);
64 if (pal == NULL)
65 fatal("Could not load PALcode file %s", params()->pal);
66
67
68 // Load program sections into memory
70 pal->loadSections(&functionalPort, AlphaISA::LoadAddrMask);
71 console->loadSections(&functionalPort, AlphaISA::LoadAddrMask);
69 pal->loadSections(&functionalPort, LoadAddrMask);
70 console->loadSections(&functionalPort, LoadAddrMask);
71
72 // load symbols
73 if (!console->loadGlobalSymbols(consoleSymtab))
74 panic("could not load console symbols\n");
75
76 if (!pal->loadGlobalSymbols(palSymtab))
77 panic("could not load pal symbols\n");
78

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

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);
175 uint32_t i2 = virtPort.read<uint32_t>(addr + sizeof(AlphaISA::MachInst));
174 uint32_t i2 = virtPort.read(addr + sizeof(MachInst));
175
176 if ((i1 & inst_mask) == gp_ldah_pattern &&
177 (i2 & inst_mask) == gp_lda_pattern) {
179 Addr new_addr = addr + 2* sizeof(AlphaISA::MachInst);
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
186
187void
188AlphaSystem::setAlphaAccess(Addr access)
189{
190 Addr addr = 0;
191 if (consoleSymtab->findAddress("m5AlphaAccess", addr)) {
193 virtPort.write(addr, htog(AlphaISA::Phys2K0Seg(access)));
192 virtPort.write(addr, htog(Phys2K0Seg(access)));
193 } else
194 panic("could not find m5AlphaAccess\n");
195}
196
197void
198AlphaSystem::serialize(std::ostream &os)
199{
200 System::serialize(os);

--- 18 unchanged lines hidden ---