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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [osf-share/] [cma_tcb_defs.h] - Blame information for rev 321

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

Line No. Rev Author Line
1 24 jeremybenn
/*
2
 * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC.
3
 * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY
4
 * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION
5
 * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems
6
 * To anyone who acknowledges that this file is provided "AS IS" without
7
 * any express or implied warranty: permission to use, copy, modify, and
8
 * distribute this file for any purpose is hereby granted without fee,
9
 * provided that the above copyright notices and this notice appears in
10
 * all source code copies, and that none of the names listed above be used
11
 * in advertising or publicity pertaining to distribution of the software
12
 * without specific, written prior permission.  None of these organizations
13
 * makes any representations about the suitability of this software for
14
 * any purpose.
15
 */
16
/*
17
 *      TCB-related type definitions.
18
 */
19
 
20
#ifndef CMA_TCB_DEFS
21
#define CMA_TCB_DEFS
22
 
23
/*
24
 *  INCLUDE FILES
25
 */
26
# if !_CMA_THREAD_SYNC_IO_
27
#  include <cma_thread_io.h>
28
# endif
29
#include <cma.h>
30
#include <cma_debug_client.h>
31
#include <cma_attr.h>
32
#include <cma_defs.h>
33
#include <cma_handle.h>
34
#include <cma_queue.h>
35
#if _CMA_OS_ == _CMA__UNIX
36
# if defined(SNI_DCOSX)
37
#   include <sys/ucontext.h>
38
# endif
39
# include <signal.h>
40
#endif
41
#include <cma_sched.h>
42
 
43
/*
44
 * CONSTANTS AND MACROS
45
 */
46
 
47
#if _CMA_PLATFORM_ == _CMA__IBMR2_UNIX
48
# define cma__c_ibmr2_ctx_stack_size    2048
49
# define cma__c_ibmr2_ctx_stack_top     (cma__c_ibmr2_ctx_stack_size - 1)
50
#endif
51
 
52
/*
53
 * TYPEDEFS
54
 */
55
 
56
#ifndef __STDC__
57
# if _CMA_HARDWARE_ != _CMA__HPPA
58
struct CMA__T_SEMAPHORE;
59
# endif
60
struct CMA__T_INT_CV;
61
struct CMA__T_INT_MUTEX;
62
struct CMA__T_INT_TCB;
63
#endif
64
 
65
typedef cma_t_address           *cma__t_context_list;
66
 
67
typedef struct CMA__T_TCB_PAD {
68
    /*
69
     * Adjust to align the tcb prolog at byte 32.
70
     * 12 bytes are required as object header is currently
71
     * 20 bytes long.
72
     */
73
    cma_t_integer       pad1;           /* pad bytes */
74
    cma_t_integer       pad2;           /* pad bytes */
75
    cma_t_integer       pad3;           /* pad bytes */
76
    } cma__t_tcb_pad;
77
 
78
#if (_CMA_OS_ == _CMA__UNIX) && !_CMA_THREAD_SYNC_IO_
79
typedef struct CMA__T_TCB_SELECT {
80
    cma__t_queue        queue;
81
#if (_CMA_UNIX_TYPE !=  _CMA__SVR4)
82
        cma__t_file_mask    *rfds;
83
        cma__t_file_mask    *wfds;
84
        cma__t_file_mask    *efds;
85
#else
86
        cma__t_poll_info        poll_info;
87
#endif /* (_CMA_UNIX_TYPE !=  _CMA__SVR4) */
88
    cma_t_integer       nfound;
89
    } cma__t_tcb_select;
90
#endif
91
 
92
typedef struct CMA__T_TCB_TIME {
93
    cma__t_queue        queue;          /* must be first entry! */
94
    cma_t_integer       mode;
95
    struct CMA__T_SEMAPHORE *semaphore; /* used for timed semaphores */
96
    cma_t_date_time     wakeup_time;
97
    cma_t_integer       quanta_remaining;
98
    } cma__t_tcb_time;
99
 
100
typedef enum CMA__T_DEBEVT {
101
        cma__c_debevt_activating = 1,   /* First transition to running */
102
        cma__c_debevt_running = 2,      /* Any transition to running */
103
        cma__c_debevt_preempting = 3,   /* Preemted (replaced) another thread */
104
        cma__c_debevt_blocking = 4,     /* Any transition to blocked */
105
        cma__c_debevt_terminating = 5,  /* Final state transition */
106
        cma__c_debevt_term_alert = 6,   /* Terminated due to alert/cancel */
107
        cma__c_debevt_term_exc = 7,     /* Terminated due to exception */
108
        cma__c_debevt_exc_handled = 8   /* Exception is being handled */
109
        } cma__t_debevt;
