backdoor.hh revision 2158
12124SN/A/* 22124SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 32754Sksewell@umich.edu * All rights reserved. 42124SN/A * 52022SN/A * Redistribution and use in source and binary forms, with or without 62124SN/A * modification, are permitted provided that the following conditions are 72124SN/A * met: redistributions of source code must retain the above copyright 82124SN/A * notice, this list of conditions and the following disclaimer; 92124SN/A * redistributions in binary form must reproduce the above copyright 102124SN/A * notice, this list of conditions and the following disclaimer in the 112124SN/A * documentation and/or other materials provided with the distribution; 122124SN/A * neither the name of the copyright holders nor the names of its 132124SN/A * contributors may be used to endorse or promote products derived from 142124SN/A * this software without specific prior written permission. 152124SN/A * 162022SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172124SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182124SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192124SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202124SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212124SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222124SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232124SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242124SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252124SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262124SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272124SN/A */ 282665Ssaidi@eecs.umich.edu 292935Sksewell@umich.edu/** @file 302665Ssaidi@eecs.umich.edu * System Console Interface 312022SN/A */ 322649Ssaidi@eecs.umich.edu 332649Ssaidi@eecs.umich.edu#ifndef __ALPHA_CONSOLE_HH__ 342706Sksewell@umich.edu#define __ALPHA_CONSOLE_HH__ 352649Ssaidi@eecs.umich.edu 362649Ssaidi@eecs.umich.edu#include "base/range.hh" 372022SN/A#include "dev/alpha_access.h" 382124SN/A#include "dev/io_device.hh" 392124SN/A#include "sim/host.hh" 402124SN/A#include "sim/sim_object.hh" 412124SN/A 422124SN/Aclass BaseCPU; 432124SN/Aclass SimConsole; 442124SN/Aclass AlphaSystem; 452124SN/Aclass SimpleDisk; 462124SN/A 472124SN/A/** 482124SN/A * Memory mapped interface to the system console. This device 492124SN/A * represents a shared data region between the OS Kernel and the 502124SN/A * System Console. 512239SN/A * 522124SN/A * The system console is a small standalone program that is initially 532124SN/A * run when the system boots. It contains the necessary code to 542124SN/A * access the boot disk, to read/write from the console, and to pass 552124SN/A * boot parameters to the kernel. 562124SN/A * 572124SN/A * This version of the system console is very different from the one 582124SN/A * that would be found in a real system. Many of the functions use 592124SN/A * some sort of backdoor to get their job done. For example, reading 602124SN/A * from the boot device on a real system would require a minimal 612742Sksewell@umich.edu * device driver to access the disk controller, but since we have a 622022SN/A * simulator here, we are able to bypass the disk controller and 632124SN/A * access the disk image directly. There are also some things like 642022SN/A * reading the kernel off the disk image into memory that are normally 652124SN/A * taken care of by the console that are now taken care of by the 662124SN/A * simulator. 672022SN/A * 682124SN/A * These shortcuts are acceptable since the system console is 692124SN/A * primarily used doing boot before the kernel has loaded its device 702124SN/A * drivers. 712124SN/A */ 722124SN/Aclass AlphaConsole : public PioDevice 732124SN/A{ 742742Sksewell@umich.edu protected: 752742Sksewell@umich.edu struct Access : public AlphaAccess 762742Sksewell@umich.edu { 772742Sksewell@umich.edu void serialize(std::ostream &os); 782742Sksewell@umich.edu void unserialize(Checkpoint *cp, const std::string §ion); 792742Sksewell@umich.edu }; 802742Sksewell@umich.edu 812742Sksewell@umich.edu union { 822742Sksewell@umich.edu Access *alphaAccess; 832742Sksewell@umich.edu uint8_t *consoleData; 842742Sksewell@umich.edu }; 852742Sksewell@umich.edu 862742Sksewell@umich.edu /** the disk must be accessed from the console */ 872742Sksewell@umich.edu SimpleDisk *disk; 882742Sksewell@umich.edu 892742Sksewell@umich.edu /** the system console (the terminal) is accessable from the console */ 902742Sksewell@umich.edu SimConsole *console; 912742Sksewell@umich.edu 922022SN/A /** a pointer to the system we are running in */ 932022SN/A AlphaSystem *system; 942124SN/A 952022SN/A /** a pointer to the CPU boot cpu */ 962124SN/A BaseCPU *cpu; 972124SN/A 982124SN/A Addr addr; 992742Sksewell@umich.edu static const Addr size = sizeof(struct AlphaAccess); 1002239SN/A 1012124SN/A public: 1022124SN/A /** Standard Constructor */ 1032742Sksewell@umich.edu AlphaConsole(const std::string &name, SimConsole *cons, SimpleDisk *d, 1042742Sksewell@umich.edu AlphaSystem *s, BaseCPU *c, Platform *platform, 1052742Sksewell@umich.edu MemoryController *mmu, Addr addr, 1062742Sksewell@umich.edu HierParams *hier, Bus *pio_bus); 1072742Sksewell@umich.edu 1082742Sksewell@umich.edu virtual void startup(); 1092742Sksewell@umich.edu 1102742Sksewell@umich.edu /** 1112022SN/A * memory mapped reads and writes 1122022SN/A */ 1132124SN/A virtual Fault read(MemReqPtr &req, uint8_t *data); 1142124SN/A virtual Fault write(MemReqPtr &req, const uint8_t *data); 1152124SN/A 1162124SN/A /** 1172124SN/A * standard serialization routines for checkpointing 1182124SN/A */ 1192124SN/A virtual void serialize(std::ostream &os); 1202124SN/A virtual void unserialize(Checkpoint *cp, const std::string §ion); 1212124SN/A 1222124SN/A public: 1232124SN/A Tick cacheAccess(MemReqPtr &req); 1242124SN/A}; 1252124SN/A 1262124SN/A#endif // __ALPHA_CONSOLE_HH__ 1272124SN/A