backdoor.hh revision 2
12124SN/A/*
22124SN/A * Copyright (c) 2003 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 "host.hh"
372022SN/A#include "alpha_access.h"
382124SN/A#include "mmap_device.hh"
392124SN/A
402124SN/Aclass BaseCPU;
412124SN/Aclass SimConsole;
422124SN/Aclass System;
432124SN/Aclass TlaserClock;
442124SN/Aclass SimpleDisk;
452124SN/A
462124SN/A/*
472124SN/A * Memory mapped interface to the system console. This device
482124SN/A * represents a shared data region between the OS Kernel and the
492124SN/A * System Console.
502124SN/A *
512239SN/A * The system console is a small standalone program that is initially
522124SN/A * run when the system boots.  It contains the necessary code to
532124SN/A * access the boot disk, to read/write from the console, and to pass
542124SN/A * boot parameters to the kernel.
552124SN/A *
562124SN/A * This version of the system console is very different from the one
572124SN/A * that would be found in a real system.  Many of the functions use
582124SN/A * some sort of backdoor to get their job done.  For example, reading
592124SN/A * from the boot device on a real system would require a minimal
602124SN/A * device driver to access the disk controller, but since we have a
612742Sksewell@umich.edu * simulator here, we are able to bypass the disk controller and
622022SN/A * access the disk image directly.  There are also some things like
632124SN/A * reading the kernel off the disk image into memory that are normally
642022SN/A * taken care of by the console that are now taken care of by the
652124SN/A * simulator.
662124SN/A *
672022SN/A * These shortcuts are acceptable since the system console is
682124SN/A * primarily used doing boot before the kernel has loaded its device
692124SN/A * drivers.
702124SN/A */
712124SN/Aclass AlphaConsole : public MmapDevice
722124SN/A{
732124SN/A  protected:
742742Sksewell@umich.edu    union {
752742Sksewell@umich.edu        AlphaAccess *alphaAccess;
762742Sksewell@umich.edu        uint8_t *consoleData;
772742Sksewell@umich.edu    };
782742Sksewell@umich.edu
792742Sksewell@umich.edu    /** the disk must be accessed from the console */
802742Sksewell@umich.edu    SimpleDisk *disk;
812742Sksewell@umich.edu
822742Sksewell@umich.edu    /** the system console (the terminal) is accessable from the console */
832742Sksewell@umich.edu    SimConsole *console;
842742Sksewell@umich.edu
852742Sksewell@umich.edu  public:
862742Sksewell@umich.edu    /** Standard Constructor */
872742Sksewell@umich.edu    AlphaConsole(const std::string &name, SimConsole *cons,
882742Sksewell@umich.edu                 SimpleDisk *d, int size,
892742Sksewell@umich.edu                 System *system, BaseCPU *cpu,
902742Sksewell@umich.edu                 TlaserClock *clock, int num_cpus,
912742Sksewell@umich.edu                 Addr addr, Addr mask, MemoryController *mmu);
922022SN/A
932022SN/A  public:
942124SN/A    /**
952022SN/A     * memory mapped reads and writes
962124SN/A     */
972124SN/A    virtual Fault read(MemReqPtr req, uint8_t *data);
982124SN/A    virtual Fault write(MemReqPtr req, const uint8_t *data);
992742Sksewell@umich.edu
1002239SN/A    /**
1012124SN/A     * standard serialization routines for checkpointing
1022124SN/A     */
1032742Sksewell@umich.edu    virtual void serialize();
1042742Sksewell@umich.edu    virtual void unserialize(IniFile &db, const std::string &category,
1052742Sksewell@umich.edu                             ConfigNode *node);
1062742Sksewell@umich.edu};
1072742Sksewell@umich.edu
1082742Sksewell@umich.edu#endif // __ALPHA_CONSOLE_HH__
1092742Sksewell@umich.edu