memory.cpp revision 1.4.8.2 1 1.4.8.2 nathanw /* $NetBSD: memory.cpp,v 1.4.8.2 2002/02/28 04:09:45 nathanw Exp $ */
2 1.4.8.2 nathanw
3 1.4.8.2 nathanw /*-
4 1.4.8.2 nathanw * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
5 1.4.8.2 nathanw * All rights reserved.
6 1.4.8.2 nathanw *
7 1.4.8.2 nathanw * This code is derived from software contributed to The NetBSD Foundation
8 1.4.8.2 nathanw * by UCHIYAMA Yasushi.
9 1.4.8.2 nathanw *
10 1.4.8.2 nathanw * Redistribution and use in source and binary forms, with or without
11 1.4.8.2 nathanw * modification, are permitted provided that the following conditions
12 1.4.8.2 nathanw * are met:
13 1.4.8.2 nathanw * 1. Redistributions of source code must retain the above copyright
14 1.4.8.2 nathanw * notice, this list of conditions and the following disclaimer.
15 1.4.8.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
16 1.4.8.2 nathanw * notice, this list of conditions and the following disclaimer in the
17 1.4.8.2 nathanw * documentation and/or other materials provided with the distribution.
18 1.4.8.2 nathanw * 3. All advertising materials mentioning features or use of this software
19 1.4.8.2 nathanw * must display the following acknowledgement:
20 1.4.8.2 nathanw * This product includes software developed by the NetBSD
21 1.4.8.2 nathanw * Foundation, Inc. and its contributors.
22 1.4.8.2 nathanw * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.4.8.2 nathanw * contributors may be used to endorse or promote products derived
24 1.4.8.2 nathanw * from this software without specific prior written permission.
25 1.4.8.2 nathanw *
26 1.4.8.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.4.8.2 nathanw * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.4.8.2 nathanw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.4.8.2 nathanw * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.4.8.2 nathanw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.4.8.2 nathanw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.4.8.2 nathanw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.4.8.2 nathanw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.4.8.2 nathanw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.4.8.2 nathanw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.4.8.2 nathanw * POSSIBILITY OF SUCH DAMAGE.
37 1.4.8.2 nathanw */
38 1.4.8.2 nathanw
39 1.4.8.2 nathanw #include <memory.h>
40 1.4.8.2 nathanw #include <console.h>
41 1.4.8.2 nathanw
42 1.4.8.2 nathanw MemoryManager::MemoryManager(Console *&cons, size_t pagesize)
43 1.4.8.2 nathanw : _cons(cons)
44 1.4.8.2 nathanw {
45 1.4.8.2 nathanw _debug = FALSE;
46 1.4.8.2 nathanw _page_size = pagesize;
47 1.4.8.2 nathanw
48 1.4.8.2 nathanw int mask = _page_size;
49 1.4.8.2 nathanw for (_page_shift = 0; !(mask & 1); _page_shift++)
50 1.4.8.2 nathanw mask >>= 1;
51 1.4.8.2 nathanw
52 1.4.8.2 nathanw _page_per_region = WCE_REGION_SIZE / _page_size;
53 1.4.8.2 nathanw _nbank = 0;
54 1.4.8.2 nathanw _addr_table_idx = 0;
55 1.4.8.2 nathanw _addr_table = 0;
56 1.4.8.2 nathanw _memory = 0;
57 1.4.8.2 nathanw }
58 1.4.8.2 nathanw
59 1.4.8.2 nathanw MemoryManager::~MemoryManager(void)
60 1.4.8.2 nathanw {
61 1.4.8.2 nathanw if (_memory)
62 1.4.8.2 nathanw VirtualFree(LPVOID(_memory), 0, MEM_RELEASE);
63 1.4.8.2 nathanw }
64 1.4.8.2 nathanw
65 1.4.8.2 nathanw void
66 1.4.8.2 nathanw MemoryManager::loadBank(paddr_t paddr, psize_t psize)
67 1.4.8.2 nathanw {
68 1.4.8.2 nathanw struct MemoryManager::bank *b = &_bank[_nbank++];
69 1.4.8.2 nathanw b->addr = paddr;
70 1.4.8.2 nathanw b->size = psize;
71 1.4.8.2 nathanw DPRINTF((TEXT("[%d] 0x%08x size 0x%08x\n"), _nbank - 1,
72 1.4.8.2 nathanw b->addr, b->size));
73 1.4.8.2 nathanw }
74 1.4.8.2 nathanw
75 1.4.8.2 nathanw BOOL
76 1.4.8.2 nathanw MemoryManager::reservePage(vsize_t size, BOOL page_commit)
77 1.4.8.2 nathanw {
78 1.4.8.2 nathanw // My virtual memory space
79 1.4.8.2 nathanw vaddr_t vbase;
80 1.4.8.2 nathanw vsize_t vsize;
81 1.4.8.2 nathanw
82 1.4.8.2 nathanw int i, npage;
83 1.4.8.2 nathanw
84 1.4.8.2 nathanw if (size == 0)
85 1.4.8.2 nathanw return FALSE;
86 1.4.8.2 nathanw
87 1.4.8.2 nathanw // reserve all virtual memory.
88 1.4.8.2 nathanw vsize = roundRegion(size);
89 1.4.8.2 nathanw npage = roundPage(size) / _page_size;
90 1.4.8.2 nathanw
91 1.4.8.2 nathanw size_t tabsz = sizeof(struct AddressTranslationTable) * npage;
92 1.4.8.2 nathanw _addr_table = static_cast <struct AddressTranslationTable *>
93 1.4.8.2 nathanw (malloc(tabsz));
94 1.4.8.2 nathanw if (_addr_table == NULL) {
95 1.4.8.2 nathanw DPRINTF((TEXT("can't allocate memory for translation table.\n")));
96 1.4.8.2 nathanw return FALSE;
97 1.4.8.2 nathanw }
98 1.4.8.2 nathanw DPRINTF((TEXT("address translation table %d pages.(%d byte)\n"), npage,
99 1.4.8.2 nathanw tabsz));
100 1.4.8.2 nathanw
101 1.4.8.2 nathanw if (page_commit)
102 1.4.8.2 nathanw vbase = vaddr_t(VirtualAlloc(0, vsize, MEM_RESERVE,
103 1.4.8.2 nathanw PAGE_NOACCESS));
104 1.4.8.2 nathanw else
105 1.4.8.2 nathanw vbase = vaddr_t(VirtualAlloc(0, vsize, MEM_COMMIT,
106 1.4.8.2 nathanw PAGE_READWRITE | PAGE_NOCACHE));
107 1.4.8.2 nathanw
108 1.4.8.2 nathanw if (vbase == 0) {
109 1.4.8.2 nathanw DPRINTF((TEXT("can't allocate memory\n")));
110 1.4.8.2 nathanw return FALSE;
111 1.4.8.2 nathanw }
112 1.4.8.2 nathanw _memory = vbase;
113 1.4.8.2 nathanw
114 1.4.8.2 nathanw // find physical address of allocated page.
115 1.4.8.2 nathanw AddressTranslationTable *tab = _addr_table;
116 1.4.8.2 nathanw _naddr_table = 0;
117 1.4.8.2 nathanw for (i = 0; i < npage; i++) {
118 1.4.8.2 nathanw vaddr_t vaddr;
119 1.4.8.2 nathanw paddr_t paddr = ~0;
120 1.4.8.2 nathanw
121 1.4.8.2 nathanw if (page_commit)
122 1.4.8.2 nathanw // now map to physical page.
123 1.4.8.2 nathanw vaddr = vaddr_t(VirtualAlloc(
124 1.4.8.2 nathanw LPVOID(vbase + _page_size * i),
125 1.4.8.2 nathanw _page_size, MEM_COMMIT,
126 1.4.8.2 nathanw PAGE_READWRITE | PAGE_NOCACHE));
127 1.4.8.2 nathanw else
128 1.4.8.2 nathanw vaddr = vbase + _page_size * i;
129 1.4.8.2 nathanw
130 1.4.8.2 nathanw paddr = searchPage(vaddr);
131 1.4.8.2 nathanw
132 1.4.8.2 nathanw if (paddr == ~0) {
133 1.4.8.2 nathanw DPRINTF((TEXT("page#%d not found\n"), i));
134 1.4.8.2 nathanw break;
135 1.4.8.2 nathanw } else {
136 1.4.8.2 nathanw #ifdef MEMORY_MAP_DEBUG
137 1.4.8.2 nathanw DPRINTF((TEXT("page %d vaddr=0x%08x paddr=0x%08x\n"),
138 1.4.8.2 nathanw _naddr_table, vaddr, paddr));
139 1.4.8.2 nathanw #endif
140 1.4.8.2 nathanw tab->vaddr = vaddr;
141 1.4.8.2 nathanw tab->paddr = paddr;
142 1.4.8.2 nathanw ++tab;
143 1.4.8.2 nathanw ++_naddr_table;
144 1.4.8.2 nathanw }
145 1.4.8.2 nathanw }
146 1.4.8.2 nathanw
147 1.4.8.2 nathanw #ifdef MEMORY_MAP_DEBUG
148 1.4.8.2 nathanw // dump virtual <-> physical address table
149 1.4.8.2 nathanw tab = _addr_table;
150 1.4.8.2 nathanw for (i = 0; i < _naddr_table;) {
151 1.4.8.2 nathanw for (int j = 0; j < 4; j++, i++, tab++)
152 1.4.8.2 nathanw DPRINTF((TEXT("%08x=%08x "), tab->vaddr, tab->paddr));
153 1.4.8.2 nathanw DPRINTF((TEXT("\n")));
154 1.4.8.2 nathanw }
155 1.4.8.2 nathanw #endif
156 1.4.8.2 nathanw DPRINTF((TEXT("allocated %d page. mapped %d page.\n"), npage,
157 1.4.8.2 nathanw _naddr_table));
158 1.4.8.2 nathanw
159 1.4.8.2 nathanw return TRUE;
160 1.4.8.2 nathanw }
161 1.4.8.2 nathanw
162 1.4.8.2 nathanw BOOL
163 1.4.8.2 nathanw MemoryManager::getPage(vaddr_t &vaddr, paddr_t &paddr)
164 1.4.8.2 nathanw {
165 1.4.8.2 nathanw /* get plain page from the top */
166 1.4.8.2 nathanw if (_addr_table_idx >= _naddr_table ||
167 1.4.8.2 nathanw _addr_table == NULL)
168 1.4.8.2 nathanw return FALSE;
169 1.4.8.2 nathanw
170 1.4.8.2 nathanw int idx = --_naddr_table;
171 1.4.8.2 nathanw
172 1.4.8.2 nathanw AddressTranslationTable *tab = &_addr_table[idx];
173 1.4.8.2 nathanw vaddr = tab->vaddr;
174 1.4.8.2 nathanw paddr = tab->paddr;
175 1.4.8.2 nathanw
176 1.4.8.2 nathanw return TRUE;
177 1.4.8.2 nathanw }
178 1.4.8.2 nathanw
179 1.4.8.2 nathanw BOOL
180 1.4.8.2 nathanw MemoryManager::getTaggedPage(vaddr_t &vaddr, paddr_t &paddr)
181 1.4.8.2 nathanw {
182 1.4.8.2 nathanw /* get tagged page from the bottom */
183 1.4.8.2 nathanw if (_addr_table_idx >= _naddr_table ||
184 1.4.8.2 nathanw _addr_table == NULL) {
185 1.4.8.2 nathanw DPRINTF((TEXT("page insufficient.\n")));
186 1.4.8.2 nathanw return FALSE;
187 1.4.8.2 nathanw }
188 1.4.8.2 nathanw AddressTranslationTable *tab =
189 1.4.8.2 nathanw &_addr_table[_addr_table_idx++];
190 1.4.8.2 nathanw vaddr = tab->vaddr;
191 1.4.8.2 nathanw paddr = tab->paddr;
192 1.4.8.2 nathanw
193 1.4.8.2 nathanw return TRUE;
194 1.4.8.2 nathanw }
195 1.4.8.2 nathanw
196 1.4.8.2 nathanw BOOL
197 1.4.8.2 nathanw MemoryManager::getTaggedPage(vaddr_t &v, paddr_t &p,
198 1.4.8.2 nathanw struct PageTag **pvec, paddr_t &pvec_paddr)
199 1.4.8.2 nathanw {
200 1.4.8.2 nathanw if (!getTaggedPage(v, p))
201 1.4.8.2 nathanw return FALSE;
202 1.4.8.2 nathanw
203 1.4.8.2 nathanw *pvec =(struct PageTag *)v;
204 1.4.8.2 nathanw memset(*pvec, 0, sizeof(struct PageTag));
205 1.4.8.2 nathanw v += sizeof(struct PageTag);
206 1.4.8.2 nathanw pvec_paddr = p;
207 1.4.8.2 nathanw p += sizeof(struct PageTag);
208 1.4.8.2 nathanw
209 1.4.8.2 nathanw return TRUE;
210 1.4.8.2 nathanw }
211 1.4.8.2 nathanw
212 1.4.8.2 nathanw vaddr_t
213 1.4.8.2 nathanw MemoryManager::mapPhysicalPage(paddr_t paddr, psize_t size, u_int32_t flags)
214 1.4.8.2 nathanw {
215 1.4.8.2 nathanw paddr_t pstart = truncPage(paddr);
216 1.4.8.2 nathanw paddr_t pend = roundPage(paddr + size);
217 1.4.8.2 nathanw psize_t psize = pend - pstart;
218 1.4.8.2 nathanw
219 1.4.8.2 nathanw LPVOID p = VirtualAlloc(0, psize, MEM_RESERVE, PAGE_NOACCESS);
220 1.4.8.2 nathanw
221 1.4.8.2 nathanw int ok = VirtualCopy(p, LPVOID(pstart >> 8), psize,
222 1.4.8.2 nathanw flags | PAGE_NOCACHE | PAGE_PHYSICAL);
223 1.4.8.2 nathanw if (!ok) {
224 1.4.8.2 nathanw DPRINTF((TEXT("can't map physical address 0x%08x\n"), paddr));
225 1.4.8.2 nathanw return ~0;
226 1.4.8.2 nathanw }
227 1.4.8.2 nathanw #if 0
228 1.4.8.2 nathanw DPRINTF((TEXT("start=0x%08x end=0x%08x size=0x%08x return=0x%08x\n"),
229 1.4.8.2 nathanw pstart, pend, psize, vaddr_t(p) + vaddr_t(paddr - pstart)));
230 1.4.8.2 nathanw
231 1.4.8.2 nathanw #endif
232 1.4.8.2 nathanw
233 1.4.8.2 nathanw return vaddr_t(p) + vaddr_t(paddr - pstart);
234 1.4.8.2 nathanw }
235 1.4.8.2 nathanw
236 1.4.8.2 nathanw void
237 1.4.8.2 nathanw MemoryManager::unmapPhysicalPage(vaddr_t vaddr)
238 1.4.8.2 nathanw {
239 1.4.8.2 nathanw int ok = VirtualFree(LPVOID(truncPage(vaddr)), 0, MEM_RELEASE);
240 1.4.8.2 nathanw if (!ok)
241 1.4.8.2 nathanw DPRINTF((TEXT("can't release memory\n")));
242 1.4.8.2 nathanw }
243 1.4.8.2 nathanw
244 1.4.8.2 nathanw u_int32_t
245 1.4.8.2 nathanw MemoryManager::readPhysical4(paddr_t paddr)
246 1.4.8.2 nathanw {
247 1.4.8.2 nathanw vaddr_t v = mapPhysicalPage(paddr, 4, PAGE_READONLY);
248 1.4.8.2 nathanw u_int32_t val = *(u_int32_t *)v;
249 1.4.8.2 nathanw unmapPhysicalPage(v);
250 1.4.8.2 nathanw return val;
251 1.4.8.2 nathanw }
252 1.4.8.2 nathanw
253 1.4.8.2 nathanw //
254 1.4.8.2 nathanw // Use LockPages()
255 1.4.8.2 nathanw //
256 1.4.8.2 nathanw MemoryManager_LockPages::MemoryManager_LockPages
257 1.4.8.2 nathanw (BOOL(*lock_pages)(LPVOID, DWORD, PDWORD, int),
258 1.4.8.2 nathanw BOOL(*unlock_pages)(LPVOID, DWORD),
259 1.4.8.2 nathanw Console *&cons, size_t pagesize, int shift)
260 1.4.8.2 nathanw : MemoryManager(cons, pagesize)
261 1.4.8.2 nathanw {
262 1.4.8.2 nathanw _lock_pages = lock_pages;
263 1.4.8.2 nathanw _unlock_pages = unlock_pages;
264 1.4.8.2 nathanw _shift = shift;
265 1.4.8.2 nathanw DPRINTF((TEXT("MemoryManager: LockPages\n")));
266 1.4.8.2 nathanw }
267 1.4.8.2 nathanw
268 1.4.8.2 nathanw MemoryManager_LockPages::~MemoryManager_LockPages(void)
269 1.4.8.2 nathanw {
270 1.4.8.2 nathanw }
271 1.4.8.2 nathanw
272 1.4.8.2 nathanw paddr_t
273 1.4.8.2 nathanw MemoryManager_LockPages::searchPage(vaddr_t vaddr)
274 1.4.8.2 nathanw {
275 1.4.8.2 nathanw paddr_t paddr = ~0;
276 1.4.8.2 nathanw
277 1.4.8.2 nathanw if (!_lock_pages(LPVOID(vaddr), _page_size, PDWORD(&paddr), 1))
278 1.4.8.2 nathanw return paddr;
279 1.4.8.2 nathanw
280 1.4.8.2 nathanw if (!_unlock_pages(LPVOID(vaddr), _page_size)) {
281 1.4.8.2 nathanw DPRINTF((TEXT("can't unlock pages\n")));
282 1.4.8.2 nathanw }
283 1.4.8.2 nathanw
284 1.4.8.2 nathanw return(paddr >>(_page_shift - _shift)) << _page_shift;
285 1.4.8.2 nathanw }
286 1.4.8.2 nathanw
287 1.4.8.2 nathanw //
288 1.4.8.2 nathanw // Use VirtualCopy()
289 1.4.8.2 nathanw //
290 1.4.8.2 nathanw MemoryManager_VirtualCopy::MemoryManager_VirtualCopy(Console *&cons,
291 1.4.8.2 nathanw size_t pagesize)
292 1.4.8.2 nathanw : MemoryManager(cons, pagesize)
293 1.4.8.2 nathanw {
294 1.4.8.2 nathanw _search_guess = 0;
295 1.4.8.2 nathanw DPRINTF((TEXT("MemoryManager: VirtualCopy\n")));
296 1.4.8.2 nathanw }
297 1.4.8.2 nathanw
298 1.4.8.2 nathanw MemoryManager_VirtualCopy::~MemoryManager_VirtualCopy(void)
299 1.4.8.2 nathanw {
300 1.4.8.2 nathanw }
301 1.4.8.2 nathanw
302 1.4.8.2 nathanw paddr_t
303 1.4.8.2 nathanw MemoryManager_VirtualCopy::searchPage(vaddr_t vaddr)
304 1.4.8.2 nathanw {
305 1.4.8.2 nathanw paddr_t paddr = ~0;
306 1.4.8.2 nathanw int i;
307 1.4.8.2 nathanw
308 1.4.8.2 nathanw // search all D-RAM bank.
309 1.4.8.2 nathanw setMagic(vaddr);
310 1.4.8.2 nathanw retry:
311 1.4.8.2 nathanw for (i = 0; i < _nbank; i++) {
312 1.4.8.2 nathanw paddr = searchBank(i);
313 1.4.8.2 nathanw if (paddr != ~0)
314 1.4.8.2 nathanw break;
315 1.4.8.2 nathanw }
316 1.4.8.2 nathanw if (_search_guess != 0 && paddr == ~0) {
317 1.4.8.2 nathanw _search_guess = 0;
318 1.4.8.2 nathanw goto retry;
319 1.4.8.2 nathanw }
320 1.4.8.2 nathanw
321 1.4.8.2 nathanw clearMagic();
322 1.4.8.2 nathanw
323 1.4.8.2 nathanw return paddr;
324 1.4.8.2 nathanw }
325 1.4.8.2 nathanw
326 1.4.8.2 nathanw paddr_t
327 1.4.8.2 nathanw MemoryManager_VirtualCopy::searchBank(int banknum)
328 1.4.8.2 nathanw {
329 1.4.8.2 nathanw LPVOID ref;
330 1.4.8.2 nathanw paddr_t paddr, pstart, pend, pfound = ~0;
331 1.4.8.2 nathanw paddr_t bstart, bend;
332 1.4.8.2 nathanw vaddr_t ofs;
333 1.4.8.2 nathanw
334 1.4.8.2 nathanw bstart = _bank[banknum].addr;
335 1.4.8.2 nathanw bend = _bank[banknum].addr + _bank[banknum].size;
336 1.4.8.2 nathanw
337 1.4.8.2 nathanw pstart = _search_guess ? _search_guess : bstart;
338 1.4.8.2 nathanw pend = bend;
339 1.4.8.2 nathanw
340 1.4.8.2 nathanw if (pstart < bstart || pstart >= pend)
341 1.4.8.2 nathanw return pfound;
342 1.4.8.2 nathanw
343 1.4.8.2 nathanw // reserve physical reference region
344 1.4.8.2 nathanw ref = VirtualAlloc(0, BLOCK_SIZE, MEM_RESERVE, PAGE_NOACCESS);
345 1.4.8.2 nathanw if (ref == 0) {
346 1.4.8.2 nathanw DPRINTF((TEXT("can't allocate virtual memory.\n")));
347 1.4.8.2 nathanw return pfound;
348 1.4.8.2 nathanw }
349 1.4.8.2 nathanw
350 1.4.8.2 nathanw for (paddr = pstart; paddr < pend; paddr += BLOCK_SIZE) {
351 1.4.8.2 nathanw if (!VirtualCopy(ref, LPVOID(paddr >> 8), BLOCK_SIZE,
352 1.4.8.2 nathanw PAGE_READONLY | PAGE_NOCACHE | PAGE_PHYSICAL)) {
353 1.4.8.2 nathanw DPRINTF((TEXT("can't map physical addr 0x%08x(->0x%08x)\n"),
354 1.4.8.2 nathanw ref, paddr));
355 1.4.8.2 nathanw goto release;
356 1.4.8.2 nathanw }
357 1.4.8.2 nathanw
358 1.4.8.2 nathanw // search magic in this region.
359 1.4.8.2 nathanw ofs = checkMagicRegion(vaddr_t(ref), BLOCK_SIZE, _page_size);
360 1.4.8.2 nathanw
361 1.4.8.2 nathanw // decommit reference region.
362 1.4.8.2 nathanw if (!VirtualFree(ref, BLOCK_SIZE, MEM_DECOMMIT)) {
363 1.4.8.2 nathanw DPRINTF((TEXT("can't decommit addr 0x%08x(->0x%08x)\n"),
364 1.4.8.2 nathanw ref, paddr));
365 1.4.8.2 nathanw goto release;
366 1.4.8.2 nathanw }
367 1.4.8.2 nathanw
368 1.4.8.2 nathanw if (ofs != ~0) {
369 1.4.8.2 nathanw pfound = paddr + ofs;
370 1.4.8.2 nathanw _search_guess = paddr;
371 1.4.8.2 nathanw break;
372 1.4.8.2 nathanw }
373 1.4.8.2 nathanw }
374 1.4.8.2 nathanw release:
375 1.4.8.2 nathanw if (!VirtualFree(ref, 0, MEM_RELEASE))
376 1.4.8.2 nathanw DPRINTF((TEXT("can't release memory\n")));
377 1.4.8.2 nathanw
378 1.4.8.2 nathanw return pfound;
379 1.4.8.2 nathanw }
380