system.hh revision 2343
14680Sgblack@eecs.umich.edu/* 25442Sgblack@eecs.umich.edu * Copyright (c) 2004-2006 The Regents of The University of Michigan 34680Sgblack@eecs.umich.edu * All rights reserved. 44680Sgblack@eecs.umich.edu * 54680Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64680Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 74680Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84680Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94680Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104680Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114680Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124680Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134680Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144680Sgblack@eecs.umich.edu * this software without specific prior written permission. 154680Sgblack@eecs.umich.edu * 164680Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174680Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184680Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194680Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204680Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214680Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224680Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234680Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244680Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254680Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264680Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274680Sgblack@eecs.umich.edu */ 284680Sgblack@eecs.umich.edu 294680Sgblack@eecs.umich.edu#ifndef __ARCH_ALPHA_LINUX_SYSTEM_HH__ 304680Sgblack@eecs.umich.edu#define __ARCH_ALPHA_LINUX_SYSTEM_HH__ 314680Sgblack@eecs.umich.edu 324680Sgblack@eecs.umich.educlass ExecContext; 334680Sgblack@eecs.umich.edu 3412450Sgabeblack@google.comclass BreakPCEvent; 3512450Sgabeblack@google.comclass IdleStartEvent; 3612450Sgabeblack@google.com 374680Sgblack@eecs.umich.edu#include "arch/alpha/system.hh" 384680Sgblack@eecs.umich.edu#include "kern/linux/events.hh" 395543Ssaidi@eecs.umich.edu 404680Sgblack@eecs.umich.eduusing namespace AlphaISA; 414680Sgblack@eecs.umich.eduusing namespace Linux; 424680Sgblack@eecs.umich.eduusing namespace std; 434680Sgblack@eecs.umich.edu 444680Sgblack@eecs.umich.edu/** 454680Sgblack@eecs.umich.edu * This class contains linux specific system code (Loading, Events). 464680Sgblack@eecs.umich.edu * It points to objects that are the system binaries to load and patches them 4712450Sgabeblack@google.com * appropriately to work in simulator. 4812450Sgabeblack@google.com */ 4912450Sgabeblack@google.comclass LinuxAlphaSystem : public AlphaSystem 5012450Sgabeblack@google.com{ 5112450Sgabeblack@google.com private: 5212450Sgabeblack@google.com class SkipDelayLoopEvent : public SkipFuncEvent 5312450Sgabeblack@google.com { 5412450Sgabeblack@google.com public: 5512450Sgabeblack@google.com SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr) 5612450Sgabeblack@google.com : SkipFuncEvent(q, desc, addr) {} 5712450Sgabeblack@google.com virtual void process(ExecContext *xc); 5812450Sgabeblack@google.com }; 5912450Sgabeblack@google.com 6012450Sgabeblack@google.com class PrintThreadInfo : public PCEvent 6112450Sgabeblack@google.com { 6212450Sgabeblack@google.com public: 6312450Sgabeblack@google.com PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr) 6412450Sgabeblack@google.com : PCEvent(q, desc, addr) {} 6512450Sgabeblack@google.com virtual void process(ExecContext *xc); 6612450Sgabeblack@google.com }; 6712450Sgabeblack@google.com 6812450Sgabeblack@google.com 6912450Sgabeblack@google.com /** 7012450Sgabeblack@google.com * Addresses defining where the kernel bootloader places various 7112450Sgabeblack@google.com * elements. Details found in include/asm-alpha/system.h 7212450Sgabeblack@google.com */ 7312450Sgabeblack@google.com Addr KernelStart; // Lookup the symbol swapper_pg_dir 7412450Sgabeblack@google.com 7512450Sgabeblack@google.com public: 7612450Sgabeblack@google.com Addr InitStack() const { return KernelStart + 0x02000; } 7712450Sgabeblack@google.com Addr EmptyPGT() const { return KernelStart + 0x04000; } 7812450Sgabeblack@google.com Addr EmptyPGE() const { return KernelStart + 0x08000; } 7912450Sgabeblack@google.com Addr ZeroPGE() const { return KernelStart + 0x0A000; } 8012450Sgabeblack@google.com Addr StartAddr() const { return KernelStart + 0x10000; } 8112450Sgabeblack@google.com 8212450Sgabeblack@google.com Addr Param() const { return ZeroPGE() + 0x0; } 8312450Sgabeblack@google.com Addr CommandLine() const { return Param() + 0x0; } 8412450Sgabeblack@google.com Addr InitrdStart() const { return Param() + 0x100; } 8512450Sgabeblack@google.com Addr InitrdSize() const { return Param() + 0x108; } 8612450Sgabeblack@google.com static const int CommandLineSize = 256; 8712450Sgabeblack@google.com 8812450Sgabeblack@google.com private: 8912450Sgabeblack@google.com#ifndef NDEBUG 9012450Sgabeblack@google.com /** Event to halt the simulator if the kernel calls panic() */ 9112450Sgabeblack@google.com BreakPCEvent *kernelPanicEvent; 9212450Sgabeblack@google.com 9312450Sgabeblack@google.com /** Event to halt the simulator if the kernel calls die_if_kernel */ 9412450Sgabeblack@google.com BreakPCEvent *kernelDieEvent; 9512450Sgabeblack@google.com#endif 9612450Sgabeblack@google.com 9712450Sgabeblack@google.com /** 9812450Sgabeblack@google.com * Event to skip determine_cpu_caches() because we don't support 9912450Sgabeblack@google.com * the IPRs that the code can access to figure out cache sizes 10012450Sgabeblack@google.com */ 10112450Sgabeblack@google.com SkipFuncEvent *skipCacheProbeEvent; 10212450Sgabeblack@google.com 10312450Sgabeblack@google.com /** PC based event to skip the ide_delay_50ms() call */ 10412450Sgabeblack@google.com SkipFuncEvent *skipIdeDelay50msEvent; 10512450Sgabeblack@google.com 10612450Sgabeblack@google.com /** 10712450Sgabeblack@google.com * PC based event to skip the dprink() call and emulate its 10812450Sgabeblack@google.com * functionality 10912450Sgabeblack@google.com */ 11012450Sgabeblack@google.com DebugPrintkEvent *debugPrintkEvent; 11112450Sgabeblack@google.com 11212450Sgabeblack@google.com /** 11312450Sgabeblack@google.com * Skip calculate_delay_loop() rather than waiting for this to be 11412450Sgabeblack@google.com * calculated 11512450Sgabeblack@google.com */ 11612450Sgabeblack@google.com SkipDelayLoopEvent *skipDelayLoopEvent; 11712450Sgabeblack@google.com 11812450Sgabeblack@google.com /** 11912450Sgabeblack@google.com * Event to print information about thread switches if the trace flag 12012450Sgabeblack@google.com * Thread is set 12112450Sgabeblack@google.com */ 12212450Sgabeblack@google.com PrintThreadInfo *printThreadEvent; 12312450Sgabeblack@google.com 12412450Sgabeblack@google.com /** Grab the PCBB of the idle process when it starts */ 12512450Sgabeblack@google.com IdleStartEvent *idleStartEvent; 12612450Sgabeblack@google.com 12712450Sgabeblack@google.com public: 12812450Sgabeblack@google.com LinuxAlphaSystem(Params *p); 12912450Sgabeblack@google.com ~LinuxAlphaSystem(); 13012450Sgabeblack@google.com 13112450Sgabeblack@google.com void setDelayLoop(ExecContext *xc); 13212450Sgabeblack@google.com}; 13312450Sgabeblack@google.com 13412450Sgabeblack@google.com#endif // __ARCH_ALPHA_LINUX_SYSTEM_HH__ 13512450Sgabeblack@google.com