1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33 34 35
36
37 import xdc.runtime.Types;
38 import xdc.runtime.IHeap;
39 import xdc.runtime.Error;
40 import ti.sysbios.knl.Task;
41
42 /*!
43 * ======== ThreadLocalStorage ========
44 * Thread-local RTS data support module
45 *
46 * The ThreadLocalStorage module allows SYS/BIOS Tasks to maintain
47 * RTS data that is private to each Task. RTS data includes, among
48 * other things, the errno variable from the RTS library and the C++
49 * exception stack.
50 *
51 * This support is achieved by way of per-Task "TLS" data areas and
52 * a Task switch hook function that tracks the current Task's TLS
53 * data area on behalf of the RTS library code.
54 *
55 * Currently requires use of the --multithreaded option for the CG tools
56 * compiler.
57 */
58
59 @DirectCall
60
61 module ThreadLocalStorage
62 {
63 /*!
64 * ======== heapHandle ========
65 * Heap to use for TLS allocation. If null, uses the default Heap
66 */
67 config IHeap.Handle heapHandle = null;
68
69 /*!
70 * ======== enableTLSSupport ========
71 * Enable TI TLS support
72 */
73 config Bool enableTLSSupport = false;
74
75 /*!
76 * ======== TItlsSectMemory ========
77 * Memory section in which to place .TI.tls output data section
78 */
79 config String TItlsSectMemory = null;
80
81 /*!
82 * ======== TItls_initSectMemory ========
83 * Memory section in which to place .TI.tls_init output data section
84 */
85 config String TItls_initSectMemory = null;
86
87 internal:
88 /*!
89 * ======== createFxn ========
90 */
91 Void createFxn(Task.Handle tsk, Error.Block *eb);
92
93 /*!
94 * ======== switchFxn ========
95 */
96 Void switchFxn(Task.Handle from, Task.Handle to);
97
98 /*!
99 * ======== deleteFxn ========
100 */
101 Void deleteFxn(Task.Handle tsk);
102
103 /*!
104 * ======== registerFxn ========
105 */
106 Void registerFxn(Int id);
107
108 struct Module_State {
109 Ptr currentTP;
110 UInt contextId;
111 IHeap.Handle heapHandle;
112 };
113 }