summaryrefslogtreecommitdiff
path: root/src/arch/mips/isa/formats
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:51 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:51 -0400
commita2d246b6b8379f9a74dbc56feefc155f615b5ea4 (patch)
treebbfaf7a39edebda5ca7ddac9af5e205823d37e10 /src/arch/mips/isa/formats
parenta769963d16b7b259580fa2da1e84f62aae0a5a42 (diff)
downloadgem5-a2d246b6b8379f9a74dbc56feefc155f615b5ea4.tar.xz
arch: Use shared_ptr for all Faults
This patch takes quite a large step in transitioning from the ad-hoc RefCountingPtr to the c++11 shared_ptr by adopting its use for all Faults. There are no changes in behaviour, and the code modifications are mostly just replacing "new" with "make_shared".
Diffstat (limited to 'src/arch/mips/isa/formats')
-rw-r--r--src/arch/mips/isa/formats/control.isa10
-rwxr-xr-xsrc/arch/mips/isa/formats/dsp.isa8
-rw-r--r--src/arch/mips/isa/formats/fp.isa2
-rw-r--r--src/arch/mips/isa/formats/int.isa4
-rw-r--r--src/arch/mips/isa/formats/mt.isa6
-rw-r--r--src/arch/mips/isa/formats/trap.isa4
-rw-r--r--src/arch/mips/isa/formats/unimp.isa12
-rw-r--r--src/arch/mips/isa/formats/unknown.isa2
8 files changed, 24 insertions, 24 deletions
diff --git a/src/arch/mips/isa/formats/control.isa b/src/arch/mips/isa/formats/control.isa
index c9ef6707f..123468287 100644
--- a/src/arch/mips/isa/formats/control.isa
+++ b/src/arch/mips/isa/formats/control.isa
@@ -94,7 +94,7 @@ def template CP0Execute {{
%(op_wb)s;
}
} else {
- fault = new CoprocessorUnusableFault(0);
+ fault = std::make_shared<CoprocessorUnusableFault>(0);
}
return fault;
}
@@ -110,7 +110,7 @@ def template CP1Execute {{
if (isCoprocessorEnabled(xc, 1)) {
%(code)s;
} else {
- fault = new CoprocessorUnusableFault(1);
+ fault = std::make_shared<CoprocessorUnusableFault>(1);
}
if(fault == NoFault)
@@ -133,13 +133,13 @@ def template ControlTLBExecute {{
if(isMMUTLB(xc)){
%(code)s;
} else {
- fault = new ReservedInstructionFault();
+ fault = std::make_shared<ReservedInstructionFault>();
}
} else {
- fault = new CoprocessorUnusableFault(0);
+ fault = std::make_shared<CoprocessorUnusableFault>(0);
}
} else { // Syscall Emulation Mode - No TLB Instructions
- fault = new ReservedInstructionFault();
+ fault = std::make_shared<ReservedInstructionFault>();
}
if (fault == NoFault) {
diff --git a/src/arch/mips/isa/formats/dsp.isa b/src/arch/mips/isa/formats/dsp.isa
index 39232bfe0..2a946ed9d 100755
--- a/src/arch/mips/isa/formats/dsp.isa
+++ b/src/arch/mips/isa/formats/dsp.isa
@@ -79,12 +79,12 @@ def template DspExecute {{
}
else
{
- fault = new DspStateDisabledFault();
+ fault = std::make_shared<DspStateDisabledFault>();
}
}
else
{
- fault = new ReservedInstructionFault();
+ fault = std::make_shared<ReservedInstructionFault>();
}
if(fault == NoFault)
@@ -112,12 +112,12 @@ def template DspHiLoExecute {{
}
else
{
- fault = new DspStateDisabledFault();
+ fault = std::make_shared<DspStateDisabledFault>();
}
}
else
{
- fault = new ReservedInstructionFault();
+ fault = std::make_shared<ReservedInstructionFault>();
}
if(fault == NoFault)
diff --git a/src/arch/mips/isa/formats/fp.isa b/src/arch/mips/isa/formats/fp.isa
index 731c6c06a..c0dff477b 100644
--- a/src/arch/mips/isa/formats/fp.isa
+++ b/src/arch/mips/isa/formats/fp.isa
@@ -97,7 +97,7 @@ output exec {{
//@TODO: Implement correct CP0 checks to see if the CP1
// unit is enable or not
if (!isCoprocessorEnabled(xc, 1))
- return new CoprocessorUnusableFault(1);
+ return std::make_shared<CoprocessorUnusableFault>(1);
return NoFault;
}
diff --git a/src/arch/mips/isa/formats/int.isa b/src/arch/mips/isa/formats/int.isa
index 42a1abfe6..52358bbdb 100644
--- a/src/arch/mips/isa/formats/int.isa
+++ b/src/arch/mips/isa/formats/int.isa
@@ -160,7 +160,7 @@ def template HiLoRsSelExecute {{
if( ACSRC > 0 && !isDspEnabled(xc) )
{
- fault = new DspStateDisabledFault();
+ fault = std::make_shared<DspStateDisabledFault>();
}
else
{
@@ -186,7 +186,7 @@ def template HiLoRdSelExecute {{
if( ACDST > 0 && !isDspEnabled(xc) )
{
- fault = new DspStateDisabledFault();
+ fault = std::make_shared<DspStateDisabledFault>();
}
else
{
diff --git a/src/arch/mips/isa/formats/mt.isa b/src/arch/mips/isa/formats/mt.isa
index f3369edc0..8d2254cb4 100644
--- a/src/arch/mips/isa/formats/mt.isa
+++ b/src/arch/mips/isa/formats/mt.isa
@@ -140,7 +140,7 @@ def template ThreadRegisterExecute {{
%(code)s;
}
} else {
- fault = new CoprocessorUnusableFault(0);
+ fault = std::make_shared<CoprocessorUnusableFault>(0);
}
if(fault == NoFault)
@@ -167,10 +167,10 @@ def template MTExecute{{
if (config3.mt == 1) {
%(code)s;
} else {
- fault = new ReservedInstructionFault();
+ fault = std::make_shared<ReservedInstructionFault>();
}
} else {
- fault = new CoprocessorUnusableFault(0);
+ fault = std::make_shared<CoprocessorUnusableFault>(0);
}
if(fault == NoFault)
diff --git a/src/arch/mips/isa/formats/trap.isa b/src/arch/mips/isa/formats/trap.isa
index 6f8275687..796cb5928 100644
--- a/src/arch/mips/isa/formats/trap.isa
+++ b/src/arch/mips/isa/formats/trap.isa
@@ -94,7 +94,7 @@ def format Trap(code, *flags) {{
code ='bool cond;\n' + code
code += 'if (cond) {\n'
- code += 'fault = new TrapFault();\n};'
+ code += 'fault = std::make_shared<TrapFault>();\n};'
iop = InstObjParams(name, Name, 'MipsStaticInst', code, flags)
header_output = BasicDeclare.subst(iop)
@@ -106,7 +106,7 @@ def format TrapImm(code, *flags) {{
code ='bool cond;\n' + code
code += 'if (cond) {\n'
- code += 'fault = new TrapFault();\n};'
+ code += 'fault = std::make_shared<TrapFault>();\n};'
iop = InstObjParams(name, Name, 'MipsStaticInst', code, flags)
header_output = BasicDeclare.subst(iop)
decoder_output = BasicConstructor.subst(iop)
diff --git a/src/arch/mips/isa/formats/unimp.isa b/src/arch/mips/isa/formats/unimp.isa
index b5bcb6e5a..a51865584 100644
--- a/src/arch/mips/isa/formats/unimp.isa
+++ b/src/arch/mips/isa/formats/unimp.isa
@@ -195,9 +195,9 @@ output exec {{
{
if (FullSystem) {
if (!isCoprocessorEnabled(xc, 0))
- return new CoprocessorUnusableFault(0);
+ return std::make_shared<CoprocessorUnusableFault>(0);
else
- return new ReservedInstructionFault;
+ return std::make_shared<ReservedInstructionFault>();
} else {
panic("attempt to execute unimplemented instruction '%s' "
"(inst %#08x, opcode %#x, binary:%s)",
@@ -212,9 +212,9 @@ output exec {{
{
if (FullSystem) {
if (!isCoprocessorEnabled(xc, 1))
- return new CoprocessorUnusableFault(1);
+ return std::make_shared<CoprocessorUnusableFault>(1);
else
- return new ReservedInstructionFault;
+ return std::make_shared<ReservedInstructionFault>();
} else {
panic("attempt to execute unimplemented instruction '%s' "
"(inst %#08x, opcode %#x, binary:%s)",
@@ -229,9 +229,9 @@ output exec {{
{
if (FullSystem) {
if (!isCoprocessorEnabled(xc, 2))
- return new CoprocessorUnusableFault(2);
+ return std::make_shared<CoprocessorUnusableFault>(2);
else
- return new ReservedInstructionFault;
+ return std::make_shared<ReservedInstructionFault>();
} else {
panic("attempt to execute unimplemented instruction '%s' "
"(inst %#08x, opcode %#x, binary:%s)",
diff --git a/src/arch/mips/isa/formats/unknown.isa b/src/arch/mips/isa/formats/unknown.isa
index ba8fc5c07..fd6c9ea18 100644
--- a/src/arch/mips/isa/formats/unknown.isa
+++ b/src/arch/mips/isa/formats/unknown.isa
@@ -72,7 +72,7 @@ output exec {{
Unknown::execute(CPU_EXEC_CONTEXT *xc,
Trace::InstRecord *traceData) const
{
- return new ReservedInstructionFault;
+ return std::make_shared<ReservedInstructionFault>();
}
}};