annotate src/w32heap.c @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128

typos.
author Jeff Law <law@redhat.com>
date Wed, 10 Sep 1997 21:16:20 +0000
parents 16e69fbdbf0f
children 2595beed0362
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
1 /* Heap management routines for GNU Emacs on the Microsoft W32 API.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 Copyright (C) 1994 Free Software Foundation, Inc.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
4 This file is part of GNU Emacs.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
7 it under the terms of the GNU General Public License as published by
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
9 any later version.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
14 GNU General Public License for more details.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
16 You should have received a copy of the GNU General Public License
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12452
diff changeset
19 Boston, MA 02111-1307, USA.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
24 #include "config.h"
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
25
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include <stdlib.h>
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 #include <stdio.h>
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
29 #include "w32heap.h"
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
30 #include "lisp.h" /* for VALMASK */
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 /* This gives us the page size and the size of the allocation unit on NT. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 SYSTEM_INFO sysinfo_cache;
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
34 unsigned long syspage_mask = 0;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 /* These are defined to get Emacs to compile, but are not used. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 int edata;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 int etext;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 /* The major and minor versions of NT. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15228
diff changeset
41 int w32_major_version;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15228
diff changeset
42 int w32_minor_version;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
19708
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
44 /* Distinguish between Windows NT and Windows 95. */
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
45 int os_subtype;
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
46
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 /* Cache information describing the NT system for later use. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 void
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 cache_system_info (void)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 union
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 struct info
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 char major;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 char minor;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 short platform;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 } info;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 DWORD data;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 } version;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 /* Cache the version of the operating system. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 version.data = GetVersion ();
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15228
diff changeset
64 w32_major_version = version.info.major;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15228
diff changeset
65 w32_minor_version = version.info.minor;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
19708
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
67 if (version.info.platform & 0x8000)
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
68 os_subtype = OS_WIN95;
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
69 else
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
70 os_subtype = OS_NT;
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
71
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 /* Cache page size, allocation unit, processor type, etc. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 GetSystemInfo (&sysinfo_cache);
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
74 syspage_mask = sysinfo_cache.dwPageSize - 1;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
18506
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
77 /* Emulate getpagesize. */
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
78 int
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
79 getpagesize (void)
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
80 {
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
81 return sysinfo_cache.dwPageSize;
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
82 }
bcc706aedcea Add pragma to force zero initialized
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
83
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 /* Round ADDRESS up to be aligned with ALIGN. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 unsigned char *
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 round_to_next (unsigned char *address, unsigned long align)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 unsigned long tmp;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 tmp = (unsigned long) address;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 tmp = (tmp + align - 1) / align;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 return (unsigned char *) (tmp * align);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 /* Info for keeping track of our heap. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 unsigned char *data_region_base = NULL;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 unsigned char *data_region_end = NULL;
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
99 unsigned char *real_data_region_end = NULL;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 unsigned long data_region_size = 0;
11943
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
101 unsigned long reserved_heap_size = 0;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 /* The start of the data segment. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 unsigned char *
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 get_data_start (void)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 return data_region_base;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 /* The end of the data segment. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 unsigned char *
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 get_data_end (void)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 return data_region_end;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
11943
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
117 static char *
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
118 allocate_heap (void)
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
119 {
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
120 /* The base address for our GNU malloc heap is chosen in conjuction
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
121 with the link settings for temacs.exe which control the stack size,
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
122 the initial default process heap size and the executable image base
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
123 address. The link settings and the malloc heap base below must all
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
124 correspond; the relationship between these values depends on how NT
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
125 and Windows 95 arrange the virtual address space for a process (and on
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
126 the size of the code and data segments in temacs.exe).
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
127
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
128 The most important thing is to make base address for the executable
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
129 image high enough to leave enough room between it and the 4MB floor
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
130 of the process address space on Windows 95 for the primary thread stack,
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
131 the process default heap, and other assorted odds and ends
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
132 (eg. environment strings, private system dll memory etc) that are
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
133 allocated before temacs has a chance to grab its malloc arena. The
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
134 malloc heap base can then be set several MB higher than the
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
135 executable image base, leaving enough room for the code and data
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
136 segments.
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
137
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
138 Because some parts of Emacs can use rather a lot of stack space
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
139 (for instance, the regular expression routines can potentially
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
140 allocate several MB of stack space) we allow 8MB for the stack.
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
141
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
142 Allowing 1MB for the default process heap, and 1MB for odds and
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
143 ends, we can base the executable at 16MB and still have a generous
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
144 safety margin. At the moment, the executable has about 810KB of
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
145 code (for x86) and about 550KB of data - on RISC platforms the code
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
146 size could be roughly double, so if we allow 4MB for the executable
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
147 we will have plenty of room for expansion.
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
148
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
149 Thus we would like to set the malloc heap base to 20MB. However,
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
150 Windows 95 refuses to allocate the heap starting at this address, so we
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
151 set the base to 27MB to make it happy. Since Emacs now leaves
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
152 28 bits available for pointers, this lets us use the remainder of
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
153 the region below the 256MB line for our malloc arena - 229MB is
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
154 still a pretty decent arena to play in! */
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
155
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
156 unsigned long base = 0x01B00000; /* 27MB */
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
157 unsigned long end = 1 << VALBITS; /* 256MB */
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
158 void *ptr = NULL;
11943
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
159
15228
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
160 #if NTHEAP_PROBE_BASE /* This is never normally defined */
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
161 /* Try various addresses looking for one the kernel will let us have. */
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
162 while (!ptr && (base < end))
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
163 {
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
164 reserved_heap_size = end - base;
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
165 ptr = VirtualAlloc ((void *) base,
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
166 get_reserved_heap_size (),
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
167 MEM_RESERVE,
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
168 PAGE_NOACCESS);
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
169 base += 0x00100000; /* 1MB increment */
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
170 }
15228
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
171 #else
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
172 reserved_heap_size = end - base;
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
173 ptr = VirtualAlloc ((void *) base,
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
174 get_reserved_heap_size (),
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
175 MEM_RESERVE,
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
176 PAGE_NOACCESS);
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
177 #endif
15228
ae9888a75348 (allocate_heap): Clean up conditional.
Richard M. Stallman <rms@gnu.org>
parents: 15208
diff changeset
178
15208
01588278fceb (allocate_heap): Bump heap base up to 27MB to
Geoff Voelker <voelker@cs.washington.edu>
parents: 15143
diff changeset
179 return ptr;
11943
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
180 }
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
181
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
182
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 /* Emulate Unix sbrk. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 void *
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 sbrk (unsigned long increment)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 void *result;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 long size = (long) increment;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 /* Allocate our heap if we haven't done so already. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 if (!data_region_base)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 {
11943
ea533622fb8b (reserved_heap_size,allocate_heap): Defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11385
diff changeset
193 data_region_base = allocate_heap ();
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 if (!data_region_base)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 return NULL;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196
15143
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
197 /* Ensure that the addresses don't use the upper tag bits since
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
198 the Lisp type goes there. */
d7d0413e95e2 Include lisp.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
199 if (((unsigned long) data_region_base & ~VALMASK) != 0)
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 printf ("Error: The heap was allocated in upper memory.\n");
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 exit (1);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 data_region_end = data_region_base;
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
206 real_data_region_end = data_region_end;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 data_region_size = get_reserved_heap_size ();
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 result = data_region_end;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 /* If size is negative, shrink the heap by decommitting pages. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 if (size < 0)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 {
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
215 int new_size;
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
216 unsigned char *new_data_region_end;
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
217
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 size = -size;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 /* Sanity checks. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 if ((data_region_end - size) < data_region_base)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 return NULL;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
224 /* We can only decommit full pages, so allow for
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
225 partial deallocation [cga]. */
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
226 new_data_region_end = (data_region_end - size);
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
227 new_data_region_end = (unsigned char *)
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
228 ((long) (new_data_region_end + syspage_mask) & ~syspage_mask);
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
229 new_size = real_data_region_end - new_data_region_end;
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
230 real_data_region_end = new_data_region_end;
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
231 if (new_size > 0)
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
232 {
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
233 /* Decommit size bytes from the end of the heap. */
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
234 if (!VirtualFree (real_data_region_end, new_size, MEM_DECOMMIT))
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
235 return NULL;
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
236 }
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 data_region_end -= size;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 /* If size is positive, grow the heap by committing reserved pages. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 else if (size > 0)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 /* Sanity checks. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 if ((data_region_end + size) >
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (data_region_base + get_reserved_heap_size ()))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 return NULL;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 /* Commit more of our heap. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 if (VirtualAlloc (data_region_end, size, MEM_COMMIT,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 PAGE_READWRITE) == NULL)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 return NULL;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 data_region_end += size;
12452
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
253
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
254 /* We really only commit full pages, so record where
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
255 the real end of committed memory is [cga]. */
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
256 real_data_region_end = (unsigned char *)
bd304be0b491 Include config.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 11943
diff changeset
257 ((long) (data_region_end + syspage_mask) & ~syspage_mask);
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 return result;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 /* Recreate the heap from the data that was dumped to the executable.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 EXECUTABLE_PATH tells us where to find the executable. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 void
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 recreate_heap (char *executable_path)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 unsigned char *tmp;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 /* First reserve the upper part of our heap. (We reserve first
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 because there have been problems in the past where doing the
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 mapping first has loaded DLLs into the VA space of our heap.) */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 tmp = VirtualAlloc ((void *) get_heap_end (),
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 get_reserved_heap_size () - get_committed_heap_size (),
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 MEM_RESERVE,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 PAGE_NOACCESS);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 if (!tmp)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 exit (1);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 /* We read in the data for the .bss section from the executable
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 first and map in the heap from the executable second to prevent
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 any funny interactions between file I/O and file mapping. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 read_in_bss (executable_path);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 map_in_heap (executable_path);
19708
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
285
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
286 /* Update system version information to match current system. */
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
287 cache_system_info ();
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 }
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 /* Round the heap up to the given alignment. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 void
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 round_heap (unsigned long align)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 {
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 unsigned long needs_to_be;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 unsigned long need_to_alloc;
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 needs_to_be = (unsigned long) round_to_next (get_heap_end (), align);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 need_to_alloc = needs_to_be - (unsigned long) get_heap_end ();
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 if (need_to_alloc)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 sbrk (need_to_alloc);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 }
19708
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
303
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
304 #if (_MSC_VER >= 1000)
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
305
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
306 /* MSVC 4.2 invokes these functions from mainCRTStartup to initialize
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
307 a heap via HeapCreate. They are normally defined by the runtime,
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
308 but we override them here so that the unnecessary HeapCreate call
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
309 is not performed. */
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
310
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
311 int __cdecl
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
312 _heap_init (void)
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
313 {
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
314 /* Stepping through the assembly indicates that mainCRTStartup is
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
315 expecting a nonzero success return value. */
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
316 return 1;
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
317 }
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
318
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
319 void __cdecl
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
320 _heap_term (void)
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
321 {
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
322 return;
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
323 }
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
324
16e69fbdbf0f (os_subtype): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18506
diff changeset
325 #endif