12083SN/A// -*- mode:c++ -*-
22083SN/A
32754Sksewell@umich.edu// Copyright (c) 2006 The Regents of The University of Michigan
42083SN/A// All rights reserved.
52083SN/A//
62083SN/A// Redistribution and use in source and binary forms, with or without
72083SN/A// modification, are permitted provided that the following conditions are
82083SN/A// met: redistributions of source code must retain the above copyright
92083SN/A// notice, this list of conditions and the following disclaimer;
102083SN/A// redistributions in binary form must reproduce the above copyright
112083SN/A// notice, this list of conditions and the following disclaimer in the
122083SN/A// documentation and/or other materials provided with the distribution;
132083SN/A// neither the name of the copyright holders nor the names of its
142083SN/A// contributors may be used to endorse or promote products derived from
152083SN/A// this software without specific prior written permission.
162083SN/A//
172083SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182083SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192083SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202083SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212083SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222083SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232083SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242083SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252083SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262083SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272083SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu//
292665Ssaidi@eecs.umich.edu// Authors: Korey Sewell
302083SN/A
312649Ssaidi@eecs.umich.edu////////////////////////////////////////////////////////////////////
322649Ssaidi@eecs.umich.edu//
332649Ssaidi@eecs.umich.edu// Unknown instructions
342649Ssaidi@eecs.umich.edu//
352649Ssaidi@eecs.umich.edu
362495SN/Aoutput header {{
372686Sksewell@umich.edu    /**
382686Sksewell@umich.edu     * Static instruction class for unknown (illegal) instructions.
392686Sksewell@umich.edu     * These cause simulator termination if they are executed in a
402686Sksewell@umich.edu     * non-speculative mode.  This is a leaf class.
412686Sksewell@umich.edu     */
422686Sksewell@umich.edu    class Unknown : public MipsStaticInst
432686Sksewell@umich.edu    {
442686Sksewell@umich.edu      public:
452686Sksewell@umich.edu        /// Constructor
462686Sksewell@umich.edu        Unknown(MachInst _machInst)
472686Sksewell@umich.edu            : MipsStaticInst("unknown", _machInst, No_OpClass)
482686Sksewell@umich.edu        {
492686Sksewell@umich.edu            // don't call execute() (which panics) if we're on a
502686Sksewell@umich.edu            // speculative path
512686Sksewell@umich.edu            flags[IsNonSpeculative] = true;
522495SN/A        }
532495SN/A
5412616Sgabeblack@google.com        Fault execute(ExecContext *, Trace::InstRecord *) const override;
552495SN/A
5612616Sgabeblack@google.com        std::string generateDisassembly(
5712616Sgabeblack@google.com                Addr pc, const SymbolTable *symtab) const override;
582686Sksewell@umich.edu    };
592686Sksewell@umich.edu}};
602495SN/A
612686Sksewell@umich.eduoutput decoder {{
622083SN/A    std::string
632083SN/A    Unknown::generateDisassembly(Addr pc, const SymbolTable *symtab) const
642083SN/A    {
652495SN/A        return csprintf("%-10s (inst 0x%x, opcode 0x%x, binary:%s)",
662495SN/A                        "unknown", machInst, OPCODE, inst2string(machInst));
672083SN/A    }
682083SN/A}};
692083SN/A
702083SN/Aoutput exec {{
712083SN/A    Fault
7212234Sgabeblack@google.com    Unknown::execute(ExecContext *xc, Trace::InstRecord *traceData) const
732083SN/A    {
7410474Sandreas.hansson@arm.com        return std::make_shared<ReservedInstructionFault>();
752083SN/A    }
762083SN/A}};
772083SN/A
782083SN/Adef format Unknown() {{
792083SN/A    decode_block = 'return new Unknown(machInst);\n'
802083SN/A}};
812083SN/A
82