summaryrefslogtreecommitdiff
path: root/src/cpu/base.cc
diff options
context:
space:
mode:
authorJoel Hestness <hestness@cs.wisc.edu>2012-09-12 21:40:28 -0500
committerJoel Hestness <hestness@cs.wisc.edu>2012-09-12 21:40:28 -0500
commit16dcb723c11afb91cc3428294bd3106425114949 (patch)
treee550ef18c07430b4a828535d76ea469ca9200f26 /src/cpu/base.cc
parentaa8bcd15ec1ba916f3e750f41697a65e06b3c2ac (diff)
downloadgem5-16dcb723c11afb91cc3428294bd3106425114949.tar.xz
Base CPU: Initialize profileEvent to NULL
The profileEvent pointer is tested against NULL in various places, but it is not initialized unless running in full-system mode. In SE mode, this can result in segmentation faults when profileEvent default intializes to something other than NULL.
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r--src/cpu/base.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 98ddde293..1add92d1f 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -118,7 +118,7 @@ BaseCPU::BaseCPU(Params *p, bool is_checker)
: MemObject(p), instCnt(0), _cpuId(p->cpu_id),
_instMasterId(p->system->getMasterId(name() + ".inst")),
_dataMasterId(p->system->getMasterId(name() + ".data")),
- interrupts(p->interrupts),
+ interrupts(p->interrupts), profileEvent(NULL),
numThreads(p->numThreads), system(p->system)
{
// if Python did not provide a valid ID, do it here
@@ -225,7 +225,6 @@ BaseCPU::BaseCPU(Params *p, bool is_checker)
}
if (FullSystem) {
- profileEvent = NULL;
if (params()->profile)
profileEvent = new ProfileEvent(this, params()->profile);
}