gem5 v24.0.0.0
Loading...
Searching...
No Matches
globals.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2002-2005 The Regents of The University of Michigan
15 * Copyright (c) 2013 Advanced Micro Devices, Inc.
16 * Copyright (c) 2013 Mark D. Hill and David A. Wood
17 * All rights reserved.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions are
21 * met: redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer;
23 * redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution;
26 * neither the name of the copyright holders nor the names of its
27 * contributors may be used to endorse or promote products derived from
28 * this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 */
42
43#include "sim/globals.hh"
44
45#include <set>
46#include <string>
47
48#include "base/logging.hh"
49#include "sim/cur_tick.hh"
50
51namespace gem5
52{
53
56extern std::set<std::string> version_tags;
57
58void
64
65void
67{
68 paramIn(cp, "curTick", unserializedCurTick);
69
70 const std::string divider =
71 "**********************************************************\n";
72 const std::string &section(Serializable::currentSection());
73 std::string str;
74 if (!cp.find(section, "version_tags", str)) {
75 warn(divider);
76 warn("!!!! Checkpoint uses an old versioning scheme. !!!!\n");
77 warn("Run the checkpoint upgrader (util/cpt_upgrader.py) on your "
78 "checkpoint\n");
79 warn(divider);
80 return;
81 }
82
83 std::set<std::string> cpt_tags;
84 arrayParamIn(cp, "version_tags", cpt_tags); // UNSERIALIZE_CONTAINER
85
86 bool err = false;
87 for (const auto& t : version_tags) {
88 if (cpt_tags.find(t) == cpt_tags.end()) {
89 // checkpoint is missing tag that this binary has
90 if (!err) {
91 warn(divider);
92 warn(
93 "!!! Checkpoint is missing the following version tags:\n");
94 err = true;
95 }
96 warn(" %s\n", t);
97 }
98 }
99 if (err) {
100 warn("You might experience some issues when restoring and should run "
101 "the checkpoint upgrader (util/cpt_upgrader.py) on your "
102 "checkpoint\n");
103 warn(divider);
104 }
105
106 err = false;
107 for (const auto& t : cpt_tags) {
108 if (version_tags.find(t) == version_tags.end()) {
109 // gem5 binary is missing tag that this checkpoint has
110 if (!err) {
111 warn(divider);
112 warn("!!!! gem5 is missing the following version tags:\n");
113 err = true;
114 }
115 warn(" %s\n", t);
116 }
117 }
118 if (err) {
119 warn("Running a checkpoint with incompatible version tags is not "
120 "supported. While it might work, you may experience incorrect "
121 "behavior or crashes.\n");
122 warn(divider);
123 }
124}
125
126} // namespace gem5
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition globals.cc:59
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition globals.cc:66
Tick unserializedCurTick
Definition globals.hh:63
bool find(const std::string &section, const std::string &entry, std::string &value)
Definition serialize.cc:196
static const std::string & currentSection()
Gets the fully-qualified name of the active section.
Definition serialize.cc:130
#define SERIALIZE_CONTAINER(member)
Definition serialize.hh:626
#define warn(...)
Definition logging.hh:256
Bitfield< 5 > t
Definition misc_types.hh:71
Bitfield< 6 > err
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::set< std::string > version_tags
The version tags for this build of the simulator, to be stored in the Globals section during serializ...
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
std::ostream CheckpointOut
Definition serialize.hh:66
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Definition types.cc:40
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
Definition types.cc:72
void arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf< T > &param)
Definition circlebuf.hh:257

Generated on Tue Jun 18 2024 16:24:06 for gem5 by doxygen 1.11.0