4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
35 /* To use stack as temporary workspace across
36 * possible storage allocation (eg name lookup)
37 * a) get ptr from `relstak'
38 * b) can now use `pushstak'
39 * c) then reset with `setstak'
40 * d) `absstak' gives real address if needed
42 #define relstak() (staktop-stakbot)
43 #define absstak(x) (stakbot+Rcheat(x))
44 #define setstak(x) (staktop=absstak(x))
45 #define pushstak(c) (*staktop++=(c))
46 #define zerostak() (*staktop=0)
48 /* Used to address an item left on the top of
49 * the stack (very temporary)
51 #define curstak() (staktop)
53 /* `usestak' before `pushstak' then `fixstak'
54 * These routines are safe against heap
57 #define usestak() {locstak();}
59 /* for local use only since it hands
60 * out a real address for the stack top
62 extern unsigned char *locstak();
64 /* Will allocate the item being used and return its
67 #define fixstak() endstak(staktop)
69 /* For use after `locstak' to hand back
70 * new stack top and then allocate item
72 extern unsigned char *endstak();
74 /* Copy a string onto the stack and
77 extern unsigned char *cpystak();
79 /* Copy a string onto the stack, checking for stack overflow
80 * as the copy is done. Same calling sequence as "movstr".
82 extern unsigned char *movstrstak();
84 /* Move bytes onto the stack, checking for stack overflow
85 * as the copy is done. Same calling sequence as the C
86 * library routine "memcpy".
88 extern unsigned char *memcpystak();
90 /* Allocate given ammount of stack space */
91 extern unsigned char *getstak();
93 /* Grow the data segment to include a given location */
94 extern void growstak();
96 /* A chain of ptrs of stack blocks that
97 * have become covered by heap allocation.
98 * `tdystak' will return them to the heap.
100 extern struct blk
*stakbsy
;
102 /* Base of the entire stack */
103 extern unsigned char *stakbas
;
105 /* Top of entire stack */
106 extern unsigned char *brkend
;
108 /* Base of current item */
109 extern unsigned char *stakbot
;
111 /* Top of current item */
112 extern unsigned char *staktop
;
114 /* Used with tdystak */
115 extern unsigned char *savstak();