system.cc revision 5958
11782SN/A/* 21782SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 31782SN/A * All rights reserved. 41782SN/A * 51782SN/A * Redistribution and use in source and binary forms, with or without 61782SN/A * modification, are permitted provided that the following conditions are 71782SN/A * met: redistributions of source code must retain the above copyright 81782SN/A * notice, this list of conditions and the following disclaimer; 91782SN/A * redistributions in binary form must reproduce the above copyright 101782SN/A * notice, this list of conditions and the following disclaimer in the 111782SN/A * documentation and/or other materials provided with the distribution; 121782SN/A * neither the name of the copyright holders nor the names of its 131782SN/A * contributors may be used to endorse or promote products derived from 141782SN/A * this software without specific prior written permission. 151782SN/A * 161782SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171782SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181782SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191782SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201782SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211782SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221782SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231782SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241782SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251782SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261782SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ben Nash 291782SN/A */ 301782SN/A 311782SN/A/** 321782SN/A * @file 331835SN/A * Modifications for the FreeBSD kernel. 341835SN/A * Based on kern/linux/linux_system.cc. 351782SN/A * 361782SN/A */ 371782SN/A 384762Snate@binkert.org#include "arch/alpha/freebsd/system.hh" 392158SN/A#include "arch/alpha/system.hh" 404762Snate@binkert.org#include "arch/isa_traits.hh" 414762Snate@binkert.org#include "arch/vtophys.hh" 421782SN/A#include "base/loader/symtab.hh" 432680Sktlim@umich.edu#include "cpu/thread_context.hh" 442521SN/A#include "mem/physical.hh" 452521SN/A#include "mem/port.hh" 462036SN/A#include "sim/byteswap.hh" 471782SN/A 481847SN/A#define TIMER_FREQUENCY 1193180 491847SN/A 501782SN/Ausing namespace std; 512212SN/Ausing namespace AlphaISA; 521782SN/A 532212SN/AFreebsdAlphaSystem::FreebsdAlphaSystem(Params *p) 542158SN/A : AlphaSystem(p) 551782SN/A{ 561782SN/A /** 571823SN/A * Any time DELAY is called just skip the function. 581885SN/A * Shouldn't we actually emulate the delay? 591782SN/A */ 601885SN/A skipDelayEvent = addKernelFuncEvent<SkipFuncEvent>("DELAY"); 611885SN/A skipCalibrateClocks = 621885SN/A addKernelFuncEvent<SkipCalibrateClocksEvent>("calibrate_clocks"); 631782SN/A} 641782SN/A 652212SN/AFreebsdAlphaSystem::~FreebsdAlphaSystem() 661782SN/A{ 671782SN/A delete skipDelayEvent; 681821SN/A delete skipCalibrateClocks; 691821SN/A} 701821SN/A 711821SN/Avoid 722680Sktlim@umich.eduFreebsdAlphaSystem::doCalibrateClocks(ThreadContext *tc) 731821SN/A{ 741821SN/A Addr ppc_vaddr = 0; 751821SN/A Addr timer_vaddr = 0; 761821SN/A 775958Sgblack@eecs.umich.edu ppc_vaddr = (Addr)tc->readIntReg(17); 785958Sgblack@eecs.umich.edu timer_vaddr = (Addr)tc->readIntReg(18); 791821SN/A 802521SN/A virtPort.write(ppc_vaddr, (uint32_t)Clock::Frequency); 812521SN/A virtPort.write(timer_vaddr, (uint32_t)TIMER_FREQUENCY); 821782SN/A} 831782SN/A 841885SN/Avoid 852680Sktlim@umich.eduFreebsdAlphaSystem::SkipCalibrateClocksEvent::process(ThreadContext *tc) 861885SN/A{ 872680Sktlim@umich.edu SkipFuncEvent::process(tc); 882680Sktlim@umich.edu ((FreebsdAlphaSystem *)tc->getSystemPtr())->doCalibrateClocks(tc); 891885SN/A} 901885SN/A 914762Snate@binkert.orgFreebsdAlphaSystem * 924762Snate@binkert.orgFreebsdAlphaSystemParams::create() 931782SN/A{ 944762Snate@binkert.org return new FreebsdAlphaSystem(this); 951782SN/A} 96