gem5  v21.1.0.2
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__
sc_gem5::ScMainFiber::resultInt
int resultInt()
Definition: sc_main_fiber.hh:53
sc_gem5::ScMainFiber::_resultInt
int _resultInt
Definition: sc_main_fiber.hh:43
sc_gem5::ScMainFiber::argc
int argc()
Definition: sc_main_fiber.hh:50
sc_gem5::ScMainFiber::_called
bool _called
Definition: sc_main_fiber.hh:45
sc_gem5::ScMainFiber::ScMainFiber
ScMainFiber()
Definition: sc_main_fiber.hh:48
sc_gem5::ScMainFiber::called
bool called()
Definition: sc_main_fiber.hh:54
sc_gem5::ScMainFiber::resultStr
std::string resultStr()
Definition: sc_main_fiber.hh:52
sc_gem5::ScMainFiber::setArgs
void setArgs(int new_argc, char **new_argv)
Definition: sc_main_fiber.hh:57
gem5::Fiber
This class represents a fiber, which is a light weight sort of thread which is cooperatively schedule...
Definition: fiber.hh:71
sc_gem5::ScMainFiber::argv
const char *const * argv()
Definition: sc_main_fiber.hh:51
sc_gem5::ScMainFiber::main
void main() override
This method is called when this fiber is first run.
Definition: sc_main_fiber.cc:48
sc_gem5::scMainFiber
ScMainFiber scMainFiber
Definition: sc_main_fiber.cc:81
sc_gem5::ScMainFiber::_argc
int _argc
Definition: sc_main_fiber.hh:40
sc_gem5::ScMainFiber::_argv
char ** _argv
Definition: sc_main_fiber.hh:41
logging.hh
gem5::Fiber::Fiber
Fiber(size_t stack_size=DefaultStackSize)
Definition: fiber.cc:85
sc_gem5
Definition: sc_clock.cc:41
sc_gem5::ScMainFiber::_resultStr
std::string _resultStr
Definition: sc_main_fiber.hh:42
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
fiber.hh
sc_gem5::ScMainFiber
Definition: sc_main_fiber.hh:37

Generated on Tue Sep 21 2021 12:25:50 for gem5 by doxygen 1.8.17