SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
process_stack_handler.h
Go to the documentation of this file.
1/*
2 © 2012 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_PROCESS_STACK_HANDLER_H
15#define SIMICS_SYSTEMC_PROCESS_STACK_HANDLER_H
16
19
20#include <systemc>
21
22namespace simics {
23namespace systemc {
24
27 public:
29 // The process stack is used to guard re-entry to make sure we exit
30 // SystemC to Simics on the same thread we entered on. But we only need
31 // to grow the stack if we are leaving on a thread, since METHOD and
32 // NO_PROC will trigger an error on re-entry if used for normal
33 // b_transport. See simics/systemc/simics2tlm/gasket.cc for details.
34 if (sc_core::sc_get_status() == sc_core::SC_RUNNING) {
35 sc_core::sc_curr_proc_kind kind =
36 sc_core::sc_get_current_process_handle().proc_kind();
37 if (kind == sc_core::SC_THREAD_PROC_
38 || kind == sc_core::SC_CTHREAD_PROC_) {
39 pstack_ = internal->process_stack();
40 pstack_->push();
41 }
42 }
43 }
47 if (pstack_) {
48 pstack_->pop();
49 }
50 }
51
52 private:
53 ProcessStackInterface *pstack_ {nullptr};
54};
55
56} // namespace systemc
57} // namespace simics
58
59#endif
Definition: internal_interface.h:23
virtual ProcessStackInterface * process_stack()=0
Definition: process_stack_handler.h:26
virtual ~ProcessStackHandler()
Definition: process_stack_handler.h:46
ProcessStackHandler(InternalInterface *internal)
Definition: process_stack_handler.h:28
ProcessStackHandler & operator=(const ProcessStackHandler &)=delete
ProcessStackHandler(const ProcessStackHandler &)=delete
The process stack helps maintain a LIFO order of function calls that cross the SystemC/Simics border,...
Definition: process_stack_interface.h:25
Definition: adapter.h:79