unknown.isa revision 2649:2fb859a457a2
19243SN/A// -*- mode:c++ -*-
210889Sandreas.hansson@arm.com
39243SN/A// Copyright (c) 2003-2005 The Regents of The University of Michigan
49243SN/A// All rights reserved.
59243SN/A//
69243SN/A// Redistribution and use in source and binary forms, with or without
79243SN/A// modification, are permitted provided that the following conditions are
89243SN/A// met: redistributions of source code must retain the above copyright
99243SN/A// notice, this list of conditions and the following disclaimer;
109243SN/A// redistributions in binary form must reproduce the above copyright
119243SN/A// notice, this list of conditions and the following disclaimer in the
129243SN/A// documentation and/or other materials provided with the distribution;
139243SN/A// neither the name of the copyright holders nor the names of its
149831SN/A// contributors may be used to endorse or promote products derived from
159831SN/A// this software without specific prior written permission.
169831SN/A//
179243SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
189243SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
199243SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
209243SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
219243SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
229243SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
239243SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
249243SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
259243SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
269243SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
279243SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
289243SN/A
299243SN/A////////////////////////////////////////////////////////////////////
309243SN/A//
319243SN/A// Unknown instructions
329243SN/A//
339243SN/A
349243SN/Aoutput header {{
359243SN/A        std::string inst2string(MachInst machInst);
369243SN/A}};
379243SN/Aoutput decoder {{
389243SN/A
399243SN/Astd::string inst2string(MachInst machInst)
409243SN/A{
419243SN/A    string str = "";
429967SN/A    uint32_t mask = 0x80000000;
4310618SOmar.Naji@arm.com
449243SN/A    for(int i=0; i < 32; i++) {
459243SN/A        if ((machInst & mask) == 0) {
4610146Sandreas.hansson@arm.com            str += "0";
479356SN/A        } else {
4810146Sandreas.hansson@arm.com            str += "1";
4910247Sandreas.hansson@arm.com        }
5010208Sandreas.hansson@arm.com
519352SN/A        mask = mask >> 1;
5210146Sandreas.hansson@arm.com    }
539814SN/A
549243SN/A    return str;
559243SN/A}
5610432SOmar.Naji@arm.com
579243SN/A    std::string
5810146Sandreas.hansson@arm.com    Unknown::generateDisassembly(Addr pc, const SymbolTable *symtab) const
599243SN/A    {
6010619Sandreas.hansson@arm.com        return csprintf("%-10s (inst 0x%x, opcode 0x%x, binary:%s)",
619243SN/A                        "unknown", machInst, OPCODE, inst2string(machInst));
6210211Sandreas.hansson@arm.com    }
6310618SOmar.Naji@arm.com}};
6410489SOmar.Naji@arm.com
659831SN/Aoutput exec {{
669831SN/A    Fault
679831SN/A    Unknown::execute(%(CPU_exec_context)s *xc,
689831SN/A                     Trace::InstRecord *traceData) const
699831SN/A    {
7010140SN/A        panic("attempt to execute unknown instruction "
7110646Sandreas.hansson@arm.com              "(inst 0x%08x, opcode 0x%x, binary: %s)", machInst, OPCODE, inst2string(machInst));
729243SN/A        return new UnimplementedOpcodeFault;
7310394Swendy.elsasser@arm.com    }
7410394Swendy.elsasser@arm.com}};
759566SN/A
769243SN/Adef format Unknown() {{
779243SN/A    decode_block = 'return new Unknown(machInst);\n'
7810140SN/A}};
7910140SN/A
8010147Sandreas.hansson@arm.com