system.hh revision 4762
1451SN/A/*
22212SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan
3451SN/A * All rights reserved.
4451SN/A *
5451SN/A * Redistribution and use in source and binary forms, with or without
6451SN/A * modification, are permitted provided that the following conditions are
7451SN/A * met: redistributions of source code must retain the above copyright
8451SN/A * notice, this list of conditions and the following disclaimer;
9451SN/A * redistributions in binary form must reproduce the above copyright
10451SN/A * notice, this list of conditions and the following disclaimer in the
11451SN/A * documentation and/or other materials provided with the distribution;
12451SN/A * neither the name of the copyright holders nor the names of its
13451SN/A * contributors may be used to endorse or promote products derived from
14451SN/A * this software without specific prior written permission.
15451SN/A *
16451SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17451SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18451SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19451SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20451SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21451SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22451SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23451SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24451SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25451SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26451SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi
292665Ssaidi@eecs.umich.edu *          Lisa Hsu
302665Ssaidi@eecs.umich.edu *          Nathan Binkert
31451SN/A */
32451SN/A
332212SN/A#ifndef __ARCH_ALPHA_LINUX_SYSTEM_HH__
342212SN/A#define __ARCH_ALPHA_LINUX_SYSTEM_HH__
35451SN/A
362680Sktlim@umich.educlass ThreadContext;
371070SN/A
381070SN/Aclass BreakPCEvent;
391070SN/Aclass IdleStartEvent;
402212SN/A
413565Sgblack@eecs.umich.edu#include "arch/alpha/idle_event.hh"
422212SN/A#include "arch/alpha/system.hh"
432212SN/A#include "kern/linux/events.hh"
444762Snate@binkert.org#include "params/LinuxAlphaSystem.hh"
452212SN/A
462212SN/Ausing namespace AlphaISA;
472212SN/Ausing namespace Linux;
48451SN/A
49885SN/A/**
502343SN/A * This class contains linux specific system code (Loading, Events).
51885SN/A * It points to objects that are the system binaries to load and patches them
52885SN/A * appropriately to work in simulator.
53885SN/A */
542212SN/Aclass LinuxAlphaSystem : public AlphaSystem
55451SN/A{
56451SN/A  private:
571885SN/A    class SkipDelayLoopEvent : public SkipFuncEvent
581885SN/A    {
591885SN/A      public:
601885SN/A        SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr)
611885SN/A            : SkipFuncEvent(q, desc, addr) {}
622680Sktlim@umich.edu        virtual void process(ThreadContext *tc);
631885SN/A    };
641885SN/A
651885SN/A    class PrintThreadInfo : public PCEvent
661885SN/A    {
671885SN/A      public:
681885SN/A        PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr)
691885SN/A            : PCEvent(q, desc, addr) {}
702680Sktlim@umich.edu        virtual void process(ThreadContext *tc);
711885SN/A    };
721885SN/A
732212SN/A
741855SN/A    /**
751855SN/A     * Addresses defining where the kernel bootloader places various
761855SN/A     * elements.  Details found in include/asm-alpha/system.h
771855SN/A     */
781855SN/A    Addr KernelStart; // Lookup the symbol swapper_pg_dir
791855SN/A
801855SN/A  public:
811855SN/A    Addr InitStack() const { return KernelStart + 0x02000; }
821855SN/A    Addr EmptyPGT() const  { return KernelStart + 0x04000; }
831855SN/A    Addr EmptyPGE() const  { return KernelStart + 0x08000; }
841855SN/A    Addr ZeroPGE() const   { return KernelStart + 0x0A000; }
851855SN/A    Addr StartAddr() const { return KernelStart + 0x10000; }
861855SN/A
871855SN/A    Addr Param() const { return ZeroPGE() + 0x0; }
881855SN/A    Addr CommandLine() const { return Param() + 0x0; }
891855SN/A    Addr InitrdStart() const { return Param() + 0x100; }
901855SN/A    Addr InitrdSize() const { return Param() + 0x108; }
911855SN/A    static const int CommandLineSize = 256;
921855SN/A
931855SN/A  private:
941492SN/A#ifndef NDEBUG
95887SN/A    /** Event to halt the simulator if the kernel calls panic()  */
96451SN/A    BreakPCEvent *kernelPanicEvent;
971492SN/A
981492SN/A    /** Event to halt the simulator if the kernel calls die_if_kernel  */
991492SN/A    BreakPCEvent *kernelDieEvent;
1001070SN/A#endif
101887SN/A
1021070SN/A    /**
1031070SN/A     * Event to skip determine_cpu_caches() because we don't support
1041070SN/A     * the IPRs that the code can access to figure out cache sizes
105887SN/A     */
106885SN/A    SkipFuncEvent *skipCacheProbeEvent;
107887SN/A
108887SN/A    /** PC based event to skip the ide_delay_50ms() call */
109885SN/A    SkipFuncEvent *skipIdeDelay50msEvent;
110887SN/A
1111070SN/A    /**
1121070SN/A     * PC based event to skip the dprink() call and emulate its
1131070SN/A     * functionality
1141070SN/A     */
1151039SN/A    DebugPrintkEvent *debugPrintkEvent;
1161039SN/A
1171070SN/A    /**
1181070SN/A     * Skip calculate_delay_loop() rather than waiting for this to be
119887SN/A     * calculated
120887SN/A     */
1211885SN/A    SkipDelayLoopEvent *skipDelayLoopEvent;
122841SN/A
1231082SN/A    /**
1241082SN/A     * Event to print information about thread switches if the trace flag
1251082SN/A     * Thread is set
1261082SN/A     */
1271067SN/A    PrintThreadInfo *printThreadEvent;
1281067SN/A
1291070SN/A    /** Grab the PCBB of the idle process when it starts */
1301070SN/A    IdleStartEvent *idleStartEvent;
131451SN/A
132451SN/A  public:
1334762Snate@binkert.org    typedef LinuxAlphaSystemParams Params;
1342212SN/A    LinuxAlphaSystem(Params *p);
1352212SN/A    ~LinuxAlphaSystem();
136451SN/A
1372680Sktlim@umich.edu    void setDelayLoop(ThreadContext *tc);
138451SN/A};
139451SN/A
1402212SN/A#endif // __ARCH_ALPHA_LINUX_SYSTEM_HH__
141