interrupts.hh revision 3827
110298Salexandru.dutu@amd.com/* 210298Salexandru.dutu@amd.com * Copyright (c) 2006 The Regents of The University of Michigan 310298Salexandru.dutu@amd.com * All rights reserved. 410298Salexandru.dutu@amd.com * 510298Salexandru.dutu@amd.com * Redistribution and use in source and binary forms, with or without 610298Salexandru.dutu@amd.com * modification, are permitted provided that the following conditions are 710298Salexandru.dutu@amd.com * met: redistributions of source code must retain the above copyright 810298Salexandru.dutu@amd.com * notice, this list of conditions and the following disclaimer; 910298Salexandru.dutu@amd.com * redistributions in binary form must reproduce the above copyright 1010298Salexandru.dutu@amd.com * notice, this list of conditions and the following disclaimer in the 1110298Salexandru.dutu@amd.com * documentation and/or other materials provided with the distribution; 1210298Salexandru.dutu@amd.com * neither the name of the copyright holders nor the names of its 1310298Salexandru.dutu@amd.com * contributors may be used to endorse or promote products derived from 1410298Salexandru.dutu@amd.com * this software without specific prior written permission. 1510298Salexandru.dutu@amd.com * 1610298Salexandru.dutu@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1710298Salexandru.dutu@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1810298Salexandru.dutu@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1910298Salexandru.dutu@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2010298Salexandru.dutu@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2110298Salexandru.dutu@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2210298Salexandru.dutu@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2310298Salexandru.dutu@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2410298Salexandru.dutu@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2510298Salexandru.dutu@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2610298Salexandru.dutu@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2710298Salexandru.dutu@amd.com * 2810298Salexandru.dutu@amd.com * Authors: Gabe Black 2910298Salexandru.dutu@amd.com */ 3010298Salexandru.dutu@amd.com 3110298Salexandru.dutu@amd.com#ifndef __ARCH_SPARC_INTERRUPT_HH__ 3210298Salexandru.dutu@amd.com#define __ARCH_SPARC_INTERRUPT_HH__ 3310298Salexandru.dutu@amd.com 3410298Salexandru.dutu@amd.com#include "arch/sparc/faults.hh" 3510298Salexandru.dutu@amd.com#include "cpu/thread_context.hh" 3610298Salexandru.dutu@amd.com 3710298Salexandru.dutu@amd.com 3810298Salexandru.dutu@amd.comnamespace SparcISA 3910298Salexandru.dutu@amd.com{ 4010298Salexandru.dutu@amd.com class Interrupts 4110298Salexandru.dutu@amd.com { 4210298Salexandru.dutu@amd.com protected: 4310298Salexandru.dutu@amd.com 4411800Sbrandon.potter@amd.com 4511800Sbrandon.potter@amd.com public: 4610298Salexandru.dutu@amd.com Interrupts() 4710298Salexandru.dutu@amd.com { 4810298Salexandru.dutu@amd.com 4910298Salexandru.dutu@amd.com } 5010298Salexandru.dutu@amd.com void post(int int_num, int index) 5110298Salexandru.dutu@amd.com { 5210298Salexandru.dutu@amd.com 5310298Salexandru.dutu@amd.com } 5410298Salexandru.dutu@amd.com 5510298Salexandru.dutu@amd.com void clear(int int_num, int index) 5610298Salexandru.dutu@amd.com { 5710298Salexandru.dutu@amd.com 5810298Salexandru.dutu@amd.com } 5910298Salexandru.dutu@amd.com 6010298Salexandru.dutu@amd.com void clear_all() 6110298Salexandru.dutu@amd.com { 6210298Salexandru.dutu@amd.com 6310298Salexandru.dutu@amd.com } 6410298Salexandru.dutu@amd.com 6510298Salexandru.dutu@amd.com bool check_interrupts(ThreadContext * tc) const 6610298Salexandru.dutu@amd.com { 6710298Salexandru.dutu@amd.com // so far only handle softint interrupts 6810298Salexandru.dutu@amd.com int int_level = InterruptLevel(tc->readMiscReg(MISCREG_SOFTINT)); 6910298Salexandru.dutu@amd.com if (int_level) 7010298Salexandru.dutu@amd.com return true; 7110298Salexandru.dutu@amd.com else 7210298Salexandru.dutu@amd.com return false; 7310298Salexandru.dutu@amd.com } 7410298Salexandru.dutu@amd.com 7510298Salexandru.dutu@amd.com Fault getInterrupt(ThreadContext * tc) 7610298Salexandru.dutu@amd.com { 7710298Salexandru.dutu@amd.com // conditioning the softint interrups 7810298Salexandru.dutu@amd.com if (tc->readMiscReg(MISCREG_HPSTATE) & hpriv) { 7910298Salexandru.dutu@amd.com // if running in privileged mode, then pend the interrupt 8010298Salexandru.dutu@amd.com return NoFault; 8110298Salexandru.dutu@amd.com } else { 8210298Salexandru.dutu@amd.com int int_level = InterruptLevel(tc->readMiscReg(MISCREG_SOFTINT)); 8310298Salexandru.dutu@amd.com if ((int_level <= tc->readMiscReg(MISCREG_PIL)) || 8410298Salexandru.dutu@amd.com !(tc->readMiscReg(MISCREG_PSTATE) & ie)) { 8510298Salexandru.dutu@amd.com // if PIL or no interrupt enabled, then pend the interrupt 8610298Salexandru.dutu@amd.com return NoFault; 8710298Salexandru.dutu@amd.com } else { 8810298Salexandru.dutu@amd.com return new InterruptLevelN(int_level); 8910298Salexandru.dutu@amd.com } 9010298Salexandru.dutu@amd.com } 9110298Salexandru.dutu@amd.com } 9210298Salexandru.dutu@amd.com 9310298Salexandru.dutu@amd.com void updateIntrInfo(ThreadContext * tc) 9410298Salexandru.dutu@amd.com { 9510298Salexandru.dutu@amd.com 9610298Salexandru.dutu@amd.com } 9710298Salexandru.dutu@amd.com 9810298Salexandru.dutu@amd.com void serialize(std::ostream &os) 9910298Salexandru.dutu@amd.com { 10010298Salexandru.dutu@amd.com } 10110298Salexandru.dutu@amd.com 10210298Salexandru.dutu@amd.com void unserialize(Checkpoint *cp, const std::string §ion) 10310298Salexandru.dutu@amd.com { 10410298Salexandru.dutu@amd.com } 10510298Salexandru.dutu@amd.com }; 10610298Salexandru.dutu@amd.com} 10710298Salexandru.dutu@amd.com 10810298Salexandru.dutu@amd.com#endif // __ARCH_SPARC_INTERRUPT_HH__ 10910298Salexandru.dutu@amd.com