system.hh revision 887
14120SN/A/* 25417SN/A * Copyright (c) 2003 The Regents of The University of Michigan 34120SN/A * All rights reserved. 44120SN/A * 57087SN/A * Redistribution and use in source and binary forms, with or without 67087SN/A * modification, are permitted provided that the following conditions are 77087SN/A * met: redistributions of source code must retain the above copyright 87087SN/A * notice, this list of conditions and the following disclaimer; 97087SN/A * redistributions in binary form must reproduce the above copyright 107087SN/A * notice, this list of conditions and the following disclaimer in the 117087SN/A * documentation and/or other materials provided with the distribution; 127087SN/A * neither the name of the copyright holders nor the names of its 134120SN/A * contributors may be used to endorse or promote products derived from 147087SN/A * this software without specific prior written permission. 157087SN/A * 167087SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177087SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187087SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197087SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207087SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217087SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224120SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237087SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244120SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254120SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264120SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274120SN/A */ 284120SN/A 294120SN/A#ifndef __LINUX_SYSTEM_HH__ 304120SN/A#define __LINUX_SYSTEM_HH__ 314120SN/A 324120SN/A#include <vector> 334120SN/A 344120SN/A#include "sim/system.hh" 354120SN/A#include "sim/host.hh" 364120SN/A#include "targetarch/isa_traits.hh" 374120SN/A 384120SN/A#include <map> 394120SN/A 408105Sgblack@eecs.umich.edu/** 418105Sgblack@eecs.umich.edu * MAGIC address where the kernel arguments should go. Defined as 424120SN/A * PARAM in linux kernel alpha-asm. 434152SN/A */ 444152SN/Aconst Addr PARAM_ADDR = ULL(0xfffffc000030a000); 454152SN/A 464152SN/Aclass ExecContext; 474152SN/Aclass ElfObject; 484152SN/Aclass SymbolTable; 499897Sandreas@sandberg.pp.se 507629SN/Aclass BreakPCEvent; 515182SN/Aclass LinuxSkipDelayLoopEvent; 524152SN/Aclass SkipFuncEvent; 534152SN/Aclass FnEvent; 544120SN/Aclass AlphaArguments; 554120SN/A 564120SN/A/** 579180Sandreas.hansson@arm.com * This class contains linux specific system code (Loading, Events, Binning). 584152SN/A * It points to objects that are the system binaries to load and patches them 594152SN/A * appropriately to work in simulator. 609897Sandreas@sandberg.pp.se */ 619897Sandreas@sandberg.pp.seclass LinuxSystem : public System 629897Sandreas@sandberg.pp.se{ 639897Sandreas@sandberg.pp.se private: 649897Sandreas@sandberg.pp.se /** Object pointer for the kernel code */ 6513613Sgabeblack@google.com ElfObject *kernel; 6613613Sgabeblack@google.com 679897Sandreas@sandberg.pp.se /** Object pointer for the console code */ 6813613Sgabeblack@google.com ElfObject *console; 699897Sandreas@sandberg.pp.se 709897Sandreas@sandberg.pp.se /** kernel Symbol table */ 719897Sandreas@sandberg.pp.se SymbolTable *kernelSymtab; 724152SN/A 734152SN/A /** console symbol table */ 749180Sandreas.hansson@arm.com SymbolTable *consoleSymtab; 754152SN/A 764152SN/A /** Event to halt the simulator if the kernel calls panic() */ 779897Sandreas@sandberg.pp.se BreakPCEvent *kernelPanicEvent; 789897Sandreas@sandberg.pp.se 799897Sandreas@sandberg.pp.se /** Event to halt the simulator if the console calls panic() */ 809897Sandreas@sandberg.pp.se BreakPCEvent *consolePanicEvent; 819897Sandreas@sandberg.pp.se 8213613Sgabeblack@google.com /** Event to skip determine_cpu_caches() because we don't support the 8313613Sgabeblack@google.com * IPRs that the code can access to figure out cache sizes 849897Sandreas@sandberg.pp.se */ 8513613Sgabeblack@google.com SkipFuncEvent *skipCacheProbeEvent; 869897Sandreas@sandberg.pp.se 879897Sandreas@sandberg.pp.se /** PC based event to skip the ide_delay_50ms() call */ 889897Sandreas@sandberg.pp.se SkipFuncEvent *skipIdeDelay50msEvent; 899897Sandreas@sandberg.pp.se 904152SN/A /** Skip calculate_delay_loop() rather than waiting for this to be 918902Sandreas.hansson@arm.com * calculated 924120SN/A */ 938105Sgblack@eecs.umich.edu LinuxSkipDelayLoopEvent *skipDelayLoopEvent; 94 95 /** Begining of kernel code */ 96 Addr kernelStart; 97 98 /** End of kernel code */ 99 Addr kernelEnd; 100 101 /** Entry point in the kernel to start at */ 102 Addr kernelEntry; 103 104 bool bin; 105 std::vector<string> binned_fns; 106 107 public: 108 std::vector<RemoteGDB *> remoteGDB; 109 std::vector<GDBListener *> gdbListen; 110 111 LinuxSystem(const std::string _name, 112 const uint64_t _init_param, 113 MemoryController *_memCtrl, 114 PhysicalMemory *_physmem, 115 const std::string &kernel_path, 116 const std::string &console_path, 117 const std::string &palcode, 118 const std::string &boot_osflags, 119 const bool _bin, 120 const std::vector<std::string> &_binned_fns); 121 122 ~LinuxSystem(); 123 124 void setDelayLoop(ExecContext *xc); 125 126 int registerExecContext(ExecContext *xc); 127 void replaceExecContext(ExecContext *xc, int xcIndex); 128 129 /** 130 * Returns the addess the kernel starts at. 131 * @return address the kernel starts at 132 */ 133 Addr getKernelStart() const { return kernelStart; } 134 135 /** 136 * Returns the addess the kernel ends at. 137 * @return address the kernel ends at 138 */ 139 Addr getKernelEnd() const { return kernelEnd; } 140 141 /** 142 * Returns the addess the entry point to the kernel code. 143 * @return entry point of the kernel code 144 */ 145 Addr getKernelEntry() const { return kernelEntry; } 146 147 148 bool breakpoint(); 149}; 150 151#endif // __LINUX_SYSTEM_HH__ 152