system.cc revision 4762
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 651821SN/A 662212SN/AFreebsdAlphaSystem::~FreebsdAlphaSystem() 671782SN/A{ 681782SN/A delete skipDelayEvent; 691821SN/A delete skipCalibrateClocks; 701821SN/A} 711821SN/A 721821SN/A 731821SN/Avoid 742680Sktlim@umich.eduFreebsdAlphaSystem::doCalibrateClocks(ThreadContext *tc) 751821SN/A{ 761821SN/A Addr ppc_vaddr = 0; 771821SN/A Addr timer_vaddr = 0; 781821SN/A 792680Sktlim@umich.edu ppc_vaddr = (Addr)tc->readIntReg(ArgumentReg1); 802680Sktlim@umich.edu timer_vaddr = (Addr)tc->readIntReg(ArgumentReg2); 811821SN/A 822521SN/A virtPort.write(ppc_vaddr, (uint32_t)Clock::Frequency); 832521SN/A virtPort.write(timer_vaddr, (uint32_t)TIMER_FREQUENCY); 841782SN/A} 851782SN/A 861782SN/A 871885SN/Avoid 882680Sktlim@umich.eduFreebsdAlphaSystem::SkipCalibrateClocksEvent::process(ThreadContext *tc) 891885SN/A{ 902680Sktlim@umich.edu SkipFuncEvent::process(tc); 912680Sktlim@umich.edu ((FreebsdAlphaSystem *)tc->getSystemPtr())->doCalibrateClocks(tc); 921885SN/A} 931885SN/A 944762Snate@binkert.orgFreebsdAlphaSystem * 954762Snate@binkert.orgFreebsdAlphaSystemParams::create() 961782SN/A{ 974762Snate@binkert.org return new FreebsdAlphaSystem(this); 981782SN/A} 99