interrupts.hh revision 5647
111723Sar4jc@virginia.edu/* 211723Sar4jc@virginia.edu * Copyright (c) 2007 The Hewlett-Packard Development Company 311723Sar4jc@virginia.edu * All rights reserved. 411723Sar4jc@virginia.edu * 511723Sar4jc@virginia.edu * Redistribution and use of this software in source and binary forms, 611723Sar4jc@virginia.edu * with or without modification, are permitted provided that the 711723Sar4jc@virginia.edu * following conditions are met: 811723Sar4jc@virginia.edu * 911723Sar4jc@virginia.edu * The software must be used only for Non-Commercial Use which means any 1011723Sar4jc@virginia.edu * use which is NOT directed to receiving any direct monetary 1111723Sar4jc@virginia.edu * compensation for, or commercial advantage from such use. Illustrative 1211723Sar4jc@virginia.edu * examples of non-commercial use are academic research, personal study, 1311723Sar4jc@virginia.edu * teaching, education and corporate research & development. 1411723Sar4jc@virginia.edu * Illustrative examples of commercial use are distributing products for 1511723Sar4jc@virginia.edu * commercial advantage and providing services using the software for 1611723Sar4jc@virginia.edu * commercial advantage. 1711723Sar4jc@virginia.edu * 1811723Sar4jc@virginia.edu * If you wish to use this software or functionality therein that may be 1911723Sar4jc@virginia.edu * covered by patents for commercial use, please contact: 2011723Sar4jc@virginia.edu * Director of Intellectual Property Licensing 2111723Sar4jc@virginia.edu * Office of Strategy and Technology 2211723Sar4jc@virginia.edu * Hewlett-Packard Company 2311723Sar4jc@virginia.edu * 1501 Page Mill Road 2411723Sar4jc@virginia.edu * Palo Alto, California 94304 2511723Sar4jc@virginia.edu * 2611723Sar4jc@virginia.edu * Redistributions of source code must retain the above copyright notice, 2711723Sar4jc@virginia.edu * this list of conditions and the following disclaimer. Redistributions 2811723Sar4jc@virginia.edu * in binary form must reproduce the above copyright notice, this list of 2911723Sar4jc@virginia.edu * conditions and the following disclaimer in the documentation and/or 3011723Sar4jc@virginia.edu * other materials provided with the distribution. Neither the name of 3111723Sar4jc@virginia.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 3211723Sar4jc@virginia.edu * contributors may be used to endorse or promote products derived from 3311723Sar4jc@virginia.edu * this software without specific prior written permission. No right of 3411723Sar4jc@virginia.edu * sublicense is granted herewith. Derivatives of the software and 3511723Sar4jc@virginia.edu * output created using the software may be prepared, but only for 3611723Sar4jc@virginia.edu * Non-Commercial Uses. Derivatives of the software may be shared with 3711723Sar4jc@virginia.edu * others provided: (i) the others agree to abide by the list of 3811723Sar4jc@virginia.edu * conditions herein which includes the Non-Commercial Use restrictions; 3911723Sar4jc@virginia.edu * and (ii) such Derivatives of the software include the above copyright 4011723Sar4jc@virginia.edu * notice to acknowledge the contribution from this software where 4111723Sar4jc@virginia.edu * applicable, this list of conditions and the disclaimer below. 4211723Sar4jc@virginia.edu * 4311723Sar4jc@virginia.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 4411723Sar4jc@virginia.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 4511723Sar4jc@virginia.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 4611723Sar4jc@virginia.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 4711723Sar4jc@virginia.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4811723Sar4jc@virginia.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4911723Sar4jc@virginia.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5011723Sar4jc@virginia.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5111723Sar4jc@virginia.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 5212119Sar4jc@virginia.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5311723Sar4jc@virginia.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5412104Snathanael.premillieu@arm.com * 5513610Sgiacomo.gabrielli@arm.com * Authors: Gabe Black 5612109SRekai.GonzalezAlberquilla@arm.com */ 5711911SBrandon.Potter@amd.com 5811723Sar4jc@virginia.edu#ifndef __ARCH_X86_INTERRUPTS_HH__ 5911723Sar4jc@virginia.edu#define __ARCH_X86_INTERRUPTS_HH__ 6011723Sar4jc@virginia.edu 6111723Sar4jc@virginia.edu#include "arch/x86/apicregs.hh" 6211723Sar4jc@virginia.edu#include "arch/x86/faults.hh" 6311723Sar4jc@virginia.edu#include "cpu/thread_context.hh" 6411723Sar4jc@virginia.edu#include "params/X86LocalApic.hh" 6511723Sar4jc@virginia.edu#include "sim/eventq.hh" 6611723Sar4jc@virginia.edu#include "sim/sim_object.hh" 6713610Sgiacomo.gabrielli@arm.com 6813610Sgiacomo.gabrielli@arm.comclass ThreadContext; 6913610Sgiacomo.gabrielli@arm.com 7013610Sgiacomo.gabrielli@arm.comnamespace X86ISA 7113610Sgiacomo.gabrielli@arm.com{ 7213610Sgiacomo.gabrielli@arm.com 7313610Sgiacomo.gabrielli@arm.comclass Interrupts : public SimObject 7413610Sgiacomo.gabrielli@arm.com{ 7513610Sgiacomo.gabrielli@arm.com protected: 7613610Sgiacomo.gabrielli@arm.com uint32_t regs[NUM_APIC_REGS]; 7713610Sgiacomo.gabrielli@arm.com 7813610Sgiacomo.gabrielli@arm.com class ApicTimerEvent : public Event 7913610Sgiacomo.gabrielli@arm.com { 8013610Sgiacomo.gabrielli@arm.com public: 8112109SRekai.GonzalezAlberquilla@arm.com ApicTimerEvent() : Event() 8211723Sar4jc@virginia.edu {} 8311726Sar4jc@virginia.edu 8411726Sar4jc@virginia.edu void process() 8511725Sar4jc@virginia.edu { 8613610Sgiacomo.gabrielli@arm.com warn("Local APIC timer event doesn't do anything!\n"); 8713610Sgiacomo.gabrielli@arm.com } 8813610Sgiacomo.gabrielli@arm.com }; 8913610Sgiacomo.gabrielli@arm.com 9013610Sgiacomo.gabrielli@arm.com ApicTimerEvent apicTimerEvent; 9113610Sgiacomo.gabrielli@arm.com 9211723Sar4jc@virginia.edu public: 9311723Sar4jc@virginia.edu typedef X86LocalApicParams Params; 9411723Sar4jc@virginia.edu 9511723Sar4jc@virginia.edu const Params * 9611723Sar4jc@virginia.edu params() const 9711723Sar4jc@virginia.edu { 9811723Sar4jc@virginia.edu return dynamic_cast<const Params *>(_params); 9911723Sar4jc@virginia.edu } 10011723Sar4jc@virginia.edu 10112139Sar4jc@virginia.edu uint32_t readRegNoEffect(ApicRegIndex reg); 10212119Sar4jc@virginia.edu uint32_t readReg(ApicRegIndex miscReg, ThreadContext *tc); 10312119Sar4jc@virginia.edu 10411726Sar4jc@virginia.edu void setRegNoEffect(ApicRegIndex reg, uint32_t val); 10511723Sar4jc@virginia.edu void setReg(ApicRegIndex reg, uint32_t val, ThreadContext *tc); 10612413Sar4jc@virginia.edu 10712413Sar4jc@virginia.edu Interrupts(Params * p) : SimObject(p) 10812413Sar4jc@virginia.edu { 10912413Sar4jc@virginia.edu //Set the local apic DFR to the flat model. 11012119Sar4jc@virginia.edu regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1); 11112119Sar4jc@virginia.edu memset(regs, 0, sizeof(regs)); 11211723Sar4jc@virginia.edu clear_all(); 11311723Sar4jc@virginia.edu } 11411723Sar4jc@virginia.edu 11511723Sar4jc@virginia.edu int InterruptLevel(uint64_t softint) 11611723Sar4jc@virginia.edu { 11711723Sar4jc@virginia.edu panic("Interrupts::InterruptLevel unimplemented!\n"); 11812119Sar4jc@virginia.edu return 0; 11912119Sar4jc@virginia.edu } 12012119Sar4jc@virginia.edu 12112119Sar4jc@virginia.edu void post(int int_num, int index) 12212119Sar4jc@virginia.edu { 12312119Sar4jc@virginia.edu panic("Interrupts::post unimplemented!\n"); 12412119Sar4jc@virginia.edu } 12512119Sar4jc@virginia.edu 12612119Sar4jc@virginia.edu void clear(int int_num, int index) 12712119Sar4jc@virginia.edu { 12812119Sar4jc@virginia.edu warn("Interrupts::clear unimplemented!\n"); 12912119Sar4jc@virginia.edu } 13011723Sar4jc@virginia.edu 13111723Sar4jc@virginia.edu void clear_all() 13212695Sar4jc@virginia.edu { 13312695Sar4jc@virginia.edu warn("Interrupts::clear_all unimplemented!\n"); 13412695Sar4jc@virginia.edu } 13512695Sar4jc@virginia.edu 13612695Sar4jc@virginia.edu bool check_interrupts(ThreadContext * tc) const 13712695Sar4jc@virginia.edu { 13812695Sar4jc@virginia.edu return false; 13912695Sar4jc@virginia.edu } 14012695Sar4jc@virginia.edu 14112695Sar4jc@virginia.edu Fault getInterrupt(ThreadContext * tc) 14212695Sar4jc@virginia.edu { 14312695Sar4jc@virginia.edu return NoFault; 14412695Sar4jc@virginia.edu } 14512695Sar4jc@virginia.edu 14612695Sar4jc@virginia.edu void updateIntrInfo(ThreadContext * tc) 14712695Sar4jc@virginia.edu { 14812695Sar4jc@virginia.edu panic("Interrupts::updateIntrInfo unimplemented!\n"); 14912695Sar4jc@virginia.edu } 15012695Sar4jc@virginia.edu 15112695Sar4jc@virginia.edu void serialize(std::ostream & os) 15212695Sar4jc@virginia.edu { 15312695Sar4jc@virginia.edu panic("Interrupts::serialize unimplemented!\n"); 15412695Sar4jc@virginia.edu } 15512695Sar4jc@virginia.edu 15612695Sar4jc@virginia.edu void unserialize(Checkpoint * cp, const std::string & section) 15712695Sar4jc@virginia.edu { 15812695Sar4jc@virginia.edu panic("Interrupts::unserialize unimplemented!\n"); 15912695Sar4jc@virginia.edu } 16012695Sar4jc@virginia.edu}; 16112695Sar4jc@virginia.edu 16212695Sar4jc@virginia.edu}; 16312695Sar4jc@virginia.edu 16412695Sar4jc@virginia.edu#endif // __ARCH_X86_INTERRUPTS_HH__ 16512695Sar4jc@virginia.edu