system.hh revision 885
13760SN/A/*
23760SN/A * Copyright (c) 2003 The Regents of The University of Michigan
33760SN/A * All rights reserved.
43760SN/A *
53760SN/A * Redistribution and use in source and binary forms, with or without
63760SN/A * modification, are permitted provided that the following conditions are
73760SN/A * met: redistributions of source code must retain the above copyright
83760SN/A * notice, this list of conditions and the following disclaimer;
93760SN/A * redistributions in binary form must reproduce the above copyright
103760SN/A * notice, this list of conditions and the following disclaimer in the
113760SN/A * documentation and/or other materials provided with the distribution;
123760SN/A * neither the name of the copyright holders nor the names of its
133760SN/A * contributors may be used to endorse or promote products derived from
143760SN/A * this software without specific prior written permission.
153760SN/A *
163760SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173760SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183760SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193760SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203760SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213760SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223760SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233760SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243760SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253760SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263760SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273760SN/A */
285597Sgblack@eecs.umich.edu
293760SN/A#ifndef __LINUX_SYSTEM_HH__
303760SN/A#define __LINUX_SYSTEM_HH__
318229Snate@binkert.org
323760SN/A#include <vector>
333760SN/A
343760SN/A#include "sim/system.hh"
355597Sgblack@eecs.umich.edu#include "sim/host.hh"
363760SN/A#include "targetarch/isa_traits.hh"
37
38#include <map>
39
40/**
41 * MAGIC address where the kernel arguments should go. Defined as
42 * PARAM in linux kernel alpha-asm.
43 */
44const Addr PARAM_ADDR =  ULL(0xfffffc000030a000);
45
46class ExecContext;
47class ElfObject;
48class SymbolTable;
49
50class BreakPCEvent;
51class LinuxSkipDelayLoopEvent;
52class SkipFuncEvent;
53class FnEvent;
54class AlphaArguments;
55
56/**
57 * This class contains linux specific system code (Loading, Events, Binning).
58 * It points to objects that are the system binaries to load and patches them
59 * appropriately to work in simulator.
60 */
61class LinuxSystem : public System
62{
63  private:
64    ElfObject *kernel;
65    ElfObject *console;
66
67    SymbolTable *kernelSymtab;
68    SymbolTable *consoleSymtab;
69
70    BreakPCEvent *kernelPanicEvent;
71    BreakPCEvent *consolePanicEvent;
72    SkipFuncEvent *skipCacheProbeEvent;
73    SkipFuncEvent *skipIdeDelay50msEvent;
74    LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
75
76    Addr kernelStart;
77    Addr kernelEnd;
78    Addr kernelEntry;
79    bool bin;
80    std::vector<string> binned_fns;
81
82  public:
83    std::vector<RemoteGDB *>   remoteGDB;
84    std::vector<GDBListener *> gdbListen;
85
86    LinuxSystem(const std::string _name,
87                const uint64_t _init_param,
88                MemoryController *_memCtrl,
89                PhysicalMemory *_physmem,
90                const std::string &kernel_path,
91                const std::string &console_path,
92                const std::string &palcode,
93                const std::string &boot_osflags,
94                const bool _bin,
95                const std::vector<std::string> &_binned_fns);
96
97    ~LinuxSystem();
98
99    void setDelayLoop(ExecContext *xc);
100
101    int registerExecContext(ExecContext *xc);
102    void replaceExecContext(ExecContext *xc, int xcIndex);
103
104    Addr getKernelStart() const { return kernelStart; }
105    Addr getKernelEnd() const { return kernelEnd; }
106    Addr getKernelEntry() const { return kernelEntry; }
107    bool breakpoint();
108};
109
110#endif // __LINUX_SYSTEM_HH__
111