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 4211793Sbrandon.potter@amd.com#include "arch/mips/linux/system.hh" 4311793Sbrandon.potter@amd.com 449329Sdam.sunwoo@arm.com#include "arch/generic/linux/threadinfo.hh" 458229Snate@binkert.org#include "arch/mips/idle_event.hh" 465222Sksewell@umich.edu#include "arch/mips/system.hh" 478229Snate@binkert.org#include "arch/vtophys.hh" 485222Sksewell@umich.edu#include "base/loader/symtab.hh" 498229Snate@binkert.org#include "cpu/base.hh" 505222Sksewell@umich.edu#include "cpu/thread_context.hh" 518775Sgblack@eecs.umich.edu#include "debug/Thread.hh" 525222Sksewell@umich.edu#include "dev/platform.hh" 538229Snate@binkert.org#include "kern/linux/events.hh" 545222Sksewell@umich.edu#include "kern/linux/printk.hh" 555222Sksewell@umich.edu#include "mem/physical.hh" 565222Sksewell@umich.edu#include "mem/port.hh" 575222Sksewell@umich.edu#include "sim/arguments.hh" 585222Sksewell@umich.edu#include "sim/byteswap.hh" 595222Sksewell@umich.edu 605222Sksewell@umich.eduusing namespace std; 615222Sksewell@umich.eduusing namespace MipsISA; 625222Sksewell@umich.eduusing namespace Linux; 635222Sksewell@umich.edu 645222Sksewell@umich.eduLinuxMipsSystem::LinuxMipsSystem(Params *p) 655222Sksewell@umich.edu : MipsSystem(p) 665222Sksewell@umich.edu{ 675222Sksewell@umich.edu} 685222Sksewell@umich.edu 695222Sksewell@umich.eduLinuxMipsSystem::~LinuxMipsSystem() 705222Sksewell@umich.edu{ 715222Sksewell@umich.edu} 725222Sksewell@umich.edu 735222Sksewell@umich.edu 745222Sksewell@umich.eduvoid 755222Sksewell@umich.eduLinuxMipsSystem::setDelayLoop(ThreadContext *tc) 765222Sksewell@umich.edu{ 778741Sgblack@eecs.umich.edu panic("setDelayLoop not implemented.\n"); 785222Sksewell@umich.edu} 795222Sksewell@umich.edu 805222Sksewell@umich.edu 815222Sksewell@umich.eduvoid 825222Sksewell@umich.eduLinuxMipsSystem::SkipDelayLoopEvent::process(ThreadContext *tc) 835222Sksewell@umich.edu{ 845222Sksewell@umich.edu SkipFuncEvent::process(tc); 855222Sksewell@umich.edu // calculate and set loops_per_jiffy 865222Sksewell@umich.edu ((LinuxMipsSystem *)tc->getSystemPtr())->setDelayLoop(tc); 875222Sksewell@umich.edu} 885222Sksewell@umich.edu 895222Sksewell@umich.eduvoid 905222Sksewell@umich.eduLinuxMipsSystem::PrintThreadInfo::process(ThreadContext *tc) 915222Sksewell@umich.edu{ 925222Sksewell@umich.edu Linux::ThreadInfo ti(tc); 935222Sksewell@umich.edu 945222Sksewell@umich.edu DPRINTF(Thread, "Currently Executing Thread %s, pid %d, started at: %d\n", 955222Sksewell@umich.edu ti.curTaskName(), ti.curTaskPID(), ti.curTaskStart()); 965222Sksewell@umich.edu} 975222Sksewell@umich.edu 985222Sksewell@umich.eduLinuxMipsSystem * 995222Sksewell@umich.eduLinuxMipsSystemParams::create() 1005222Sksewell@umich.edu{ 1015222Sksewell@umich.edu return new LinuxMipsSystem(this); 1025222Sksewell@umich.edu} 103