cpuid.isa revision 7087
15659Sgblack@eecs.umich.edu// Copyright (c) 2008 The Hewlett-Packard Development Company 25659Sgblack@eecs.umich.edu// All rights reserved. 35659Sgblack@eecs.umich.edu// 47087Snate@binkert.org// The license below extends only to copyright in the software and shall 57087Snate@binkert.org// not be construed as granting a license to any other intellectual 67087Snate@binkert.org// property including but not limited to intellectual property relating 77087Snate@binkert.org// to a hardware implementation of the functionality of the software 87087Snate@binkert.org// licensed hereunder. You may use the software subject to the license 97087Snate@binkert.org// terms below provided that you ensure that this notice is replicated 107087Snate@binkert.org// unmodified and in its entirety in all distributions of the software, 117087Snate@binkert.org// modified or unmodified, in source code or in binary form. 125659Sgblack@eecs.umich.edu// 137087Snate@binkert.org// Redistribution and use in source and binary forms, with or without 147087Snate@binkert.org// modification, are permitted provided that the following conditions are 157087Snate@binkert.org// met: redistributions of source code must retain the above copyright 167087Snate@binkert.org// notice, this list of conditions and the following disclaimer; 177087Snate@binkert.org// redistributions in binary form must reproduce the above copyright 187087Snate@binkert.org// notice, this list of conditions and the following disclaimer in the 197087Snate@binkert.org// documentation and/or other materials provided with the distribution; 207087Snate@binkert.org// neither the name of the copyright holders nor the names of its 215659Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 227087Snate@binkert.org// this software without specific prior written permission. 235659Sgblack@eecs.umich.edu// 245659Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 255659Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 265659Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 275659Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 285659Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 295659Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 305659Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 315659Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 325659Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 335659Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 345659Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 355659Sgblack@eecs.umich.edu// 365659Sgblack@eecs.umich.edu// Authors: Gabe Black 375659Sgblack@eecs.umich.edu 385659Sgblack@eecs.umich.eduoutput header {{ 395659Sgblack@eecs.umich.edu class CPUIDInst : public X86ISA::X86StaticInst 405659Sgblack@eecs.umich.edu { 415659Sgblack@eecs.umich.edu public: 425659Sgblack@eecs.umich.edu static const RegIndex foldOBit = 0; 435659Sgblack@eecs.umich.edu /// Constructor 445659Sgblack@eecs.umich.edu CPUIDInst(const char *_mnemonic, ExtMachInst _machInst, 455659Sgblack@eecs.umich.edu OpClass __opClass) : 465659Sgblack@eecs.umich.edu X86ISA::X86StaticInst(_mnemonic, _machInst, __opClass) 475659Sgblack@eecs.umich.edu { 485659Sgblack@eecs.umich.edu } 495659Sgblack@eecs.umich.edu 505659Sgblack@eecs.umich.edu std::string generateDisassembly(Addr pc, 515659Sgblack@eecs.umich.edu const SymbolTable *symtab) const; 525659Sgblack@eecs.umich.edu }; 535659Sgblack@eecs.umich.edu}}; 545659Sgblack@eecs.umich.edu 555659Sgblack@eecs.umich.eduoutput decoder {{ 565659Sgblack@eecs.umich.edu std::string CPUIDInst::generateDisassembly(Addr PC, 575659Sgblack@eecs.umich.edu const SymbolTable *symtab) const 585659Sgblack@eecs.umich.edu { 595659Sgblack@eecs.umich.edu std::stringstream response; 605659Sgblack@eecs.umich.edu 615659Sgblack@eecs.umich.edu printMnemonic(response, mnemonic); 625659Sgblack@eecs.umich.edu ccprintf(response, " "); 635659Sgblack@eecs.umich.edu printReg(response, _srcRegIdx[0], machInst.opSize); 645659Sgblack@eecs.umich.edu return response.str(); 655659Sgblack@eecs.umich.edu } 665659Sgblack@eecs.umich.edu}}; 675659Sgblack@eecs.umich.edu 685659Sgblack@eecs.umich.edudef template CPUIDExecute {{ 695659Sgblack@eecs.umich.edu Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 705659Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 715659Sgblack@eecs.umich.edu { 725659Sgblack@eecs.umich.edu // If the CPUID instruction used a valid function number, this will 735659Sgblack@eecs.umich.edu // be set to true. Otherwise, the instruction does nothing. 745659Sgblack@eecs.umich.edu bool success; 755659Sgblack@eecs.umich.edu %(op_decl)s; 765659Sgblack@eecs.umich.edu %(op_rd)s; 775659Sgblack@eecs.umich.edu %(code)s; 785659Sgblack@eecs.umich.edu if (success) { 795659Sgblack@eecs.umich.edu %(op_wb)s; 805659Sgblack@eecs.umich.edu } 815659Sgblack@eecs.umich.edu return NoFault; 825659Sgblack@eecs.umich.edu } 835659Sgblack@eecs.umich.edu}}; 845659Sgblack@eecs.umich.edu 855659Sgblack@eecs.umich.edudef format CPUIDInst(code, *opt_flags) {{ 865659Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'CPUIDInst', code, opt_flags) 875659Sgblack@eecs.umich.edu header_output = BasicDeclare.subst(iop) 885659Sgblack@eecs.umich.edu decoder_output = BasicConstructor.subst(iop) 895659Sgblack@eecs.umich.edu decode_block = BasicDecode.subst(iop) 905659Sgblack@eecs.umich.edu exec_output = CPUIDExecute.subst(iop) 915659Sgblack@eecs.umich.edu}}; 925659Sgblack@eecs.umich.edu 93