gem5  v22.1.0.0
sc_main_fiber.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __SYSTEMC_CORE_SC_MAIN_FIBER_HH__
29 #define __SYSTEMC_CORE_SC_MAIN_FIBER_HH__
30 
31 #include "base/fiber.hh"
32 #include "base/logging.hh"
33 
34 namespace sc_gem5
35 {
36 
37 class ScMainFiber : public gem5::Fiber
38 {
39  private:
40  int _argc = 0;
41  char **_argv = NULL;
42  std::string _resultStr;
43  int _resultInt = 1;
44 
45  bool _called = false;
46 
47  public:
48  ScMainFiber() : gem5::Fiber(8 * 1024 * 1024) {}
49 
50  int argc() { return _argc; }
51  const char *const *argv() { return _argv; }
52  std::string resultStr() { return _resultStr; }
53  int resultInt() { return _resultInt; }
54  bool called() { return _called; }
55 
56  void
57  setArgs(int new_argc, char **new_argv)
58  {
59  _argc = new_argc;
60  _argv = new_argv;
61  }
62 
63  void main() override;
64 };
65 
66 extern ScMainFiber scMainFiber;
67 
68 } // namespace sc_gem5
69 
70 #endif // __SYSTEMC_CORE_SC_MAIN_FIBER_HH__
This class represents a fiber, which is a light weight sort of thread which is cooperatively schedule...
Definition: fiber.hh:72
void setArgs(int new_argc, char **new_argv)
void main() override
This method is called when this fiber is first run.
std::string _resultStr
std::string resultStr()
const char *const * argv()
Fiber(size_t stack_size=DefaultStackSize)
Definition: fiber.cc:85
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
ScMainFiber scMainFiber

Generated on Wed Dec 21 2022 10:22:40 for gem5 by doxygen 1.9.1