microop.hh revision 7620
12623SN/A/*
22623SN/A * Copyright (c) 2007 The Hewlett-Packard Development Company
32623SN/A * All rights reserved.
42623SN/A *
52623SN/A * The license below extends only to copyright in the software and shall
62623SN/A * not be construed as granting a license to any other intellectual
72623SN/A * property including but not limited to intellectual property relating
82623SN/A * to a hardware implementation of the functionality of the software
92623SN/A * licensed hereunder.  You may use the software subject to the license
102623SN/A * terms below provided that you ensure that this notice is replicated
112623SN/A * unmodified and in its entirety in all distributions of the software,
122623SN/A * modified or unmodified, in source code or in binary form.
132623SN/A *
142623SN/A * Redistribution and use in source and binary forms, with or without
152623SN/A * modification, are permitted provided that the following conditions are
162623SN/A * met: redistributions of source code must retain the above copyright
172623SN/A * notice, this list of conditions and the following disclaimer;
182623SN/A * redistributions in binary form must reproduce the above copyright
192623SN/A * notice, this list of conditions and the following disclaimer in the
202623SN/A * documentation and/or other materials provided with the distribution;
212623SN/A * neither the name of the copyright holders nor the names of its
222623SN/A * contributors may be used to endorse or promote products derived from
232623SN/A * this software without specific prior written permission.
242623SN/A *
252623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
262623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
272665Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
282665Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
292623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
302623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
313170Sstever@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
323806Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
332623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
344040Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
352623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
362623SN/A *
373348Sbinkertn@umich.edu * Authors: Gabe Black
383348Sbinkertn@umich.edu */
392623SN/A
402901Ssaidi@eecs.umich.edu#ifndef __ARCH_X86_INSTS_MICROOP_HH__
412623SN/A#define __ARCH_X86_INSTS_MICROOP_HH__
422623SN/A
432623SN/A#include "arch/x86/insts/static_inst.hh"
442623SN/A
452623SN/Anamespace X86ISA
462623SN/A{
472623SN/A    namespace ConditionTests
482623SN/A    {
492623SN/A        enum CondTest {
502623SN/A            True,
512623SN/A            NotFalse = True,
522623SN/A            ECF,
532623SN/A            EZF,
542623SN/A            SZnZF,
552623SN/A            MSTRZ,
562623SN/A            STRZ,
572623SN/A            MSTRC,
582623SN/A            STRZnEZF,
592623SN/A            OF,
604873Sstever@eecs.umich.edu            CF,
612623SN/A            ZF,
622623SN/A            CvZF,
632856Srdreslin@umich.edu            SF,
642856Srdreslin@umich.edu            PF,
652856Srdreslin@umich.edu            SxOF,
662856Srdreslin@umich.edu            SxOvZF,
672856Srdreslin@umich.edu
682856Srdreslin@umich.edu            False,
692856Srdreslin@umich.edu            NotTrue = False,
702856Srdreslin@umich.edu            NotECF,
712856Srdreslin@umich.edu            NotEZF,
722856Srdreslin@umich.edu            NotSZnZF,
732623SN/A            NotMSTRZ,
742623SN/A            NotSTRZ,
752623SN/A            NotMSTRC,
762623SN/A            STRnZnEZF,
772623SN/A            NotOF,
782623SN/A            NotCF,
792680Sktlim@umich.edu            NotZF,
802680Sktlim@umich.edu            NotCvZF,
812623SN/A            NotSF,
822623SN/A            NotPF,
832680Sktlim@umich.edu            NotSxOF,
842623SN/A            NotSxOvZF
852623SN/A        };
862623SN/A    }
872623SN/A
882623SN/A    //A class which is the base of all x86 micro ops. It provides a function to
893349Sbinkertn@umich.edu    //set necessary flags appropriately.
902623SN/A    class X86MicroopBase : public X86StaticInst
913184Srdreslin@umich.edu    {
922623SN/A      protected:
932623SN/A        const char * instMnem;
942623SN/A        uint8_t opSize;
952623SN/A        uint8_t addrSize;
963349Sbinkertn@umich.edu
972623SN/A        X86MicroopBase(ExtMachInst _machInst,
983310Srdreslin@umich.edu                const char *mnem, const char *_instMnem,
993649Srdreslin@umich.edu                uint64_t setFlags, OpClass __opClass) :
1002623SN/A            X86ISA::X86StaticInst(mnem, _machInst, __opClass),
1012623SN/A            instMnem(_instMnem)
1022623SN/A        {
1033349Sbinkertn@umich.edu            flags |= setFlags;
1042623SN/A        }
1053184Srdreslin@umich.edu
1063184Srdreslin@umich.edu        std::string generateDisassembly(Addr pc,
1072623SN/A                const SymbolTable *symtab) const
1082623SN/A        {
1092623SN/A            std::stringstream ss;
1102623SN/A
1112623SN/A            ccprintf(ss, "\t%s.%s", instMnem, mnemonic);
1123647Srdreslin@umich.edu
1133647Srdreslin@umich.edu            return ss.str();
1143647Srdreslin@umich.edu        }
1153647Srdreslin@umich.edu
1163647Srdreslin@umich.edu        bool checkCondition(uint64_t flags, int condition) const;
1172626SN/A    };
1183647Srdreslin@umich.edu}
1192626SN/A
1202623SN/A#endif //__ARCH_X86_INSTS_MICROOP_HH__
1212623SN/A