diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2014-10-16 05:49:51 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2014-10-16 05:49:51 -0400 |
commit | a2d246b6b8379f9a74dbc56feefc155f615b5ea4 (patch) | |
tree | bbfaf7a39edebda5ca7ddac9af5e205823d37e10 /src/arch/sparc/isa/formats | |
parent | a769963d16b7b259580fa2da1e84f62aae0a5a42 (diff) | |
download | gem5-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/sparc/isa/formats')
-rw-r--r-- | src/arch/sparc/isa/formats/mem/util.isa | 12 | ||||
-rw-r--r-- | src/arch/sparc/isa/formats/priv.isa | 4 | ||||
-rw-r--r-- | src/arch/sparc/isa/formats/trap.isa | 2 | ||||
-rw-r--r-- | src/arch/sparc/isa/formats/unknown.isa | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/arch/sparc/isa/formats/mem/util.isa b/src/arch/sparc/isa/formats/mem/util.isa index cf0a62ed9..53559e493 100644 --- a/src/arch/sparc/isa/formats/mem/util.isa +++ b/src/arch/sparc/isa/formats/mem/util.isa @@ -303,15 +303,15 @@ let {{ # and we're dealing with doubles BlockAlignmentFaultCheck = ''' if (RD & 0xe) - fault = new IllegalInstruction; + fault = std::make_shared<IllegalInstruction>(); else if (EA & 0x3f) - fault = new MemAddressNotAligned; + fault = std::make_shared<MemAddressNotAligned>(); ''' TwinAlignmentFaultCheck = ''' if (RD & 0x1) - fault = new IllegalInstruction; + fault = std::make_shared<IllegalInstruction>(); else if (EA & 0xf) - fault = new MemAddressNotAligned; + fault = std::make_shared<MemAddressNotAligned>(); ''' # XXX Need to take care of pstate.hpriv as well. The lower ASIs # are split into ones that are available in priv and hpriv, and @@ -320,9 +320,9 @@ let {{ if ((!Pstate.priv && !Hpstate.hpriv && !asiIsUnPriv((ASI)EXT_ASI)) || (!Hpstate.hpriv && asiIsHPriv((ASI)EXT_ASI))) - fault = new PrivilegedAction; + fault = std::make_shared<PrivilegedAction>(); else if (asiIsAsIfUser((ASI)EXT_ASI) && !Pstate.priv) - fault = new PrivilegedAction; + fault = std::make_shared<PrivilegedAction>(); ''' TruncateEA = ''' diff --git a/src/arch/sparc/isa/formats/priv.isa b/src/arch/sparc/isa/formats/priv.isa index b52637f81..24b553fe3 100644 --- a/src/arch/sparc/isa/formats/priv.isa +++ b/src/arch/sparc/isa/formats/priv.isa @@ -203,10 +203,10 @@ def template PrivExecute {{ // If the processor isn't in privileged mode, fault out right away if (%(check)s) - return new PrivilegedAction; + return std::make_shared<PrivilegedAction>(); if (%(tlCheck)s) - return new IllegalInstruction; + return std::make_shared<IllegalInstruction>(); Fault fault = NoFault; %(code)s; diff --git a/src/arch/sparc/isa/formats/trap.isa b/src/arch/sparc/isa/formats/trap.isa index bda7d5192..fff30f8ee 100644 --- a/src/arch/sparc/isa/formats/trap.isa +++ b/src/arch/sparc/isa/formats/trap.isa @@ -126,7 +126,7 @@ output header {{ def format FpUnimpl(*flags) {{ fpunimpl_code = ''' Fsr = insertBits(Fsr, 16, 14, 3); - fault = new FpExceptionOther; + fault = std::make_shared<FpExceptionOther>(); ''' iop = InstObjParams(name, Name, 'FpUnimpl', fpunimpl_code, flags) header_output = BasicDeclare.subst(iop) diff --git a/src/arch/sparc/isa/formats/unknown.isa b/src/arch/sparc/isa/formats/unknown.isa index 5b2db2b57..2bff7dcf8 100644 --- a/src/arch/sparc/isa/formats/unknown.isa +++ b/src/arch/sparc/isa/formats/unknown.isa @@ -66,7 +66,7 @@ output exec {{ Fault Unknown::execute(CPU_EXEC_CONTEXT *xc, Trace::InstRecord *traceData) const { - return new IllegalInstruction; + return std::make_shared<IllegalInstruction>(); } }}; |