system_events.cc revision 2665
13113Sgblack@eecs.umich.edu/*
23113Sgblack@eecs.umich.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan
33113Sgblack@eecs.umich.edu * All rights reserved.
43113Sgblack@eecs.umich.edu *
53113Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
63113Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
73113Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
83113Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
93113Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
103113Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
113113Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
123113Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
133113Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
143113Sgblack@eecs.umich.edu * this software without specific prior written permission.
153113Sgblack@eecs.umich.edu *
163113Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173113Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183113Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193113Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203113Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213113Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223113Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233113Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243113Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253113Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263113Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273113Sgblack@eecs.umich.edu *
283113Sgblack@eecs.umich.edu * Authors: Lisa Hsu
293113Sgblack@eecs.umich.edu *          Nathan Binkert
303113Sgblack@eecs.umich.edu */
313113Sgblack@eecs.umich.edu
323113Sgblack@eecs.umich.edu#include "cpu/base.hh"
333113Sgblack@eecs.umich.edu#include "cpu/cpu_exec_context.hh"
346215Snate@binkert.org#include "kern/kernel_stats.hh"
353113Sgblack@eecs.umich.edu#include "kern/system_events.hh"
363113Sgblack@eecs.umich.edu#include "sim/system.hh"
373113Sgblack@eecs.umich.edu
383113Sgblack@eecs.umich.eduusing namespace TheISA;
393113Sgblack@eecs.umich.edu
403113Sgblack@eecs.umich.eduvoid
413113Sgblack@eecs.umich.eduSkipFuncEvent::process(ExecContext *xc)
425795Ssaidi@eecs.umich.edu{
435795Ssaidi@eecs.umich.edu    Addr newpc = xc->readIntReg(ReturnAddressReg);
445795Ssaidi@eecs.umich.edu
455795Ssaidi@eecs.umich.edu    DPRINTF(PCEvent, "skipping %s: pc=%x, newpc=%x\n", description,
463113Sgblack@eecs.umich.edu            xc->readPC(), newpc);
473113Sgblack@eecs.umich.edu
483113Sgblack@eecs.umich.edu    xc->setPC(newpc);
493113Sgblack@eecs.umich.edu    xc->setNextPC(xc->readPC() + sizeof(TheISA::MachInst));
505543Ssaidi@eecs.umich.edu/*
515543Ssaidi@eecs.umich.edu    BranchPred *bp = xc->getCpuPtr()->getBranchPred();
523113Sgblack@eecs.umich.edu    if (bp != NULL) {
533113Sgblack@eecs.umich.edu        bp->popRAS(xc->getThreadNum());
543113Sgblack@eecs.umich.edu    }
553113Sgblack@eecs.umich.edu*/
563113Sgblack@eecs.umich.edu}
573113Sgblack@eecs.umich.edu
583113Sgblack@eecs.umich.edu
593113Sgblack@eecs.umich.eduFnEvent::FnEvent(PCEventQueue *q, const std::string &desc, Addr addr,
603113Sgblack@eecs.umich.edu                 Stats::MainBin *bin)
613113Sgblack@eecs.umich.edu    : PCEvent(q, desc, addr), _name(desc), mybin(bin)
623113Sgblack@eecs.umich.edu{
633113Sgblack@eecs.umich.edu}
643113Sgblack@eecs.umich.edu
653113Sgblack@eecs.umich.eduvoid
663113Sgblack@eecs.umich.eduFnEvent::process(ExecContext *xc)
673113Sgblack@eecs.umich.edu{
683113Sgblack@eecs.umich.edu    if (xc->misspeculating())
693113Sgblack@eecs.umich.edu        return;
703113Sgblack@eecs.umich.edu
713113Sgblack@eecs.umich.edu    xc->getSystemPtr()->kernelBinning->call(xc, mybin);
723113Sgblack@eecs.umich.edu}
733113Sgblack@eecs.umich.edu
743113Sgblack@eecs.umich.eduvoid
753113Sgblack@eecs.umich.eduIdleStartEvent::process(ExecContext *xc)
763113Sgblack@eecs.umich.edu{
775543Ssaidi@eecs.umich.edu    xc->getCpuPtr()->kernelStats->setIdleProcess(
785543Ssaidi@eecs.umich.edu        xc->readMiscReg(AlphaISA::IPR_PALtemp23), xc);
795543Ssaidi@eecs.umich.edu    remove();
805543Ssaidi@eecs.umich.edu}
815543Ssaidi@eecs.umich.edu
823113Sgblack@eecs.umich.eduvoid
833113Sgblack@eecs.umich.eduInterruptStartEvent::process(ExecContext *xc)
843113Sgblack@eecs.umich.edu{
853113Sgblack@eecs.umich.edu    xc->getCpuPtr()->kernelStats->mode(Kernel::interrupt, xc);
865543Ssaidi@eecs.umich.edu}
875543Ssaidi@eecs.umich.edu
883113Sgblack@eecs.umich.eduvoid
893113Sgblack@eecs.umich.eduInterruptEndEvent::process(ExecContext *xc)
903113Sgblack@eecs.umich.edu{
913113Sgblack@eecs.umich.edu    // We go back to kernel, if we are user, inside the rti
925543Ssaidi@eecs.umich.edu    // pal code we will get switched to user because of the ICM write
935543Ssaidi@eecs.umich.edu    xc->getCpuPtr()->kernelStats->mode(Kernel::kernel, xc);
943113Sgblack@eecs.umich.edu}
953113Sgblack@eecs.umich.edu