backdoor.hh revision 2
12391SN/A/* 28931Sandreas.hansson@arm.com * Copyright (c) 2003 The Regents of The University of Michigan 38931Sandreas.hansson@arm.com * All rights reserved. 48931Sandreas.hansson@arm.com * 58931Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 68931Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 78931Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 88931Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 98931Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 108931Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 118931Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 128931Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 138931Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 142391SN/A * this software without specific prior written permission. 152391SN/A * 162391SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172391SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182391SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192391SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202391SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212391SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222391SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232391SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242391SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252391SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262391SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272391SN/A */ 282391SN/A 292391SN/A/* @file 302391SN/A * System Console Interface 312391SN/A */ 322391SN/A 332391SN/A#ifndef __ALPHA_CONSOLE_HH__ 342391SN/A#define __ALPHA_CONSOLE_HH__ 352391SN/A 362391SN/A#include "host.hh" 372391SN/A#include "alpha_access.h" 382391SN/A#include "mmap_device.hh" 392665SN/A 402665SN/Aclass BaseCPU; 418931Sandreas.hansson@arm.comclass SimConsole; 422391SN/Aclass System; 432391SN/Aclass TlaserClock; 448931Sandreas.hansson@arm.comclass SimpleDisk; 458931Sandreas.hansson@arm.com 468931Sandreas.hansson@arm.com/* 472391SN/A * Memory mapped interface to the system console. This device 482391SN/A * represents a shared data region between the OS Kernel and the 4912492Sodanrc@yahoo.com.br * System Console. 5012492Sodanrc@yahoo.com.br * 512391SN/A * The system console is a small standalone program that is initially 522462SN/A * run when the system boots. It contains the necessary code to 538931Sandreas.hansson@arm.com * access the boot disk, to read/write from the console, and to pass 548719SN/A * boot parameters to the kernel. 552462SN/A * 569053Sdam.sunwoo@arm.com * This version of the system console is very different from the one 579053Sdam.sunwoo@arm.com * that would be found in a real system. Many of the functions use 589053Sdam.sunwoo@arm.com * some sort of backdoor to get their job done. For example, reading 598931Sandreas.hansson@arm.com * from the boot device on a real system would require a minimal 609293Sandreas.hansson@arm.com * device driver to access the disk controller, but since we have a 619293Sandreas.hansson@arm.com * simulator here, we are able to bypass the disk controller and 629293Sandreas.hansson@arm.com * access the disk image directly. There are also some things like 639293Sandreas.hansson@arm.com * reading the kernel off the disk image into memory that are normally 649293Sandreas.hansson@arm.com * taken care of by the console that are now taken care of by the 659293Sandreas.hansson@arm.com * simulator. 669293Sandreas.hansson@arm.com * 679293Sandreas.hansson@arm.com * These shortcuts are acceptable since the system console is 689293Sandreas.hansson@arm.com * primarily used doing boot before the kernel has loaded its device 699293Sandreas.hansson@arm.com * drivers. 709293Sandreas.hansson@arm.com */ 719293Sandreas.hansson@arm.comclass AlphaConsole : public MmapDevice 729293Sandreas.hansson@arm.com{ 739293Sandreas.hansson@arm.com protected: 749293Sandreas.hansson@arm.com union { 759293Sandreas.hansson@arm.com AlphaAccess *alphaAccess; 769293Sandreas.hansson@arm.com uint8_t *consoleData; 7711005Sandreas.sandberg@arm.com }; 789293Sandreas.hansson@arm.com 799293Sandreas.hansson@arm.com /** the disk must be accessed from the console */ 809293Sandreas.hansson@arm.com SimpleDisk *disk; 819293Sandreas.hansson@arm.com 8212749Sgiacomo.travaglini@arm.com /** the system console (the terminal) is accessable from the console */ 839293Sandreas.hansson@arm.com SimConsole *console; 849293Sandreas.hansson@arm.com 859293Sandreas.hansson@arm.com public: 869293Sandreas.hansson@arm.com /** Standard Constructor */ 8712749Sgiacomo.travaglini@arm.com AlphaConsole(const std::string &name, SimConsole *cons, 8812749Sgiacomo.travaglini@arm.com SimpleDisk *d, int size, 899293Sandreas.hansson@arm.com System *system, BaseCPU *cpu, 909293Sandreas.hansson@arm.com TlaserClock *clock, int num_cpus, 919293Sandreas.hansson@arm.com Addr addr, Addr mask, MemoryController *mmu); 929293Sandreas.hansson@arm.com 939293Sandreas.hansson@arm.com public: 949293Sandreas.hansson@arm.com /** 959293Sandreas.hansson@arm.com * memory mapped reads and writes 969293Sandreas.hansson@arm.com */ 978931Sandreas.hansson@arm.com virtual Fault read(MemReqPtr req, uint8_t *data); 988931Sandreas.hansson@arm.com virtual Fault write(MemReqPtr req, const uint8_t *data); 998931Sandreas.hansson@arm.com 1008931Sandreas.hansson@arm.com /** 1018931Sandreas.hansson@arm.com * standard serialization routines for checkpointing 1028931Sandreas.hansson@arm.com */ 1038931Sandreas.hansson@arm.com virtual void serialize(); 1042391SN/A virtual void unserialize(IniFile &db, const std::string &category, 1056107SN/A ConfigNode *node); 1066107SN/A}; 1078931Sandreas.hansson@arm.com 1089235Sandreas.hansson@arm.com#endif // __ALPHA_CONSOLE_HH__ 1092413SN/A