15786Sgblack@eecs.umich.edu/* 25786Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company 35786Sgblack@eecs.umich.edu * All rights reserved. 45786Sgblack@eecs.umich.edu * 57087Snate@binkert.org * The license below extends only to copyright in the software and shall 67087Snate@binkert.org * not be construed as granting a license to any other intellectual 77087Snate@binkert.org * property including but not limited to intellectual property relating 87087Snate@binkert.org * to a hardware implementation of the functionality of the software 97087Snate@binkert.org * licensed hereunder. You may use the software subject to the license 107087Snate@binkert.org * terms below provided that you ensure that this notice is replicated 117087Snate@binkert.org * unmodified and in its entirety in all distributions of the software, 127087Snate@binkert.org * modified or unmodified, in source code or in binary form. 135786Sgblack@eecs.umich.edu * 147087Snate@binkert.org * Redistribution and use in source and binary forms, with or without 157087Snate@binkert.org * modification, are permitted provided that the following conditions are 167087Snate@binkert.org * met: redistributions of source code must retain the above copyright 177087Snate@binkert.org * notice, this list of conditions and the following disclaimer; 187087Snate@binkert.org * redistributions in binary form must reproduce the above copyright 197087Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 207087Snate@binkert.org * documentation and/or other materials provided with the distribution; 217087Snate@binkert.org * neither the name of the copyright holders nor the names of its 225786Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 237087Snate@binkert.org * this software without specific prior written permission. 245786Sgblack@eecs.umich.edu * 255786Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 265786Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 275786Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 285786Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 295786Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 305786Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 315786Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 325786Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 335786Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 345786Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 355786Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 365786Sgblack@eecs.umich.edu * 375786Sgblack@eecs.umich.edu * Authors: Gabe Black 385786Sgblack@eecs.umich.edu */ 395786Sgblack@eecs.umich.edu 405786Sgblack@eecs.umich.edu#ifndef __ARCH_X86_INSTS_MACROOP_HH__ 415786Sgblack@eecs.umich.edu#define __ARCH_X86_INSTS_MACROOP_HH__ 425786Sgblack@eecs.umich.edu 438229Snate@binkert.org#include "arch/x86/insts/badmicroop.hh" 448229Snate@binkert.org#include "arch/x86/insts/static_inst.hh" 455786Sgblack@eecs.umich.edu#include "arch/x86/emulenv.hh" 465786Sgblack@eecs.umich.edu#include "arch/x86/types.hh" 475786Sgblack@eecs.umich.edu 485786Sgblack@eecs.umich.edunamespace X86ISA 495786Sgblack@eecs.umich.edu{ 505786Sgblack@eecs.umich.edu// Base class for combinationally generated macroops 515788Sgblack@eecs.umich.educlass MacroopBase : public X86StaticInst 525786Sgblack@eecs.umich.edu{ 535786Sgblack@eecs.umich.edu protected: 545788Sgblack@eecs.umich.edu const char *macrocodeBlock; 555788Sgblack@eecs.umich.edu 565786Sgblack@eecs.umich.edu const uint32_t numMicroops; 575788Sgblack@eecs.umich.edu X86ISA::EmulEnv env; 585786Sgblack@eecs.umich.edu 595786Sgblack@eecs.umich.edu //Constructor. 605786Sgblack@eecs.umich.edu MacroopBase(const char *mnem, ExtMachInst _machInst, 615788Sgblack@eecs.umich.edu uint32_t _numMicroops, X86ISA::EmulEnv _env) : 625788Sgblack@eecs.umich.edu X86StaticInst(mnem, _machInst, No_OpClass), 635788Sgblack@eecs.umich.edu numMicroops(_numMicroops), env(_env) 645786Sgblack@eecs.umich.edu { 655786Sgblack@eecs.umich.edu assert(numMicroops); 665786Sgblack@eecs.umich.edu microops = new StaticInstPtr[numMicroops]; 675786Sgblack@eecs.umich.edu flags[IsMacroop] = true; 685786Sgblack@eecs.umich.edu } 695786Sgblack@eecs.umich.edu 705786Sgblack@eecs.umich.edu ~MacroopBase() 715786Sgblack@eecs.umich.edu { 725786Sgblack@eecs.umich.edu delete [] microops; 735786Sgblack@eecs.umich.edu } 745786Sgblack@eecs.umich.edu 755786Sgblack@eecs.umich.edu StaticInstPtr * microops; 765786Sgblack@eecs.umich.edu 777720Sgblack@eecs.umich.edu StaticInstPtr 787720Sgblack@eecs.umich.edu fetchMicroop(MicroPC microPC) const 795786Sgblack@eecs.umich.edu { 807966Sgblack@eecs.umich.edu if (microPC >= numMicroops) 817966Sgblack@eecs.umich.edu return badMicroop; 827966Sgblack@eecs.umich.edu else 837966Sgblack@eecs.umich.edu return microops[microPC]; 845786Sgblack@eecs.umich.edu } 855786Sgblack@eecs.umich.edu 865788Sgblack@eecs.umich.edu std::string 875788Sgblack@eecs.umich.edu generateDisassembly(Addr pc, const SymbolTable *symtab) const 885786Sgblack@eecs.umich.edu { 895786Sgblack@eecs.umich.edu return mnemonic; 905786Sgblack@eecs.umich.edu } 915786Sgblack@eecs.umich.edu 925786Sgblack@eecs.umich.edu public: 935786Sgblack@eecs.umich.edu ExtMachInst 945786Sgblack@eecs.umich.edu getExtMachInst() 955786Sgblack@eecs.umich.edu { 965786Sgblack@eecs.umich.edu return machInst; 975786Sgblack@eecs.umich.edu } 985786Sgblack@eecs.umich.edu 995786Sgblack@eecs.umich.edu X86ISA::EmulEnv 1005786Sgblack@eecs.umich.edu getEmulEnv() 1015786Sgblack@eecs.umich.edu { 1025788Sgblack@eecs.umich.edu return env; 1035786Sgblack@eecs.umich.edu } 1045786Sgblack@eecs.umich.edu}; 1055786Sgblack@eecs.umich.edu} 1065786Sgblack@eecs.umich.edu 1075786Sgblack@eecs.umich.edu#endif //__ARCH_X86_INSTS_MACROOP_HH__ 108