Skip to content
/ gem5 Public
forked from gem5/gem5

Commit

Permalink
util: fix the cxx_config example
Browse files Browse the repository at this point in the history
This change replaces and removes the out-of-date APIs to fix the build
error, and add fixClockFrequency() call to fix the runtime error. We
also need the TRACING_ON macro and C++17 to build because of the
header changes.

Tested with X86 and tests/test-progs/hello. Checkpoint restore is not
tested yet.

Change-Id: Id92bb7954defea15b026eba3229a453b688929be
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58989
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
  • Loading branch information
mytbk committed Apr 20, 2022
1 parent 74f3f19 commit cbd401e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions util/cxx_config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
ARCH = ARM
VARIANT = opt

CXXFLAGS = -I../../build/$(ARCH) -L../../build/$(ARCH)
CXXFLAGS += -std=c++0x
CXXFLAGS = -I../../build/$(ARCH) -L../../build/$(ARCH) -DTRACING_ON=1
CXXFLAGS += -std=c++17
LIBS = -lgem5_$(VARIANT)

## You may also need protobuf flags
Expand Down
11 changes: 5 additions & 6 deletions util/cxx_config/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ main(int argc, char **argv)
if (argc == 1)
usage(prog_name);

cxxConfigInit();

initSignals();

setClockFrequency(1000000000000);
fixClockFrequency();
curEventQueue(getEventQueue(0));

statistics::initSimStats();
Expand Down Expand Up @@ -248,7 +247,7 @@ main(int argc, char **argv)
/* FIXME, this should really be serialising just for
* config_manager rather than using serializeAll's ugly
* SimObject static object list */
Serializable::serializeAll(checkpoint_dir);
SimObject::serializeAll(checkpoint_dir);

std::cerr << "Completed checkpoint\n";

Expand All @@ -258,11 +257,11 @@ main(int argc, char **argv)
if (checkpoint_restore) {
std::cerr << "Restoring checkpoint\n";

CheckpointIn *checkpoint = new CheckpointIn(checkpoint_dir,
config_manager->getSimObjectResolver());
SimObject::setSimObjectResolver(
&config_manager->getSimObjectResolver());
CheckpointIn *checkpoint = new CheckpointIn(checkpoint_dir);

DrainManager::instance().preCheckpointRestore();
Serializable::unserializeGlobals(*checkpoint);
config_manager->loadState(*checkpoint);
config_manager->startup();

Expand Down

0 comments on commit cbd401e

Please sign in to comment.