events.hh revision 8143
12212SN/A/* 22212SN/A * Copyright (c) 2004-2006 The Regents of The University of Michigan 32212SN/A * All rights reserved. 42212SN/A * 52212SN/A * Redistribution and use in source and binary forms, with or without 62212SN/A * modification, are permitted provided that the following conditions are 72212SN/A * met: redistributions of source code must retain the above copyright 82212SN/A * notice, this list of conditions and the following disclaimer; 92212SN/A * redistributions in binary form must reproduce the above copyright 102212SN/A * notice, this list of conditions and the following disclaimer in the 112212SN/A * documentation and/or other materials provided with the distribution; 122212SN/A * neither the name of the copyright holders nor the names of its 132212SN/A * contributors may be used to endorse or promote products derived from 142212SN/A * this software without specific prior written permission. 152212SN/A * 162212SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172212SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182212SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192212SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202212SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232212SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242212SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252212SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262212SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282760Sbinkertn@umich.edu * Authors: Nathan Binkert 292760Sbinkertn@umich.edu * Ali Saidi 302212SN/A */ 312212SN/A 322212SN/A#ifndef __KERN_LINUX_EVENTS_HH__ 332212SN/A#define __KERN_LINUX_EVENTS_HH__ 342212SN/A 352212SN/A#include "kern/system_events.hh" 362212SN/A 372212SN/Anamespace Linux { 382212SN/A 392212SN/Aclass DebugPrintkEvent : public SkipFuncEvent 402212SN/A{ 412212SN/A public: 424429Ssaidi@eecs.umich.edu DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr) 434429Ssaidi@eecs.umich.edu : SkipFuncEvent(q, desc, addr) {} 442680Sktlim@umich.edu virtual void process(ThreadContext *xc); 452212SN/A}; 462212SN/A 478143SAli.Saidi@ARM.com/** A class to skip udelay() and related calls in the kernel. 488143SAli.Saidi@ARM.com * This class has two additional parameters that take the argument to udelay and 498143SAli.Saidi@ARM.com * manipulated it to come up with ns and eventually ticks to quiesce for. 508143SAli.Saidi@ARM.com * See descriptions of argDivToNs and argMultToNs below. 518143SAli.Saidi@ARM.com */ 528143SAli.Saidi@ARM.comclass UDelayEvent : public SkipFuncEvent 538143SAli.Saidi@ARM.com{ 548143SAli.Saidi@ARM.com private: 558143SAli.Saidi@ARM.com /** value to divide arg by to create ns. This is present beacues the linux 568143SAli.Saidi@ARM.com * kernel code sometime precomputes the first multiply that is done in 578143SAli.Saidi@ARM.com * udelay() if the parameter is a constant. We need to undo it so here is 588143SAli.Saidi@ARM.com * how. */ 598143SAli.Saidi@ARM.com uint64_t argDivToNs; 608143SAli.Saidi@ARM.com 618143SAli.Saidi@ARM.com /** value to multiple arg by to create ns. Nominally, this is 1000 to 628143SAli.Saidi@ARM.com * convert us to ns, but since linux can do some preprocessing of constant 638143SAli.Saidi@ARM.com * values something else might be required. */ 648143SAli.Saidi@ARM.com uint64_t argMultToNs; 658143SAli.Saidi@ARM.com 668143SAli.Saidi@ARM.com public: 678143SAli.Saidi@ARM.com UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr, 688143SAli.Saidi@ARM.com uint64_t mult, uint64_t div) 698143SAli.Saidi@ARM.com : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {} 708143SAli.Saidi@ARM.com virtual void process(ThreadContext *xc); 718143SAli.Saidi@ARM.com}; 728143SAli.Saidi@ARM.com 738143SAli.Saidi@ARM.com 742212SN/A} 752212SN/A 762212SN/A#endif 77