2011-01-05 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / osf-share / cma_stack_int.h
1 /*
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 * Header file for stack management (internal to cma_stack.c, but
18 * separate for convenience, and unit testing).
19 */
20 \f
21 #ifndef CMA_STACK_INT
22 #define CMA_STACK_INT
23
24 /*
25 * INCLUDE FILES
26 */
27
28 #include <cma.h>
29 #include <cma_queue.h>
30 #include <cma_list.h>
31 #include <cma_tcb_defs.h>
32
33 /*
34 * CONSTANTS AND MACROS
35 */
36
37 #define cma___c_first_free_chunk 0
38 #define cma___c_min_count 2 /* Smallest number of chunks
39 to leave */
40 #define cma___c_end (-1) /* End of free list (flag) */
41 #define cma__c_yellow_size 0
42
43 /*
44 * Cluster types
45 */
46 #define cma___c_cluster 0 /* Default cluster */
47 #define cma___c_bigstack 1 /* Looks like a cluster, but it's a stack */
48
49
50 #define cma___c_null_cluster (cma___t_cluster *)cma_c_null_ptr
51
52
53 /*
54 * TYPEDEFS
55 */
56
57 #ifndef __STDC__
58 struct CMA__T_INT_STACK;
59 #endif
60
61 typedef cma_t_natural cma___t_index; /* Type for chunk index */
62
63 typedef struct CMA___T_CLU_DESC {
64 cma__t_list list; /* Queue element for cluster list */
65 cma_t_integer type; /* Type of cluster */
66 cma_t_address stacks;
67 cma_t_address limit;
68 } cma___t_clu_desc;
69
70 typedef union CMA___T_MAP_ENTRY {
71 struct {
72 cma__t_int_tcb *tcb; /* TCB associated with stack chunk */
73 struct CMA__T_INT_STACK *stack; /* Stack desc. ass. with stack chunk */
74 } mapped;
75 struct {
76 cma___t_index size; /* Number of chunks in block */
77 cma___t_index next; /* Next free block */
78 } free;
79 } cma___t_map_entry;
80
81 /*
82 * NOTE: It is VERY IMPORTANT that both cma___t_cluster and cma___t_bigstack
83 * begin with the cma___t_clu_desc structure, as there is some code in the
84 * stack manager that relies on being able to treat both as equivalent!
85 */
86 typedef struct CMA___T_CLUSTER {
87 cma___t_clu_desc desc; /* Describe this cluster */
88 cma___t_map_entry map[cma__c_chunk_count]; /* thread map */
89 cma___t_index free; /* First free chunk index */
90 } cma___t_cluster;
91
92 /*
93 * NOTE: It is VERY IMPORTANT that both cma___t_cluster and cma___t_bigstack
94 * begin with the cma___t_clu_desc structure, as there is some code in the
95 * stack manager that relies on being able to treat both as equivalent!
96 */
97 typedef struct CMA___T_BIGSTACK {
98 cma___t_clu_desc desc; /* Describe this cluster */
99 cma__t_int_tcb *tcb; /* TCB associated with stack */
100 struct CMA__T_INT_STACK *stack; /* Stack desc. ass. with stack */
101 cma_t_natural size; /* Size of big stack */
102 cma_t_boolean in_use; /* Set if allocated */
103 } cma___t_bigstack;
104
105 #if _CMA_PROTECT_MEMORY_
106 typedef struct CMA___T_INT_HOLE {
107 cma__t_queue link; /* Link holes together */
108 cma_t_boolean protected; /* Set when pages are protected */
109 cma_t_address first; /* First protected byte */
110 cma_t_address last; /* Last protected byte */
111 } cma___t_int_hole;
112 #endif
113
114 typedef struct CMA__T_INT_STACK {
115 cma__t_object header; /* Common header (sequence,
116 type info */
117 cma__t_int_attr *attributes; /* Backpointer to attr obj */
118 cma___t_cluster *cluster; /* Stack's cluster */
119 cma_t_address stack_base; /* base address of stack */
120 cma_t_address yellow_zone; /* first address of yellow zone */
121 cma_t_address last_guard; /* last address of guard pages */
122 cma_t_natural first_chunk; /* First chunk allocated */
123 cma_t_natural chunk_count; /* Count of chunks allocated */
124 cma__t_int_tcb *tcb; /* TCB backpointer */
125 #if _CMA_PROTECT_MEMORY_
126 cma___t_int_hole hole; /* Description of hole */
127 #endif
128 } cma__t_int_stack;
129
130 /*
131 * GLOBAL DATA
132 */
133
134 /*
135 * INTERNAL INTERFACES
136 */
137
138 #endif
This page took 0.031461 seconds and 4 git commands to generate.