1 /* Kernel-side additional module for the VxWorks threading support
2 logic for GCC. Written 2002 by Zack Weinberg.
4 This file is distributed with GCC, but it is not part of GCC.
5 The contents of this file are in the public domain. */
7 /* If you are using the Tornado IDE, copy this file to
8 $WIND_BASE/target/config/comps/src/gthread_supp.c. Then create a
9 file named 10comp_gthread_supp.cdf in target/config/comps/vxWorks
10 with the following contents:
12 Component INCLUDE_GCC_GTHREAD {
13 NAME GCC 3.x gthread support (required by C++)
14 CONFIGLETTES gthread_supp.c
15 REQUIRES INCLUDE_CPLUS
16 INCLUDE_WHEN INCLUDE_CPLUS
20 If you are using command line builds, instead copy this file to
21 $WIND_BASE/target/src/config/gthread_supp.c, and add the following
22 block to target/src/config/usrExtra.c:
25 #include "../../src/config/gthread_supp.c"
28 You should now be able to rebuild your application using GCC 3.x. */
33 /* This file provides these routines: */
34 extern void *__gthread_get_tsd_data (WIND_TCB
*tcb
);
35 extern void __gthread_set_tsd_data (WIND_TCB
*tcb
, void *data
);
37 extern void __gthread_enter_tsd_dtor_context (WIND_TCB
*tcb
);
38 extern void __gthread_leave_tsd_dtor_context (WIND_TCB
*tcb
);
40 /* Set and retrieve the TSD data block for the task TCB.
42 Possible choices for TSD_SLOT are:
49 (these are all fields of the TCB structure; all have type 'int').
51 If you find that the slot chosen by default is already used for
52 something else, simply change the #define below and recompile this
53 file. No other file should reference TSD_SLOT directly. */
55 /* WARNING: This code is not 64-bit clean (it assumes that a pointer
56 can be held in an 'int' without truncation). As much of the rest
57 of VxWorks also makes this assumption, we can't really avoid it. */
59 #define TSD_SLOT reserved1
62 __gthread_get_tsd_data (WIND_TCB
*tcb
)
64 return (void *) (tcb
->TSD_SLOT
);
68 __gthread_set_tsd_data (WIND_TCB
*tcb
, void *data
)
70 tcb
->TSD_SLOT
= (int) data
;
73 /* Enter and leave "TSD destructor context". This is defined as a
74 state in which it is safe to call free() from a task delete hook
75 on a memory block allocated by the task being deleted.
76 For VxWorks 5.x, nothing needs to be done. */
79 #define UNUSED __attribute__((unused))
85 __gthread_enter_tsd_dtor_context (WIND_TCB
*tcb UNUSED
)
90 __gthread_leave_tsd_dtor_context (WIND_TCB
*tcb UNUSED
)