specop.isa revision 4679
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
784590Sgblack@eecs.umich.edu    };
794590Sgblack@eecs.umich.edu}};
804590Sgblack@eecs.umich.edu
814590Sgblack@eecs.umich.eduoutput decoder {{
824590Sgblack@eecs.umich.edu        Fault MicroFault::execute(%(CPU_exec_context)s *xc,
834519Sgblack@eecs.umich.edu                Trace::InstRecord *traceData) const
844519Sgblack@eecs.umich.edu        {
854519Sgblack@eecs.umich.edu            //Return the fault we were constructed with
864519Sgblack@eecs.umich.edu            return fault;
874519Sgblack@eecs.umich.edu        }
884519Sgblack@eecs.umich.edu}};
894519Sgblack@eecs.umich.edu
904590Sgblack@eecs.umich.eduoutput decoder {{
914590Sgblack@eecs.umich.edu    inline MicroFault::MicroFault(
924590Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem, Fault _fault) :
934590Sgblack@eecs.umich.edu        X86MicroopBase(machInst, "fault", instMnem,
944590Sgblack@eecs.umich.edu                false, false, false, false, No_OpClass), fault(_fault)
954519Sgblack@eecs.umich.edu    {
964519Sgblack@eecs.umich.edu    }
974519Sgblack@eecs.umich.edu
984590Sgblack@eecs.umich.edu    inline MicroFault::MicroFault(
994519Sgblack@eecs.umich.edu            ExtMachInst machInst, const char * instMnem,
1004519Sgblack@eecs.umich.edu            bool isMicro, bool isDelayed, bool isFirst, bool isLast,
1014519Sgblack@eecs.umich.edu            Fault _fault) :
1024590Sgblack@eecs.umich.edu        X86MicroopBase(machInst, "fault", instMnem,
1034590Sgblack@eecs.umich.edu                isMicro, isDelayed, isFirst, isLast, No_OpClass),
1044519Sgblack@eecs.umich.edu                fault(_fault)
1054519Sgblack@eecs.umich.edu    {
1064519Sgblack@eecs.umich.edu    }
1074519Sgblack@eecs.umich.edu}};
1084519Sgblack@eecs.umich.edu
1094519Sgblack@eecs.umich.edulet {{
1104590Sgblack@eecs.umich.edu    class Fault(X86Microop):
1114590Sgblack@eecs.umich.edu        def __init__(self, fault):
1124590Sgblack@eecs.umich.edu            self.fault = fault
1134590Sgblack@eecs.umich.edu
1144590Sgblack@eecs.umich.edu        def getAllocator(self, *microFlags):
1154590Sgblack@eecs.umich.edu            allocator = '''new MicroFault(machInst, mnemonic
1164590Sgblack@eecs.umich.edu                    %(flags)s, %(fault)s)''' % {
1174590Sgblack@eecs.umich.edu                "flags" : self.microFlagsText(microFlags),
1184590Sgblack@eecs.umich.edu                "fault" : self.fault}
1194590Sgblack@eecs.umich.edu            return allocator
1204590Sgblack@eecs.umich.edu    microopClasses["fault"] = Fault
1214519Sgblack@eecs.umich.edu}};
122