gem5  v20.1.0.0
unimp.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __ARCH_SPARC_INSTS_UNIMP_HH__
30 #define __ARCH_SPARC_INSTS_UNIMP_HH__
31 
32 #include <memory>
33 
36 #include "base/cprintf.hh"
37 
38 namespace SparcISA
39 {
40 
42 //
43 // Unimplemented instructions
44 //
45 
54 {
55  public:
57  FailUnimplemented(const char *_mnemonic, ExtMachInst _machInst) :
58  SparcStaticInst(_mnemonic, _machInst, No_OpClass)
59  {}
60 
61  Fault
62  execute(ExecContext *xc, Trace::InstRecord *traceData) const override
63  {
64  return std::make_shared<GenericISA::M5PanicFault>(
65  "attempt to execute unimplemented instruction '%s' (inst %#08x)",
67  }
68 
69  std::string
71  Addr pc, const Loader::SymbolTable *symtab) const override
72  {
73  return csprintf("%-10s (unimplemented)", mnemonic);
74  }
75 };
76 
87 {
88  private:
90  mutable bool warned;
91 
92  public:
94  WarnUnimplemented(const char *_mnemonic, ExtMachInst _machInst) :
95  SparcStaticInst(_mnemonic, _machInst, No_OpClass), warned(false)
96  {}
97 
98  Fault
99  execute(ExecContext *xc, Trace::InstRecord *traceData) const override
100  {
101  if (!warned) {
102  return std::make_shared<GenericISA::M5WarnFault>(
103  "instruction '%s' unimplemented\n", mnemonic);
104  warned = true;
105  }
106  return NoFault;
107  }
108 
109  std::string
111  Addr pc, const Loader::SymbolTable *symtab) const override
112  {
113  return csprintf("%-10s (unimplemented)", mnemonic);
114  }
115 };
116 
117 }
118 
119 #endif // __ARCH_SPARC_INSTS_UNIMP_HH__
SparcISA::WarnUnimplemented::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: unimp.hh:110
SparcISA::WarnUnimplemented::WarnUnimplemented
WarnUnimplemented(const char *_mnemonic, ExtMachInst _machInst)
Constructor.
Definition: unimp.hh:94
SparcISA::FailUnimplemented
Static instruction class for unimplemented instructions that cause simulator termination.
Definition: unimp.hh:53
Loader::SymbolTable
Definition: symtab.hh:59
Trace::InstRecord
Definition: insttracer.hh:55
SparcISA::FailUnimplemented::execute
Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const override
Definition: unimp.hh:62
SparcISA
Definition: asi.cc:31
SparcISA::FailUnimplemented::FailUnimplemented
FailUnimplemented(const char *_mnemonic, ExtMachInst _machInst)
Constructor.
Definition: unimp.hh:57
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
StaticInst::mnemonic
const char * mnemonic
Base mnemonic (e.g., "add").
Definition: static_inst.hh:258
cprintf.hh
StaticInst::ExtMachInst
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:245
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SparcISA::SparcStaticInst
Base class for all SPARC static instructions.
Definition: static_inst.hh:87
SparcISA::WarnUnimplemented::execute
Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const override
Definition: unimp.hh:99
SparcISA::FailUnimplemented::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: unimp.hh:70
StaticInst::machInst
const ExtMachInst machInst
The binary machine instruction.
Definition: static_inst.hh:243
static_inst.hh
debugfaults.hh
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
SparcISA::WarnUnimplemented
Base class for unimplemented instructions that cause a warning to be printed (but do not terminate si...
Definition: unimp.hh:86
SparcISA::WarnUnimplemented::warned
bool warned
Have we warned on this instruction yet?
Definition: unimp.hh:90

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17