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
18 */
19#ifndef CMA_STACK
20#define CMA_STACK
21
22/*
23 *  INCLUDE FILES
24 */
25
26#include <cma_tcb_defs.h>
27#include <cma.h>
28#include <cma_attr.h>
29#include <cma_queue.h>
30#include <cma_stack_int.h>
31
32/*
33 * CONSTANTS AND MACROS
34 */
35
36#if _CMA_UNIPROCESSOR_
37# define cma__get_self_tcb()	(cma__g_current_thread)
38#endif
39
40/*
41 * Round the given value (a) upto cma__g_chunk_size
42 */
43#define cma__roundup_chunksize(a)   (cma__roundup(a,cma__g_chunk_size))
44
45/*
46 * TYPEDEFS
47 */
48
49/*
50 *  GLOBAL DATA
51 */
52
53extern cma__t_list	cma__g_stack_clusters;
54extern cma__t_int_tcb	*cma__g_current_thread;
55extern cma_t_integer	cma__g_chunk_size;
56
57/*
58 * INTERNAL INTERFACES
59 */
60
61extern void cma__assign_stack  (cma__t_int_stack *,cma__t_int_tcb *);
62
63extern void cma__free_stack  (cma__t_int_stack *);
64
65extern void cma__free_stack_list  (cma__t_queue *);
66
67#if !_CMA_UNIPROCESSOR_
68extern cma__t_int_tcb * cma__get_self_tcb  (void);
69#endif
70
71extern cma__t_int_tcb * cma__get_sp_tcb  (cma_t_address);
72
73extern cma__t_int_stack * cma__get_stack  (cma__t_int_attr *);
74
75extern void cma__init_stack  (void);
76
77extern void cma__reinit_stack  (cma_t_integer);
78
79#if _CMA_PROTECT_MEMORY_
80extern void cma__remap_stack_holes  (void);
81#endif
82
83#endif
84