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