specop.isa revision 4696
14519Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company
24519Sgblack@eecs.umich.edu// All rights reserved.
34519Sgblack@eecs.umich.edu//
44519Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms,
54519Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the
64519Sgblack@eecs.umich.edu// following conditions are met:
74519Sgblack@eecs.umich.edu//
84519Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any
94519Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary
104519Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use.  Illustrative
114519Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study,
124519Sgblack@eecs.umich.edu// teaching, education and corporate research & development.
134519Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for
144519Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for
154519Sgblack@eecs.umich.edu// commercial advantage.
164519Sgblack@eecs.umich.edu//
174519Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be
184519Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact:
194519Sgblack@eecs.umich.edu//     Director of Intellectual Property Licensing
204519Sgblack@eecs.umich.edu//     Office of Strategy and Technology
214519Sgblack@eecs.umich.edu//     Hewlett-Packard Company
224519Sgblack@eecs.umich.edu//     1501 Page Mill Road
234519Sgblack@eecs.umich.edu//     Palo Alto, California  94304
244519Sgblack@eecs.umich.edu//
254519Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice,
264519Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer.  Redistributions
274519Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of
284519Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
294519Sgblack@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
304519Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
314519Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
324519Sgblack@eecs.umich.edu// this software without specific prior written permission.  No right of
334519Sgblack@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
344519Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for
354519Sgblack@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
364519Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
374519Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions;
384519Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright
394519Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where
404519Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below.
414519Sgblack@eecs.umich.edu//
424519Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
434519Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
444519Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
454519Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
464519Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474519Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
484519Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494519Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
504519Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
514519Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
524519Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
534519Sgblack@eecs.umich.edu//
544519Sgblack@eecs.umich.edu// Authors: Gabe Black
554519Sgblack@eecs.umich.edu
564519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
574519Sgblack@eecs.umich.edu//
584519Sgblack@eecs.umich.edu// Fault Microop
594519Sgblack@eecs.umich.edu//
604519Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////////
614519Sgblack@eecs.umich.edu
624590Sgblack@eecs.umich.eduoutput header {{
634679Sgblack@eecs.umich.edu    class MicroFault : public X86ISA::X86MicroopBase
644590Sgblack@eecs.umich.edu    {
654590Sgblack@eecs.umich.edu      protected:
664590Sgblack@eecs.umich.edu        Fault fault;
674590Sgblack@eecs.umich.edu        void buildMe();
684590Sgblack@eecs.umich.edu
694590Sgblack@eecs.umich.edu      public:
704590Sgblack@eecs.umich.edu        MicroFault(ExtMachInst _machInst, const char * instMnem,
714590Sgblack@eecs.umich.edu                bool isMicro, bool isDelayed, bool isFirst, bool isLast,
724590Sgblack@eecs.umich.edu                Fault _fault);
734590Sgblack@eecs.umich.edu
744590Sgblack@eecs.umich.edu        MicroFault(ExtMachInst _machInst, const char * instMnem,
754590Sgblack@eecs.umich.edu                Fault _fault);
764590Sgblack@eecs.umich.edu
774590Sgblack@eecs.umich.edu        %(BasicExecDeclare)s
784696Sgblack@eecs.umich.edu
794696Sgblack@eecs.umich.edu        std::string generateDisassembly(Addr pc,
804696Sgblack@eecs.umich.edu                const SymbolTable *symtab) const;
814590Sgblack@eecs.umich.edu    };
824590Sgblack@eecs.umich.edu}};
834590Sgblack@eecs.umich.edu
844590Sgblack@eecs.umich.eduoutput decoder {{
854590Sgblack@eecs.umich.edu        Fault MicroFault::execute(%(CPU_exec_context)s *xc,
864519Sgblack@eecs.umich.edu                Trace::InstRecord *traceData) const
874519Sgblack@eecs.umich.edu        {
884519Sgblack@eecs.umich.edu            //Return the fault we were constructed with
894519Sgblack@eecs.umich.edu            return fault;
904519Sgblack@eecs.umich.edu        }
914519Sgblack@eecs.umich.edu}};
924519Sgblack@eecs.umich.edu
934590Sgblack@eecs.umich.eduoutput decoder {{
944590Sgblack@eecs.umich.edu    inline MicroFault::MicroFault(
954590Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem, Fault _fault) :
964590Sgblack@eecs.umich.edu        X86MicroopBase(machInst, "fault", instMnem,
974590Sgblack@eecs.umich.edu                false, false, false, false, No_OpClass), fault(_fault)
984519Sgblack@eecs.umich.edu    {
994519Sgblack@eecs.umich.edu    }
1004519Sgblack@eecs.umich.edu
1014590Sgblack@eecs.umich.edu    inline MicroFault::MicroFault(
1024519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1034519Sgblack@eecs.umich.edu            bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1044519Sgblack@eecs.umich.edu            Fault _fault) :
1054590Sgblack@eecs.umich.edu        X86MicroopBase(machInst, "fault", instMnem,
1064590Sgblack@eecs.umich.edu                isMicro, isDelayed, isFirst, isLast, No_OpClass),
1074519Sgblack@eecs.umich.edu                fault(_fault)
1084519Sgblack@eecs.umich.edu    {
1094519Sgblack@eecs.umich.edu    }
1104519Sgblack@eecs.umich.edu}};
1114519Sgblack@eecs.umich.edu
1124696Sgblack@eecs.umich.eduoutput decoder {{
1134696Sgblack@eecs.umich.edu    std::string MicroFault::generateDisassembly(Addr pc,
1144696Sgblack@eecs.umich.edu            const SymbolTable *symtab) const
1154696Sgblack@eecs.umich.edu    {
1164696Sgblack@eecs.umich.edu        std::stringstream response;
1174696Sgblack@eecs.umich.edu
1184696Sgblack@eecs.umich.edu        printMnemonic(response, instMnem, mnemonic);
1194696Sgblack@eecs.umich.edu        if(fault)
1204696Sgblack@eecs.umich.edu            response << fault->name();
1214696Sgblack@eecs.umich.edu        else
1224696Sgblack@eecs.umich.edu            response << "No Fault";
1234696Sgblack@eecs.umich.edu
1244696Sgblack@eecs.umich.edu        return response.str();
1254696Sgblack@eecs.umich.edu    }
1264696Sgblack@eecs.umich.edu}};
1274696Sgblack@eecs.umich.edu
1284519Sgblack@eecs.umich.edulet {{
1294590Sgblack@eecs.umich.edu    class Fault(X86Microop):
1304590Sgblack@eecs.umich.edu        def __init__(self, fault):
1314590Sgblack@eecs.umich.edu            self.fault = fault
1324590Sgblack@eecs.umich.edu
1334590Sgblack@eecs.umich.edu        def getAllocator(self, *microFlags):
1344590Sgblack@eecs.umich.edu            allocator = '''new MicroFault(machInst, mnemonic
1354590Sgblack@eecs.umich.edu                    %(flags)s, %(fault)s)''' % {
1364590Sgblack@eecs.umich.edu                "flags" : self.microFlagsText(microFlags),
1374590Sgblack@eecs.umich.edu                "fault" : self.fault}
1384590Sgblack@eecs.umich.edu            return allocator
1394590Sgblack@eecs.umich.edu    microopClasses["fault"] = Fault
1404519Sgblack@eecs.umich.edu}};
141