backdoor.hh revision 217
1/* 2 * Copyright (c) 2003 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/* @file 30 * System Console Interface 31 */ 32 33#ifndef __ALPHA_CONSOLE_HH__ 34#define __ALPHA_CONSOLE_HH__ 35 36#include "sim/host.hh" 37#include "dev/alpha_access.h" 38#include "mem/functional_mem/mmap_device.hh" 39 40class BaseCPU; 41class SimConsole; 42class System; 43class TlaserClock; 44class SimpleDisk; 45 46/* 47 * Memory mapped interface to the system console. This device 48 * represents a shared data region between the OS Kernel and the 49 * System Console. 50 * 51 * The system console is a small standalone program that is initially 52 * run when the system boots. It contains the necessary code to 53 * access the boot disk, to read/write from the console, and to pass 54 * boot parameters to the kernel. 55 * 56 * This version of the system console is very different from the one 57 * that would be found in a real system. Many of the functions use 58 * some sort of backdoor to get their job done. For example, reading 59 * from the boot device on a real system would require a minimal 60 * device driver to access the disk controller, but since we have a 61 * simulator here, we are able to bypass the disk controller and 62 * access the disk image directly. There are also some things like 63 * reading the kernel off the disk image into memory that are normally 64 * taken care of by the console that are now taken care of by the 65 * simulator. 66 * 67 * These shortcuts are acceptable since the system console is 68 * primarily used doing boot before the kernel has loaded its device 69 * drivers. 70 */ 71class AlphaConsole : public MmapDevice 72{ 73 protected: 74 union { 75 AlphaAccess *alphaAccess; 76 uint8_t *consoleData; 77 }; 78 79 /** the disk must be accessed from the console */ 80 SimpleDisk *disk; 81 82 /** the system console (the terminal) is accessable from the console */ 83 SimConsole *console; 84 85 public: 86 /** Standard Constructor */ 87 AlphaConsole(const std::string &name, SimConsole *cons, 88 SimpleDisk *d, int size, 89 System *system, BaseCPU *cpu, 90 TlaserClock *clock, int num_cpus, 91 Addr addr, Addr mask, MemoryController *mmu); 92 93 public: 94 /** 95 * memory mapped reads and writes 96 */ 97 virtual Fault read(MemReqPtr req, uint8_t *data); 98 virtual Fault write(MemReqPtr req, const uint8_t *data); 99 100 /** 101 * standard serialization routines for checkpointing 102 */ 103 virtual void serialize(std::ostream &os); 104 virtual void unserialize(IniFile &db, const std::string §ion); 105}; 106 107#endif // __ALPHA_CONSOLE_HH__ 108