unknown.isa revision 2649
15094Sgblack@eecs.umich.edu// -*- mode:c++ -*- 22632Sstever@eecs.umich.edu 32632Sstever@eecs.umich.edu// Copyright (c) 2003-2005 The Regents of The University of Michigan 42632Sstever@eecs.umich.edu// All rights reserved. 52632Sstever@eecs.umich.edu// 62632Sstever@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 72632Sstever@eecs.umich.edu// modification, are permitted provided that the following conditions are 82632Sstever@eecs.umich.edu// met: redistributions of source code must retain the above copyright 92632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 102632Sstever@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 112632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 122632Sstever@eecs.umich.edu// documentation and/or other materials provided with the distribution; 132632Sstever@eecs.umich.edu// neither the name of the copyright holders nor the names of its 142632Sstever@eecs.umich.edu// contributors may be used to endorse or promote products derived from 152632Sstever@eecs.umich.edu// this software without specific prior written permission. 162632Sstever@eecs.umich.edu// 172632Sstever@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182632Sstever@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192632Sstever@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202632Sstever@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212632Sstever@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222632Sstever@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232632Sstever@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242632Sstever@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252632Sstever@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262632Sstever@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272632Sstever@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282632Sstever@eecs.umich.edu 292632Sstever@eecs.umich.edu//////////////////////////////////////////////////////////////////// 302632Sstever@eecs.umich.edu// 312469SN/A// Unknown instructions 322469SN/A// 332482SN/A 342469SN/Aoutput header {{ 352469SN/A std::string inst2string(MachInst machInst); 363599Sgblack@eecs.umich.edu}}; 3712287Sgabeblack@google.comoutput decoder {{ 3812287Sgabeblack@google.com 3912287Sgabeblack@google.comstd::string inst2string(MachInst machInst) 4012287Sgabeblack@google.com{ 4112287Sgabeblack@google.com string str = ""; 422469SN/A uint32_t mask = 0x80000000; 432469SN/A 442469SN/A for(int i=0; i < 32; i++) { 4512287Sgabeblack@google.com if ((machInst & mask) == 0) { 4612287Sgabeblack@google.com str += "0"; 4712287Sgabeblack@google.com } else { 4812287Sgabeblack@google.com str += "1"; 4912287Sgabeblack@google.com } 502469SN/A 5112287Sgabeblack@google.com mask = mask >> 1; 5212287Sgabeblack@google.com } 5312287Sgabeblack@google.com 542469SN/A return str; 5512287Sgabeblack@google.com} 565094Sgblack@eecs.umich.edu 5712287Sgabeblack@google.com std::string 5812287Sgabeblack@google.com Unknown::generateDisassembly(Addr pc, const SymbolTable *symtab) const 5912287Sgabeblack@google.com { 6012287Sgabeblack@google.com return csprintf("%-10s (inst 0x%x, opcode 0x%x, binary:%s)", 6112287Sgabeblack@google.com "unknown", machInst, OPCODE, inst2string(machInst)); 622469SN/A } 632469SN/A}}; 642526SN/A 6512287Sgabeblack@google.comoutput exec {{ 6612287Sgabeblack@google.com Fault 6712287Sgabeblack@google.com Unknown::execute(%(CPU_exec_context)s *xc, 6812287Sgabeblack@google.com Trace::InstRecord *traceData) const 6912287Sgabeblack@google.com { 7012287Sgabeblack@google.com panic("attempt to execute unknown instruction " 7112287Sgabeblack@google.com "(inst 0x%08x, opcode 0x%x, binary: %s)", machInst, OPCODE, inst2string(machInst)); 7212287Sgabeblack@google.com return new UnimplementedOpcodeFault; 7312287Sgabeblack@google.com } 7412287Sgabeblack@google.com}}; 7512287Sgabeblack@google.com 7612287Sgabeblack@google.comdef format Unknown() {{ 7712287Sgabeblack@google.com decode_block = 'return new Unknown(machInst);\n' 783599Sgblack@eecs.umich.edu}}; 793599Sgblack@eecs.umich.edu 8012287Sgabeblack@google.com