system.cc revision 9329
15222Sksewell@umich.edu/*
25268Sksewell@umich.edu * Copyright (c) 2004-2006 The Regents of The University of Michigan
35254Sksewell@umich.edu * All rights reserved.
45222Sksewell@umich.edu *
55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are
75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
145254Sksewell@umich.edu * this software without specific prior written permission.
155222Sksewell@umich.edu *
165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275222Sksewell@umich.edu *
285254Sksewell@umich.edu * Authors: Ali Saidi
295254Sksewell@umich.edu *          Lisa Hsu
305254Sksewell@umich.edu *          Nathan Binkert
315222Sksewell@umich.edu */
325222Sksewell@umich.edu
335222Sksewell@umich.edu/**
345222Sksewell@umich.edu * @file
355222Sksewell@umich.edu * This code loads the linux kernel, console, pal and patches certain
365222Sksewell@umich.edu * functions.  The symbol tables are loaded so that traces can show
375222Sksewell@umich.edu * the executing function and we can skip functions. Various delay
385222Sksewell@umich.edu * loops are skipped and their final values manually computed to speed
395222Sksewell@umich.edu * up boot time.
405222Sksewell@umich.edu */
415222Sksewell@umich.edu
429329Sdam.sunwoo@arm.com#include "arch/generic/linux/threadinfo.hh"
435222Sksewell@umich.edu#include "arch/mips/linux/system.hh"
448229Snate@binkert.org#include "arch/mips/idle_event.hh"
455222Sksewell@umich.edu#include "arch/mips/system.hh"
468229Snate@binkert.org#include "arch/vtophys.hh"
475222Sksewell@umich.edu#include "base/loader/symtab.hh"
488229Snate@binkert.org#include "cpu/base.hh"
495222Sksewell@umich.edu#include "cpu/thread_context.hh"
508775Sgblack@eecs.umich.edu#include "debug/Thread.hh"
515222Sksewell@umich.edu#include "dev/platform.hh"
528229Snate@binkert.org#include "kern/linux/events.hh"
535222Sksewell@umich.edu#include "kern/linux/printk.hh"
545222Sksewell@umich.edu#include "mem/physical.hh"
555222Sksewell@umich.edu#include "mem/port.hh"
565222Sksewell@umich.edu#include "sim/arguments.hh"
575222Sksewell@umich.edu#include "sim/byteswap.hh"
585222Sksewell@umich.edu
595222Sksewell@umich.eduusing namespace std;
605222Sksewell@umich.eduusing namespace MipsISA;
615222Sksewell@umich.eduusing namespace Linux;
625222Sksewell@umich.edu
635222Sksewell@umich.eduLinuxMipsSystem::LinuxMipsSystem(Params *p)
645222Sksewell@umich.edu    : MipsSystem(p)
655222Sksewell@umich.edu{
665222Sksewell@umich.edu}
675222Sksewell@umich.edu
685222Sksewell@umich.eduLinuxMipsSystem::~LinuxMipsSystem()
695222Sksewell@umich.edu{
705222Sksewell@umich.edu}
715222Sksewell@umich.edu
725222Sksewell@umich.edu
735222Sksewell@umich.eduvoid
745222Sksewell@umich.eduLinuxMipsSystem::setDelayLoop(ThreadContext *tc)
755222Sksewell@umich.edu{
768741Sgblack@eecs.umich.edu    panic("setDelayLoop not implemented.\n");
775222Sksewell@umich.edu}
785222Sksewell@umich.edu
795222Sksewell@umich.edu
805222Sksewell@umich.eduvoid
815222Sksewell@umich.eduLinuxMipsSystem::SkipDelayLoopEvent::process(ThreadContext *tc)
825222Sksewell@umich.edu{
835222Sksewell@umich.edu    SkipFuncEvent::process(tc);
845222Sksewell@umich.edu    // calculate and set loops_per_jiffy
855222Sksewell@umich.edu    ((LinuxMipsSystem *)tc->getSystemPtr())->setDelayLoop(tc);
865222Sksewell@umich.edu}
875222Sksewell@umich.edu
885222Sksewell@umich.eduvoid
895222Sksewell@umich.eduLinuxMipsSystem::PrintThreadInfo::process(ThreadContext *tc)
905222Sksewell@umich.edu{
915222Sksewell@umich.edu    Linux::ThreadInfo ti(tc);
925222Sksewell@umich.edu
935222Sksewell@umich.edu    DPRINTF(Thread, "Currently Executing Thread %s, pid %d, started at: %d\n",
945222Sksewell@umich.edu            ti.curTaskName(), ti.curTaskPID(), ti.curTaskStart());
955222Sksewell@umich.edu}
965222Sksewell@umich.edu
975222Sksewell@umich.eduLinuxMipsSystem *
985222Sksewell@umich.eduLinuxMipsSystemParams::create()
995222Sksewell@umich.edu{
1005222Sksewell@umich.edu    return new LinuxMipsSystem(this);
1015222Sksewell@umich.edu}
102