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 (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include "prb_internals.h"
37 * Memory that prex uses to store combinations in target process
40 #define INITMEMSZ 2048
42 static char initial_memory
[INITMEMSZ
];
43 static tnf_memseg_t initial_memseg
= {
45 initial_memory
+ INITMEMSZ
,
50 tnf_memseg_t
* __tnf_probe_memseg_p
= &initial_memseg
;
54 * __tnf_probe_alloc() - allocates memory from the global pool
58 __tnf_probe_alloc(size_t size
)
60 tnf_memseg_t
* memseg_p
= __tnf_probe_memseg_p
;
65 mutex_lock(&memseg_p
->i_lock
);
67 memseg_p
->i_reqsz
= size
;
69 if ((memseg_p
->min_p
+ size
) <= memseg_p
->max_p
) {
70 ptr
= memseg_p
->min_p
;
71 memseg_p
->min_p
+= size
;
74 memseg_p
->i_reqsz
= 0;
76 mutex_unlock(&memseg_p
->i_lock
);
80 } /* end __tnf_probe_alloc */