events.cc revision 8143
12212SN/A/* 28138SAli.Saidi@ARM.com * Copyright (c) 2011 ARM Limited 38138SAli.Saidi@ARM.com * All rights reserved 48138SAli.Saidi@ARM.com * 58138SAli.Saidi@ARM.com * The license below extends only to copyright in the software and shall 68138SAli.Saidi@ARM.com * not be construed as granting a license to any other intellectual 78138SAli.Saidi@ARM.com * property including but not limited to intellectual property relating 88138SAli.Saidi@ARM.com * to a hardware implementation of the functionality of the software 98138SAli.Saidi@ARM.com * licensed hereunder. You may use the software subject to the license 108138SAli.Saidi@ARM.com * terms below provided that you ensure that this notice is replicated 118138SAli.Saidi@ARM.com * unmodified and in its entirety in all distributions of the software, 128138SAli.Saidi@ARM.com * modified or unmodified, in source code or in binary form. 138138SAli.Saidi@ARM.com * 142212SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan 152212SN/A * All rights reserved. 162212SN/A * 172212SN/A * Redistribution and use in source and binary forms, with or without 182212SN/A * modification, are permitted provided that the following conditions are 192212SN/A * met: redistributions of source code must retain the above copyright 202212SN/A * notice, this list of conditions and the following disclaimer; 212212SN/A * redistributions in binary form must reproduce the above copyright 222212SN/A * notice, this list of conditions and the following disclaimer in the 232212SN/A * documentation and/or other materials provided with the distribution; 242212SN/A * neither the name of the copyright holders nor the names of its 252212SN/A * contributors may be used to endorse or promote products derived from 262212SN/A * this software without specific prior written permission. 272212SN/A * 282212SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292212SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302212SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312212SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322212SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352212SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362212SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372212SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382212SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392665Ssaidi@eecs.umich.edu * 402760Sbinkertn@umich.edu * Authors: Nathan Binkert 412760Sbinkertn@umich.edu * Ali Saidi 422212SN/A */ 432212SN/A 447676Snate@binkert.org#include <sstream> 457676Snate@binkert.org 462212SN/A#include "base/trace.hh" 478143SAli.Saidi@ARM.com#include "arch/utility.hh" 482680Sktlim@umich.edu#include "cpu/thread_context.hh" 492212SN/A#include "kern/linux/events.hh" 502212SN/A#include "kern/linux/printk.hh" 512212SN/A#include "kern/system_events.hh" 527676Snate@binkert.org#include "sim/arguments.hh" 538143SAli.Saidi@ARM.com#include "sim/pseudo_inst.hh" 542235SN/A#include "sim/system.hh" 552212SN/A 562212SN/Anamespace Linux { 572212SN/A 582212SN/Avoid 592680Sktlim@umich.eduDebugPrintkEvent::process(ThreadContext *tc) 602212SN/A{ 612212SN/A if (DTRACE(DebugPrintf)) { 624429Ssaidi@eecs.umich.edu std::stringstream ss; 634826Ssaidi@eecs.umich.edu Arguments args(tc); 644429Ssaidi@eecs.umich.edu Printk(ss, args); 654429Ssaidi@eecs.umich.edu StringWrap name(tc->getSystemPtr()->name() + ".dprintk"); 664429Ssaidi@eecs.umich.edu DPRINTFN("%s", ss.str()); 672212SN/A } 684424Ssaidi@eecs.umich.edu SkipFuncEvent::process(tc); 692212SN/A} 702212SN/A 718143SAli.Saidi@ARM.comvoid 728143SAli.Saidi@ARM.comUDelayEvent::process(ThreadContext *tc) 738143SAli.Saidi@ARM.com{ 748143SAli.Saidi@ARM.com int arg_num = 0; 758143SAli.Saidi@ARM.com 768143SAli.Saidi@ARM.com // Get the time in native size 778143SAli.Saidi@ARM.com uint64_t time = TheISA::getArgument(tc, arg_num, (uint16_t)-1, false); 788143SAli.Saidi@ARM.com 798143SAli.Saidi@ARM.com // convert parameter to ns 808143SAli.Saidi@ARM.com if (argDivToNs) 818143SAli.Saidi@ARM.com time /= argDivToNs; 828143SAli.Saidi@ARM.com 838143SAli.Saidi@ARM.com time *= argMultToNs; 848143SAli.Saidi@ARM.com 858143SAli.Saidi@ARM.com // Convert ns to ticks 868143SAli.Saidi@ARM.com time *= SimClock::Int::ns; 878143SAli.Saidi@ARM.com 888143SAli.Saidi@ARM.com SkipFuncEvent::process(tc); 898143SAli.Saidi@ARM.com 908143SAli.Saidi@ARM.com PseudoInst::quiesceNs(tc, time); 918143SAli.Saidi@ARM.com} 928143SAli.Saidi@ARM.com 938143SAli.Saidi@ARM.com 942212SN/A} // namespace linux 95