110
 
111
#define cma__c_debevt__first ((cma_t_integer)cma__c_debevt_activating)
112
#define cma__c_debevt__last  ((cma_t_integer)cma__c_debevt_exc_handled)
113
#define cma__c_debevt__dim (cma__c_debevt__last + 1)
114
 
115
/*
116
 * Type defining thread substate, which is used by the debugger.
117
 * If the state is blocked, substate indicates WHY the thread is blocked.
118
 */
119
typedef enum CMA__T_SUBSTATE {
120
    cma__c_substa_normal = 0,
121
    cma__c_substa_mutex = 1,
122
    cma__c_substa_cv = 2,
123
    cma__c_substa_timed_cv = 3,
124
    cma__c_substa_term_alt = 4,
125
    cma__c_substa_term_exc = 5,
126
    cma__c_substa_delay =6,
127
    cma__c_substa_not_yet_run = 7
128
    } cma__t_substate;
129
#define cma__c_substa__first ((cma_t_integer)cma__c_substa_normal)
130
#define cma__c_substa__last  ((cma_t_integer)cma__c_substa_not_yet_run)
131
#define cma__c_substa__dim (cma__c_substa__last + 1)
132
 
133
 
134
/*
135
 * Per-thread state for the debugger
136
 */
137
typedef struct CMA__T_TCB_DEBUG {
138
    cma_t_boolean       on_hold;        /* Thread was put on hold by debugger */
139
    cma_t_boolean       activated;      /* Activation event was reported */
140
    cma_t_boolean       did_preempt;    /* Thread preempted prior one */
141
    cma_t_address       start_pc;       /* Start routine address */
142
    cma_t_address       object_addr;    /* Addr of thread object */
143
    cma__t_substate     substate;       /* Reason blocked, terminated, etc.*/
144
    cma_t_boolean       notify_debugger;/* Notify debugger thread is running */
145
    cma_t_address       SPARE2;         /* SPARE */
146
    cma_t_address       SPARE3;         /* SPARE */
147
    struct CMA__T_INT_TCB
148
                        *preempted_tcb; /* TCB of thread that got preempted */
149
    cma_t_boolean       flags[cma__c_debevt__dim];
150
                                        /* Events enabled for this thread */
151
    } cma__t_tcb_debug;
152
 
153
typedef struct CMA__T_TCB_SCHED {
154
    cma_t_integer       adj_time;       /* Abs. time in ticks of last prio adj */
155
    cma_t_integer       tot_time;       /* Weighted ave in ticks (scaled) */
156
    cma_t_integer       time_stamp;     /* Abs. time in ticks of last update */
157
    cma_t_integer       cpu_time;       /* Weighted average in ticks */
158
    cma_t_integer       cpu_ticks;      /* # of ticks while comp. (scaled) */
159
    cma_t_integer       q_num;          /* Number of last ready queue on */
160
    cma_t_priority      priority;       /* Thread priority */
161
    cma_t_sched_policy  policy;         /* Scheduling policy of thread */
162
    cma_t_boolean       rtb;            /* "Run 'Till Block" scheduling */
163
    cma_t_boolean       spp;            /* "Strict Priority Preemption" sched */
164
    cma_t_boolean       fixed_prio;     /* Fixed priority */
165
    cma__t_sched_class  class;          /* Scheduling class */
166
    struct CMA__T_VP    *processor;     /* Current processor (if running) */
167
    } cma__t_tcb_sched;
168
 
169
typedef struct CMA__T_INT_ALERT {
170
    cma_t_boolean       pending : 1;    /* alert_pending bit */
171
    cma_t_boolean       g_enable : 1;   /* general delivery state */
172
    cma_t_boolean       a_enable : 1;   /* asynchronous delivery state */
173
    cma_t_integer       spare : 29;     /* Pad to longword */
174
    cma_t_natural       count;          /* Alert scope nesting count */
175
    } cma__t_int_alert;
176
 
177
typedef enum CMA__T_STATE {
178
    cma__c_state_running = 0,            /* For consistency with initial TCB */
179
    cma__c_state_ready  = 1,
180
    cma__c_state_blocked = 2,
181
    cma__c_state_terminated = 3
182
    } cma__t_state;
183
#define cma__c_state__first ((cma_t_integer)cma__c_state_running)
184
#define cma__c_state__last  ((cma_t_integer)cma__c_state_terminated)
185
#define cma__c_state__dim (cma__c_state__last + 1)
186
 
187
typedef enum CMA__T_THKIND {
188
    cma__c_thkind_initial = 0,           /* Initial thread */
189
    cma__c_thkind_normal = 1,           /* Normal thread */
190
    cma__c_thkind_null  = 2             /* A null thread */
191
    } cma__t_thkind;
