intr_control.cc revision 1762
14202Sbinkertn@umich.edu/* 24202Sbinkertn@umich.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan 34202Sbinkertn@umich.edu * All rights reserved. 44202Sbinkertn@umich.edu * 54202Sbinkertn@umich.edu * Redistribution and use in source and binary forms, with or without 64202Sbinkertn@umich.edu * modification, are permitted provided that the following conditions are 74202Sbinkertn@umich.edu * met: redistributions of source code must retain the above copyright 84202Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer; 94202Sbinkertn@umich.edu * redistributions in binary form must reproduce the above copyright 104202Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer in the 114202Sbinkertn@umich.edu * documentation and/or other materials provided with the distribution; 124202Sbinkertn@umich.edu * neither the name of the copyright holders nor the names of its 134202Sbinkertn@umich.edu * contributors may be used to endorse or promote products derived from 144202Sbinkertn@umich.edu * this software without specific prior written permission. 154202Sbinkertn@umich.edu * 164202Sbinkertn@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174202Sbinkertn@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184202Sbinkertn@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194202Sbinkertn@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204202Sbinkertn@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214202Sbinkertn@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224202Sbinkertn@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234202Sbinkertn@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244202Sbinkertn@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254202Sbinkertn@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264202Sbinkertn@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274202Sbinkertn@umich.edu */ 284202Sbinkertn@umich.edu 294202Sbinkertn@umich.edu#include <string> 304202Sbinkertn@umich.edu#include <vector> 314202Sbinkertn@umich.edu 324202Sbinkertn@umich.edu#include "cpu/base.hh" 335952Ssaidi@eecs.umich.edu#include "cpu/intr_control.hh" 345952Ssaidi@eecs.umich.edu#include "sim/builder.hh" 355952Ssaidi@eecs.umich.edu#include "sim/sim_object.hh" 3612230Sgiacomo.travaglini@arm.com 375548Snate@binkert.orgusing namespace std; 3812226Sgiacomo.travaglini@arm.com 394202Sbinkertn@umich.eduIntrControl::IntrControl(const string &name, BaseCPU *c) 4012230Sgiacomo.travaglini@arm.com : SimObject(name), cpu(c) 4112230Sgiacomo.travaglini@arm.com{} 427067Snate@binkert.org 4312376Sgabeblack@google.com/* @todo 445882Snate@binkert.org *Fix the cpu sim object parameter to be a system pointer 454550Sbinkertn@umich.edu *instead, to avoid some extra dereferencing 464550Sbinkertn@umich.edu */ 4712230Sgiacomo.travaglini@arm.comvoid 4812230Sgiacomo.travaglini@arm.comIntrControl::post(int int_num, int index) 4910839Sandreas.sandberg@arm.com{ 504202Sbinkertn@umich.edu std::vector<ExecContext *> &xcvec = cpu->system->execContexts; 514202Sbinkertn@umich.edu BaseCPU *temp = xcvec[0]->cpu; 524202Sbinkertn@umich.edu temp->post_interrupt(int_num, index); 534202Sbinkertn@umich.edu} 5412334Sgabeblack@google.com 554202Sbinkertn@umich.eduvoid 564202Sbinkertn@umich.eduIntrControl::post(int cpu_id, int int_num, int index) 5712366Sgabeblack@google.com{ 584202Sbinkertn@umich.edu std::vector<ExecContext *> &xcvec = cpu->system->execContexts; 594202Sbinkertn@umich.edu BaseCPU *temp = xcvec[cpu_id]->cpu; 609850Sandreas.hansson@arm.com temp->post_interrupt(int_num, index); 617768SAli.Saidi@ARM.com} 624202Sbinkertn@umich.edu 634202Sbinkertn@umich.eduvoid 644202Sbinkertn@umich.eduIntrControl::clear(int int_num, int index) 654202Sbinkertn@umich.edu{ 664202Sbinkertn@umich.edu std::vector<ExecContext *> &xcvec = cpu->system->execContexts; 679500Snilay@cs.wisc.edu BaseCPU *temp = xcvec[0]->cpu; 684202Sbinkertn@umich.edu temp->clear_interrupt(int_num, index); 694202Sbinkertn@umich.edu} 709538Satgutier@umich.edu 714202Sbinkertn@umich.eduvoid 724202Sbinkertn@umich.eduIntrControl::clear(int cpu_id, int int_num, int index) 735222Sksewell@umich.edu{ 744202Sbinkertn@umich.edu std::vector<ExecContext *> &xcvec = cpu->system->execContexts; 754202Sbinkertn@umich.edu BaseCPU *temp = xcvec[cpu_id]->cpu; 764202Sbinkertn@umich.edu temp->clear_interrupt(int_num, index); 774202Sbinkertn@umich.edu} 784202Sbinkertn@umich.edu 794202Sbinkertn@umich.eduBEGIN_DECLARE_SIM_OBJECT_PARAMS(IntrControl) 8012316Sgabeblack@google.com 8112316Sgabeblack@google.com SimObjectParam<BaseCPU *> cpu; 828335Snate@binkert.org 838335Snate@binkert.orgEND_DECLARE_SIM_OBJECT_PARAMS(IntrControl) 848335Snate@binkert.org 858335Snate@binkert.orgBEGIN_INIT_SIM_OBJECT_PARAMS(IntrControl) 868335Snate@binkert.org 878335Snate@binkert.org INIT_PARAM(cpu, "the cpu") 888335Snate@binkert.org 898335Snate@binkert.orgEND_INIT_SIM_OBJECT_PARAMS(IntrControl) 908335Snate@binkert.org 918335Snate@binkert.orgCREATE_SIM_OBJECT(IntrControl) 928335Snate@binkert.org{ 938335Snate@binkert.org return new IntrControl(getInstanceName(), cpu); 945192Ssaidi@eecs.umich.edu} 955800Snate@binkert.org 965800Snate@binkert.orgREGISTER_SIM_OBJECT("IntrControl", IntrControl) 975800Snate@binkert.org