15222Sksewell@umich.edu/*
25268Sksewell@umich.edu * Copyright (c) 2004-2006 The Regents of The University of Michigan
35254Sksewell@umich.edu * All rights reserved.
45222Sksewell@umich.edu *
55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are
75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
145254Sksewell@umich.edu * this software without specific prior written permission.
155222Sksewell@umich.edu *
165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275222Sksewell@umich.edu *
285254Sksewell@umich.edu * Authors: Ali Saidi
295254Sksewell@umich.edu *          Lisa Hsu
305254Sksewell@umich.edu *          Nathan Binkert
315222Sksewell@umich.edu */
325222Sksewell@umich.edu
335222Sksewell@umich.edu#ifndef __ARCH_MIPS_LINUX_SYSTEM_HH__
345222Sksewell@umich.edu#define __ARCH_MIPS_LINUX_SYSTEM_HH__
355222Sksewell@umich.edu
365222Sksewell@umich.educlass ThreadContext;
375222Sksewell@umich.edu
385222Sksewell@umich.educlass BreakPCEvent;
395222Sksewell@umich.educlass IdleStartEvent;
405222Sksewell@umich.edu
415222Sksewell@umich.edu#include "arch/mips/idle_event.hh"
425222Sksewell@umich.edu#include "arch/mips/system.hh"
435222Sksewell@umich.edu#include "kern/linux/events.hh"
445222Sksewell@umich.edu#include "params/LinuxMipsSystem.hh"
455222Sksewell@umich.edu
465222Sksewell@umich.edu/**
475222Sksewell@umich.edu * This class contains linux specific system code (Loading, Events).
485222Sksewell@umich.edu * It points to objects that are the system binaries to load and patches them
495222Sksewell@umich.edu * appropriately to work in simulator.
505222Sksewell@umich.edu */
515222Sksewell@umich.educlass LinuxMipsSystem : public MipsSystem
525222Sksewell@umich.edu{
535222Sksewell@umich.edu  private:
545222Sksewell@umich.edu    class SkipDelayLoopEvent : public SkipFuncEvent
555222Sksewell@umich.edu    {
565222Sksewell@umich.edu      public:
575222Sksewell@umich.edu        SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr)
585222Sksewell@umich.edu            : SkipFuncEvent(q, desc, addr) {}
595222Sksewell@umich.edu        virtual void process(ThreadContext *tc);
605222Sksewell@umich.edu    };
615222Sksewell@umich.edu
625222Sksewell@umich.edu    class PrintThreadInfo : public PCEvent
635222Sksewell@umich.edu    {
645222Sksewell@umich.edu      public:
655222Sksewell@umich.edu        PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr)
665222Sksewell@umich.edu            : PCEvent(q, desc, addr) {}
675222Sksewell@umich.edu        virtual void process(ThreadContext *tc);
685222Sksewell@umich.edu    };
695222Sksewell@umich.edu
705222Sksewell@umich.edu
715222Sksewell@umich.edu    /**
725222Sksewell@umich.edu     * Addresses defining where the kernel bootloader places various
735222Sksewell@umich.edu     * elements.  Details found in include/asm-mips/system.h
745222Sksewell@umich.edu     */
755222Sksewell@umich.edu    Addr KernelStart; // Lookup the symbol swapper_pg_dir
765222Sksewell@umich.edu
775222Sksewell@umich.edu  public:
785222Sksewell@umich.edu    Addr InitStack() const { return KernelStart + 0x02000; }
795222Sksewell@umich.edu    Addr EmptyPGT() const  { return KernelStart + 0x04000; }
805222Sksewell@umich.edu    Addr EmptyPGE() const  { return KernelStart + 0x08000; }
815222Sksewell@umich.edu    Addr ZeroPGE() const   { return KernelStart + 0x0A000; }
825222Sksewell@umich.edu    Addr StartAddr() const { return KernelStart + 0x10000; }
835222Sksewell@umich.edu
845222Sksewell@umich.edu    Addr Param() const { return ZeroPGE() + 0x0; }
855222Sksewell@umich.edu    Addr CommandLine() const { return Param() + 0x0; }
865222Sksewell@umich.edu    Addr InitrdStart() const { return Param() + 0x100; }
875222Sksewell@umich.edu    Addr InitrdSize() const { return Param() + 0x108; }
885222Sksewell@umich.edu    static const int CommandLineSize = 256;
895222Sksewell@umich.edu
905222Sksewell@umich.edu  public:
915222Sksewell@umich.edu    typedef LinuxMipsSystemParams Params;
925222Sksewell@umich.edu    LinuxMipsSystem(Params *p);
935222Sksewell@umich.edu    ~LinuxMipsSystem();
945222Sksewell@umich.edu
955222Sksewell@umich.edu    void setDelayLoop(ThreadContext *tc);
965222Sksewell@umich.edu};
975222Sksewell@umich.edu
985222Sksewell@umich.edu#endif // __ARCH_MIPS_LINUX_SYSTEM_HH__
99