system.cc (5566:3440c9ad49b4) system.cc (5568:d14250d688d2)
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
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;
45
46
46using namespace LittleEndianGuest;
47
48AlphaSystem::AlphaSystem(Params *p)
49 : System(p)
50{
51 consoleSymtab = new SymbolTable;
52 palSymtab = new SymbolTable;
53
54
55 /**

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

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
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);
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

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

167 // mask for just the opcode, Ra, and Rb fields (not the offset)
168 const uint32_t inst_mask = 0xffff0000;
169 // ldah gp,X(pv): opcode 9, Ra = 29, Rb = 27
170 const uint32_t gp_ldah_pattern = (9 << 26) | (29 << 21) | (27 << 16);
171 // lda gp,Y(gp): opcode 8, Ra = 29, rb = 29
172 const uint32_t gp_lda_pattern = (8 << 26) | (29 << 21) | (29 << 16);
173
174 uint32_t i1 = virtPort.read<uint32_t>(addr);
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));
176
177 if ((i1 & inst_mask) == gp_ldah_pattern &&
178 (i2 & inst_mask) == gp_lda_pattern) {
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);
180 DPRINTF(Loader, "fixFuncEventAddr: %p -> %p", addr, new_addr);
181 return new_addr;
182 } else {
183 return addr;
184 }
185}
186
187
188void
189AlphaSystem::setAlphaAccess(Addr access)
190{
191 Addr addr = 0;
192 if (consoleSymtab->findAddress("m5AlphaAccess", addr)) {
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)));
194 } else
195 panic("could not find m5AlphaAccess\n");
196}
197
198void
199AlphaSystem::serialize(std::ostream &os)
200{
201 System::serialize(os);

--- 18 unchanged lines hidden ---
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 ---