OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [contrib/] [gthr_supp_vxw_5x.c] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 265 jeremybenn
/* Kernel-side additional module for the VxWorks threading support
2
   logic for GCC.  Written 2002 by Zack Weinberg.
3
 
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.  */
6
 
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:
11
 
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
17
      _FOLDER             FOLDER_CPLUS
18
   }
19
 
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:
23
 
24
   #ifdef INCLUDE_CPLUS
25
   #include "../../src/config/gthread_supp.c"
26
   #endif
27
 
28
   You should now be able to rebuild your application using GCC 3.x.  */
29
 
30
#include <vxWorks.h>
31
#include <taskLib.h>
32
 
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);
36
 
37
extern void __gthread_enter_tsd_dtor_context (WIND_TCB *tcb);
38
extern void __gthread_leave_tsd_dtor_context (WIND_TCB *tcb);
39
 
40
/* Set and retrieve the TSD data block for the task TCB.
41
 
42
   Possible choices for TSD_SLOT are:
43
     reserved1
44
     reserved2
45
     spare1
46
     spare2
47
     spare3
48
     spare4
49
   (these are all fields of the TCB structure; all have type 'int').
50
 
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.  */
54
 
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.  */
58
 
59
#define TSD_SLOT reserved1
60
 
61
void *
62
__gthread_get_tsd_data (WIND_TCB *tcb)
63
{
64
  return (void *) (tcb->TSD_SLOT);
65
}
66
 
67
void
68
__gthread_set_tsd_data (WIND_TCB *tcb, void *data)
69
{
70
  tcb->TSD_SLOT = (int) data;
71
}
72
 
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.  */
77
 
78
#if __GNUC__ >= 2
79
#define UNUSED __attribute__((unused))
80
#else
81
#define UNUSED
82
#endif
83
 
84
void
85
__gthread_enter_tsd_dtor_context (WIND_TCB *tcb UNUSED)
86
{
87
}
88
 
89
void
90
__gthread_leave_tsd_dtor_context (WIND_TCB *tcb UNUSED)
91
{
92
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.