system.hh revision 8885
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 46885SN/A/** 472343SN/A * This class contains linux specific system code (Loading, Events). 48885SN/A * It points to objects that are the system binaries to load and patches them 49885SN/A * appropriately to work in simulator. 50885SN/A */ 512212SN/Aclass LinuxAlphaSystem : public AlphaSystem 52451SN/A{ 53451SN/A private: 545569Snate@binkert.org struct SkipDelayLoopEvent : public SkipFuncEvent 551885SN/A { 561885SN/A SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr) 571885SN/A : SkipFuncEvent(q, desc, addr) {} 582680Sktlim@umich.edu virtual void process(ThreadContext *tc); 591885SN/A }; 601885SN/A 615569Snate@binkert.org struct PrintThreadInfo : public PCEvent 621885SN/A { 631885SN/A PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr) 641885SN/A : PCEvent(q, desc, addr) {} 652680Sktlim@umich.edu virtual void process(ThreadContext *tc); 661885SN/A }; 671885SN/A 681855SN/A /** 691855SN/A * Addresses defining where the kernel bootloader places various 701855SN/A * elements. Details found in include/asm-alpha/system.h 711855SN/A */ 721855SN/A Addr KernelStart; // Lookup the symbol swapper_pg_dir 731855SN/A 741855SN/A public: 751855SN/A Addr InitStack() const { return KernelStart + 0x02000; } 761855SN/A Addr EmptyPGT() const { return KernelStart + 0x04000; } 771855SN/A Addr EmptyPGE() const { return KernelStart + 0x08000; } 781855SN/A Addr ZeroPGE() const { return KernelStart + 0x0A000; } 791855SN/A Addr StartAddr() const { return KernelStart + 0x10000; } 801855SN/A 811855SN/A Addr Param() const { return ZeroPGE() + 0x0; } 821855SN/A Addr CommandLine() const { return Param() + 0x0; } 831855SN/A Addr InitrdStart() const { return Param() + 0x100; } 841855SN/A Addr InitrdSize() const { return Param() + 0x108; } 851855SN/A static const int CommandLineSize = 256; 861855SN/A 871855SN/A private: 881492SN/A#ifndef NDEBUG 89887SN/A /** Event to halt the simulator if the kernel calls panic() */ 90451SN/A BreakPCEvent *kernelPanicEvent; 911492SN/A 921492SN/A /** Event to halt the simulator if the kernel calls die_if_kernel */ 931492SN/A BreakPCEvent *kernelDieEvent; 941070SN/A#endif 95887SN/A 961070SN/A /** 971070SN/A * Event to skip determine_cpu_caches() because we don't support 981070SN/A * the IPRs that the code can access to figure out cache sizes 99887SN/A */ 100885SN/A SkipFuncEvent *skipCacheProbeEvent; 101887SN/A 102887SN/A /** PC based event to skip the ide_delay_50ms() call */ 103885SN/A SkipFuncEvent *skipIdeDelay50msEvent; 104887SN/A 1051070SN/A /** 1061070SN/A * PC based event to skip the dprink() call and emulate its 1071070SN/A * functionality 1081070SN/A */ 1095991Ssteve.reinhardt@amd.com Linux::DebugPrintkEvent *debugPrintkEvent; 1101039SN/A 1111070SN/A /** 1121070SN/A * Skip calculate_delay_loop() rather than waiting for this to be 113887SN/A * calculated 114887SN/A */ 1151885SN/A SkipDelayLoopEvent *skipDelayLoopEvent; 116841SN/A 1171082SN/A /** 1181082SN/A * Event to print information about thread switches if the trace flag 1191082SN/A * Thread is set 1201082SN/A */ 1211067SN/A PrintThreadInfo *printThreadEvent; 1221067SN/A 1231070SN/A /** Grab the PCBB of the idle process when it starts */ 1241070SN/A IdleStartEvent *idleStartEvent; 125451SN/A 1268885SAli.Saidi@ARM.com protected: 1278885SAli.Saidi@ARM.com /** Setup all the function events. Must be done after init() for Alpha since 1288885SAli.Saidi@ARM.com * fixFuncEvent() requires a function port 1298885SAli.Saidi@ARM.com */ 1308885SAli.Saidi@ARM.com virtual void setupFuncEvents(); 1318885SAli.Saidi@ARM.com 132451SN/A public: 1334762Snate@binkert.org typedef LinuxAlphaSystemParams Params; 1342212SN/A LinuxAlphaSystem(Params *p); 1352212SN/A ~LinuxAlphaSystem(); 136451SN/A 1378706Sandreas.hansson@arm.com /** 1388706Sandreas.hansson@arm.com * Initialise the system 1398706Sandreas.hansson@arm.com */ 1408706Sandreas.hansson@arm.com virtual void initState(); 1418706Sandreas.hansson@arm.com 1422680Sktlim@umich.edu void setDelayLoop(ThreadContext *tc); 1438799Sgblack@eecs.umich.edu 1448799Sgblack@eecs.umich.edu const Params *params() const { return (const Params *)_params; } 145451SN/A}; 146451SN/A 1472212SN/A#endif // __ARCH_ALPHA_LINUX_SYSTEM_HH__ 148