backdoor.hh revision 843
12124SN/A/* 22124SN/A * Copyright (c) 2003 The Regents of The University of Michigan 35268Sksewell@umich.edu * All rights reserved. 45268Sksewell@umich.edu * 55268Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65268Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75268Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95268Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115268Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125268Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135268Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145268Sksewell@umich.edu * this software without specific prior written permission. 155268Sksewell@umich.edu * 165268Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175268Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185268Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195268Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205268Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215268Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225268Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235268Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245268Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255268Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265268Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275268Sksewell@umich.edu */ 285268Sksewell@umich.edu 295268Sksewell@umich.edu/* @file 305268Sksewell@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 "dev/tsunami_io.hh" 412124SN/A#include "sim/sim_object.hh" 422124SN/A 432124SN/Aclass BaseCPU; 442124SN/Aclass SimConsole; 452124SN/Aclass System; 465736Snate@binkert.orgclass TlaserClock; 472124SN/Aclass SimpleDisk; 482124SN/A 492124SN/A/* 502124SN/A * Memory mapped interface to the system console. This device 512239SN/A * represents a shared data region between the OS Kernel and the 522124SN/A * System Console. 532124SN/A * 542124SN/A * The system console is a small standalone program that is initially 552124SN/A * run when the system boots. It contains the necessary code to 562124SN/A * access the boot disk, to read/write from the console, and to pass 572124SN/A * boot parameters to the kernel. 582124SN/A * 592124SN/A * This version of the system console is very different from the one 605736Snate@binkert.org * that would be found in a real system. Many of the functions use 612742Sksewell@umich.edu * some sort of backdoor to get their job done. For example, reading 622022SN/A * from the boot device on a real system would require a minimal 632124SN/A * device driver to access the disk controller, but since we have a 642022SN/A * simulator here, we are able to bypass the disk controller and 652124SN/A * access the disk image directly. There are also some things like 662124SN/A * reading the kernel off the disk image into memory that are normally 672022SN/A * taken care of by the console that are now taken care of by the 682124SN/A * simulator. 692124SN/A * 702124SN/A * These shortcuts are acceptable since the system console is 712124SN/A * primarily used doing boot before the kernel has loaded its device 724661Sksewell@umich.edu * drivers. 735736Snate@binkert.org */ 742124SN/Aclass AlphaConsole : public PioDevice 752124SN/A{ 762742Sksewell@umich.edu protected: 772742Sksewell@umich.edu union { 782742Sksewell@umich.edu AlphaAccess *alphaAccess; 792742Sksewell@umich.edu uint8_t *consoleData; 802742Sksewell@umich.edu }; 812742Sksewell@umich.edu 822742Sksewell@umich.edu /** the disk must be accessed from the console */ 832742Sksewell@umich.edu SimpleDisk *disk; 842742Sksewell@umich.edu 852742Sksewell@umich.edu /** the system console (the terminal) is accessable from the console */ 862742Sksewell@umich.edu SimConsole *console; 872742Sksewell@umich.edu 882742Sksewell@umich.edu Addr addr; 892742Sksewell@umich.edu static const Addr size = 0x80; // equal to sizeof(alpha_access); 902742Sksewell@umich.edu 912742Sksewell@umich.edu public: 922742Sksewell@umich.edu /** Standard Constructor */ 932742Sksewell@umich.edu AlphaConsole(const std::string &name, SimConsole *cons, SimpleDisk *d, 942022SN/A System *system, BaseCPU *cpu, SimObject *clock, 952022SN/A int num_cpus, MemoryController *mmu, Addr addr, 962124SN/A HierParams *hier, Bus *bus); 972022SN/A 982124SN/A /** 992124SN/A * memory mapped reads and writes 1002124SN/A */ 1012742Sksewell@umich.edu virtual Fault read(MemReqPtr &req, uint8_t *data); 1022239SN/A virtual Fault write(MemReqPtr &req, const uint8_t *data); 1032124SN/A 1042124SN/A /** 1052742Sksewell@umich.edu * standard serialization routines for checkpointing 1062742Sksewell@umich.edu */ 1072742Sksewell@umich.edu virtual void serialize(std::ostream &os); 1082742Sksewell@umich.edu virtual void unserialize(Checkpoint *cp, const std::string §ion); 1092742Sksewell@umich.edu 1102742Sksewell@umich.edu public: 1112742Sksewell@umich.edu Tick cacheAccess(MemReqPtr &req); 1122742Sksewell@umich.edu}; 1134661Sksewell@umich.edu 1144661Sksewell@umich.edu#endif // __ALPHA_CONSOLE_HH__ 1154661Sksewell@umich.edu