192
#define cma__c_thkind__first ((cma_t_integer)cma__c_thkind_initial)
193
#define cma__c_thkind__last  ((cma_t_integer)cma__c_thkind_null)
194
#define cma__c_thkind__dim (cma__c_thkind__last + 1)
195
 
196
typedef enum CMA__T_SYSCALL_STATE {
197
        cma__c_syscall_ok = 1,                      /* syscall was not interrupted */
198
        cma__c_syscall_intintrpt = 1,       /* syscall was interrupted by VTALRM */
199
        cma__c_syscall_extintrpt = 2        /* syscall was interrupted by external signal */
200
        } cma__t_syscall_state;
201
 
202
 
203
typedef struct CMA__T_INT_TCB {
204
    /*
205
     * Fixed part of TCB.
206
     *   Modifications to the following three fields must be coordinated.
207
     *   The object header must always be first, and the prolog must always
208
     *   remain at the same offset (32) for all time. Thus the object header
209
     *   must never grow beyond a maximum of 32 bytes.
210
     */
211
    cma__t_object       header;         /* Common object header */
212
    cma__t_tcb_pad      pad1;           /* Pad required to align prolog */
213
    cma_t_tcb_prolog    prolog;         /* Standard prolog for tasks, threads */
214
 
215
    /*
216
     * Floating part of TCB (fields here on are free to be moved and resized).
217
     */
218
    cma__t_queue        threads;        /* List of all known threads */
219
    cma__t_int_attr     *attributes;    /* Backpointer to attr obj */
220
    cma__t_state        state;          /* Current state of thread */
221
    cma__t_thkind       kind;           /* Which kind of thread */
222
    struct CMA__T_INT_MUTEX
223
                        *mutex;         /* Mutex to control TCB access */
224
    struct CMA__T_INT_CV
225
                        *term_cv;       /* CV for join */
226
    struct CMA__T_INT_MUTEX
227
                        *tswait_mutex;  /* Mutex for thread-synchronous waits */
228
    struct CMA__T_INT_CV
229
                        *tswait_cv;     /* CV for thread-synchronous waits */
230
    cma_t_start_routine start_code;     /* Address of start routine */
231
    cma_t_address       start_arg;      /* Argument to pass to start_code */
232
    cma__t_queue        stack;          /* Queue header for stack descr. */
233
    cma_t_natural       context_count;  /* Size of context array */
234
    cma__t_context_list contexts;       /* Context value array pointer */
235
    cma_t_exit_status   exit_status;    /* Exit status of thread */
236
    cma_t_address       return_value;   /* Thread's return value */
237
    cma__t_async_ctx    async_ctx;      /* Asynchronous context switch info */
238
    cma__t_static_ctx   static_ctx;     /* Static context switch information */
239
    cma_t_integer       event_status;   /* Status of semaphore operation */
240
    cma__t_tcb_time     timer;          /* Time info for dispatcher */
241
    cma__t_tcb_sched    sched;          /* Scheduler info */
242
    cma__t_tcb_debug    debug;          /* Debugger info */
243
#if _CMA_OS_ == _CMA__UNIX
244
# if !_CMA_THREAD_SYNC_IO_
245
    cma__t_tcb_select   select;         /* Select info for timed selects */
246
# endif
247
    struct sigaction    sigaction_data[NSIG];
248
#endif
249
    cma_t_natural       syscall_state; /* set if one of the cma wrapped syscalls was interrupted. */
250
    cma_t_boolean       detached;       /* Set if already detached */
251
    cma_t_boolean       terminated;     /* Set if terminated */
252
    cma_t_integer       joiners;        /* Count of joiners, for zombie frees */
253
    cma__t_int_alert    alert;          /* Current alert state info */
254
    struct CMA__T_INT_CV
255
                        *wait_cv;       /* CV thread is currently waiting on */
256
    struct CMA__T_INT_MUTEX
257
                        *wait_mutex;    /* Mutex thread is waiting on */
258
    struct EXC_CONTEXT_T
259
                        *exc_stack;     /* Top of exception stack */
260
#if _CMA_PLATFORM_ == _CMA__IBMR2_UNIX
261
    char                ctx_stack[cma__c_ibmr2_ctx_stack_size];
262
#endif
263
    cma_t_integer       thd_errno;      /* Per-thread errno value */
264
#if _CMA_OS_ == _CMA__VMS
265
    cma_t_integer       thd_vmserrno;   /* Per-thread VMS errno value */
266
#endif
267
    } cma__t_int_tcb;
268
 
269
#endif

powered by: WebSVN 2.1.0

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