system.hh revision 1855
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef __KERN_LINUX_LINUX_SYSTEM_HH__ 30#define __KERN_LINUX_LINUX_SYSTEM_HH__ 31 32class ExecContext; 33 34class BreakPCEvent; 35class DebugPrintkEvent; 36class BreakPCEvent; 37class LinuxSkipDelayLoopEvent; 38class SkipFuncEvent; 39class IdleStartEvent; 40class PrintThreadInfo; 41 42/** 43 * This class contains linux specific system code (Loading, Events, Binning). 44 * It points to objects that are the system binaries to load and patches them 45 * appropriately to work in simulator. 46 */ 47class LinuxSystem : public System 48{ 49 private: 50 /** 51 * Addresses defining where the kernel bootloader places various 52 * elements. Details found in include/asm-alpha/system.h 53 */ 54 Addr KernelStart; // Lookup the symbol swapper_pg_dir 55 56 public: 57 Addr InitStack() const { return KernelStart + 0x02000; } 58 Addr EmptyPGT() const { return KernelStart + 0x04000; } 59 Addr EmptyPGE() const { return KernelStart + 0x08000; } 60 Addr ZeroPGE() const { return KernelStart + 0x0A000; } 61 Addr StartAddr() const { return KernelStart + 0x10000; } 62 63 Addr Param() const { return ZeroPGE() + 0x0; } 64 Addr CommandLine() const { return Param() + 0x0; } 65 Addr InitrdStart() const { return Param() + 0x100; } 66 Addr InitrdSize() const { return Param() + 0x108; } 67 static const int CommandLineSize = 256; 68 69 private: 70#ifndef NDEBUG 71 /** Event to halt the simulator if the kernel calls panic() */ 72 BreakPCEvent *kernelPanicEvent; 73 74 /** Event to halt the simulator if the kernel calls die_if_kernel */ 75 BreakPCEvent *kernelDieEvent; 76#endif 77 78 /** 79 * Event to skip determine_cpu_caches() because we don't support 80 * the IPRs that the code can access to figure out cache sizes 81 */ 82 SkipFuncEvent *skipCacheProbeEvent; 83 84 /** PC based event to skip the ide_delay_50ms() call */ 85 SkipFuncEvent *skipIdeDelay50msEvent; 86 87 /** 88 * PC based event to skip the dprink() call and emulate its 89 * functionality 90 */ 91 DebugPrintkEvent *debugPrintkEvent; 92 93 /** 94 * Skip calculate_delay_loop() rather than waiting for this to be 95 * calculated 96 */ 97 LinuxSkipDelayLoopEvent *skipDelayLoopEvent; 98 99 /** 100 * Event to print information about thread switches if the trace flag 101 * Thread is set 102 */ 103 PrintThreadInfo *printThreadEvent; 104 105 /** 106 * Event to bin Interrupts seperately from kernel code 107 */ 108 InterruptStartEvent *intStartEvent; 109 110 /** 111 * Event to bin Interrupts seperately from kernel code 112 */ 113 InterruptEndEvent *intEndEvent; 114 InterruptEndEvent *intEndEvent2; 115 InterruptEndEvent *intEndEvent3; 116 117 /** Grab the PCBB of the idle process when it starts */ 118 IdleStartEvent *idleStartEvent; 119 120 public: 121 LinuxSystem(Params *p); 122 ~LinuxSystem(); 123 124 void setDelayLoop(ExecContext *xc); 125}; 126 127#endif // __KERN_LINUX_LINUX_SYSTEM_HH__ 128