113403Sgabeblack@google.com/* 213403Sgabeblack@google.com * Copyright 2018 Google, Inc. 313403Sgabeblack@google.com * 413403Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 513403Sgabeblack@google.com * modification, are permitted provided that the following conditions are 613403Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 713403Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 813403Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 913403Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1013403Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1113403Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1213403Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1313403Sgabeblack@google.com * this software without specific prior written permission. 1413403Sgabeblack@google.com * 1513403Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1613403Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1713403Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1813403Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1913403Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2013403Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2113403Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2213403Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2313403Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2413403Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2513403Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2613403Sgabeblack@google.com * 2713403Sgabeblack@google.com * Authors: Gabe Black 2813403Sgabeblack@google.com */ 2913403Sgabeblack@google.com 3013403Sgabeblack@google.com#ifndef __SYSTEMC_CORE_SC_MAIN_FIBER_HH__ 3113403Sgabeblack@google.com#define __SYSTEMC_CORE_SC_MAIN_FIBER_HH__ 3213403Sgabeblack@google.com 3313403Sgabeblack@google.com#include "base/fiber.hh" 3413403Sgabeblack@google.com#include "base/logging.hh" 3513403Sgabeblack@google.com 3613403Sgabeblack@google.comnamespace sc_gem5 3713403Sgabeblack@google.com{ 3813403Sgabeblack@google.com 3913403Sgabeblack@google.comclass ScMainFiber : public Fiber 4013403Sgabeblack@google.com{ 4113403Sgabeblack@google.com private: 4213403Sgabeblack@google.com int _argc = 0; 4313403Sgabeblack@google.com char **_argv = NULL; 4413403Sgabeblack@google.com std::string _resultStr; 4513403Sgabeblack@google.com int _resultInt = 1; 4613403Sgabeblack@google.com 4713403Sgabeblack@google.com bool _called = false; 4813403Sgabeblack@google.com 4913403Sgabeblack@google.com public: 5013436Sgabeblack@google.com ScMainFiber() : Fiber(8 * 1024 * 1024) {} 5113436Sgabeblack@google.com 5213403Sgabeblack@google.com int argc() { return _argc; } 5313403Sgabeblack@google.com const char *const *argv() { return _argv; } 5413403Sgabeblack@google.com std::string resultStr() { return _resultStr; } 5513403Sgabeblack@google.com int resultInt() { return _resultInt; } 5613403Sgabeblack@google.com bool called() { return _called; } 5713403Sgabeblack@google.com 5813403Sgabeblack@google.com void 5913403Sgabeblack@google.com setArgs(int new_argc, char **new_argv) 6013403Sgabeblack@google.com { 6113403Sgabeblack@google.com _argc = new_argc; 6213403Sgabeblack@google.com _argv = new_argv; 6313403Sgabeblack@google.com } 6413403Sgabeblack@google.com 6513403Sgabeblack@google.com void main() override; 6613403Sgabeblack@google.com}; 6713403Sgabeblack@google.com 6813403Sgabeblack@google.comextern ScMainFiber scMainFiber; 6913403Sgabeblack@google.com 7013403Sgabeblack@google.com} // namespace sc_gem5 7113403Sgabeblack@google.com 7213403Sgabeblack@google.com#endif // __SYSTEMC_CORE_SC_MAIN_FIBER_HH__ 73