[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / mm / meminit.c
1 /*
2 * FreeLoader
3 * Copyright (C) 2006-2008 Aleksey Bragin <aleksey@reactos.org>
4 * Copyright (C) 2006-2009 Hervé Poussineau <hpoussin@reactos.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include <freeldr.h>
22 #include <debug.h>
23
24 DBG_DEFAULT_CHANNEL(MEMORY);
25
26 #if DBG
27 typedef struct
28 {
29 TYPE_OF_MEMORY Type;
30 PCSTR TypeString;
31 } FREELDR_MEMORY_TYPE, *PFREELDR_MEMORY_TYPE;
32
33 FREELDR_MEMORY_TYPE MemoryTypeArray[] =
34 {
35 { LoaderMaximum, "Unknown memory" },
36 { LoaderFree, "Free memory" },
37 { LoaderBad, "Bad memory" },
38 { LoaderLoadedProgram, "LoadedProgram" },
39 { LoaderFirmwareTemporary, "FirmwareTemporary" },
40 { LoaderFirmwarePermanent, "FirmwarePermanent" },
41 { LoaderOsloaderHeap, "OsloaderHeap" },
42 { LoaderOsloaderStack, "OsloaderStack" },
43 { LoaderSystemCode, "SystemCode" },
44 { LoaderHalCode, "HalCode" },
45 { LoaderBootDriver, "BootDriver" },
46 { LoaderRegistryData, "RegistryData" },
47 { LoaderMemoryData, "MemoryData" },
48 { LoaderNlsData, "NlsData" },
49 { LoaderSpecialMemory, "SpecialMemory" },
50 { LoaderReserve, "Reserve" },
51 };
52 ULONG MemoryTypeCount = sizeof(MemoryTypeArray) / sizeof(MemoryTypeArray[0]);
53 #endif
54
55 PVOID PageLookupTableAddress = NULL;
56 PFN_NUMBER TotalPagesInLookupTable = 0;
57 PFN_NUMBER FreePagesInLookupTable = 0;
58 PFN_NUMBER LastFreePageHint = 0;
59 PFN_NUMBER MmLowestPhysicalPage = 0xFFFFFFFF;
60 PFN_NUMBER MmHighestPhysicalPage = 0;
61
62 PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
63 ULONG BiosMemoryMapEntryCount;
64
65 extern ULONG_PTR MmHeapPointer;
66 extern ULONG_PTR MmHeapStart;
67
68 ULONG
69 AddMemoryDescriptor(
70 IN OUT PFREELDR_MEMORY_DESCRIPTOR List,
71 IN ULONG MaxCount,
72 IN PFN_NUMBER BasePage,
73 IN PFN_NUMBER PageCount,
74 IN TYPE_OF_MEMORY MemoryType)
75 {
76 ULONG i, c;
77 PFN_NUMBER NextBase;
78 TRACE("AddMemoryDescriptor(0x%lx-0x%lx [0x%lx pages])\n",
79 BasePage, BasePage + PageCount, PageCount);
80
81 /* Scan through all existing descriptors */
82 for (i = 0, c = 0; (c < MaxCount) && (List[c].PageCount != 0); c++)
83 {
84 /* Count entries completely below the new range */
85 if (List[i].BasePage + List[i].PageCount <= BasePage) i++;
86 }
87
88 /* Check if the list is full */
89 if (c >= MaxCount) return c;
90
91 /* Is there an existing descriptor starting before the new range */
92 while ((i < c) && (List[i].BasePage <= BasePage))
93 {
94 /* The end of the existing one is the minimum for the new range */
95 NextBase = List[i].BasePage + List[i].PageCount;
96
97 /* Bail out, if everything is trimmed away */
98 if ((BasePage + PageCount) <= NextBase) return c;
99
100 /* Trim the naew range at the lower end */
101 PageCount -= (NextBase - BasePage);
102 BasePage = NextBase;
103
104 /* Go to the next entry and repeat */
105 i++;
106 }
107
108 ASSERT(PageCount > 0);
109
110 /* Are there still entries above? */
111 if (i < c)
112 {
113 /* Shift the following entries one up */
114 RtlMoveMemory(&List[i+1], &List[i], (c - i) * sizeof(List[0]));
115
116 /* Insert the new range */
117 List[i].BasePage = BasePage;
118 List[i].PageCount = min(PageCount, List[i+1].BasePage - BasePage);
119 List[i].MemoryType = MemoryType;
120 c++;
121
122 TRACE("Inserting at i=%ld: (0x%lx:0x%lx)\n",
123 i, List[i].BasePage, List[i].PageCount);
124
125 /* Check if the range was trimmed */
126 if (PageCount > List[i].PageCount)
127 {
128 /* Recursively process the trimmed part */
129 c = AddMemoryDescriptor(List,
130 MaxCount,
131 BasePage + List[i].PageCount,
132 PageCount - List[i].PageCount,
133 MemoryType);
134 }
135 }
136 else
137 {
138 /* We can simply add the range here */
139 TRACE("Adding i=%ld: (0x%lx:0x%lx)\n", i, BasePage, PageCount);
140 List[i].BasePage = BasePage;
141 List[i].PageCount = PageCount;
142 List[i].MemoryType = MemoryType;
143 c++;
144 }
145
146 /* Return the new count */
147 return c;
148 }
149
150 const FREELDR_MEMORY_DESCRIPTOR*
151 ArcGetMemoryDescriptor(const FREELDR_MEMORY_DESCRIPTOR* Current)
152 {
153 if (Current == NULL)
154 {
155 return BiosMemoryMap;
156 }
157 else
158 {
159 Current++;
160 if (Current->PageCount == 0) return NULL;
161 return Current;
162 }
163 }
164
165
166 BOOLEAN
167 MmCheckFreeldrImageFile()
168 {
169 PIMAGE_NT_HEADERS NtHeaders;
170 PIMAGE_FILE_HEADER FileHeader;
171 PIMAGE_OPTIONAL_HEADER OptionalHeader;
172
173 /* Get the NT headers */
174 NtHeaders = RtlImageNtHeader(&__ImageBase);
175 if (!NtHeaders)
176 {
177 ERR("Coult not get NtHeaders!\n");
178 return FALSE;
179 }
180
181 /* Check the file header */
182 FileHeader = &NtHeaders->FileHeader;
183 if ((FileHeader->Machine != IMAGE_FILE_MACHINE_NATIVE) ||
184 (FileHeader->NumberOfSections != FREELDR_SECTION_COUNT) ||
185 (FileHeader->PointerToSymbolTable != 0) ||
186 (FileHeader->NumberOfSymbols != 0) ||
187 (FileHeader->SizeOfOptionalHeader != 0xE0))
188 {
189 return FALSE;
190 }
191
192 /* Check the optional header */
193 OptionalHeader = &NtHeaders->OptionalHeader;
194 if ((OptionalHeader->Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) ||
195 (OptionalHeader->Subsystem != 1) || // native
196 (OptionalHeader->ImageBase != FREELDR_PE_BASE) ||
197 (OptionalHeader->SizeOfImage > MAX_FREELDR_PE_SIZE) ||
198 (OptionalHeader->SectionAlignment != OptionalHeader->FileAlignment))
199 {
200 return FALSE;
201 }
202
203 return TRUE;
204 }
205
206 BOOLEAN MmInitializeMemoryManager(VOID)
207 {
208 #if DBG
209 const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
210 #endif
211
212 TRACE("Initializing Memory Manager.\n");
213
214 /* Check the freeldr binary */
215 if (!MmCheckFreeldrImageFile())
216 {
217 FrLdrBugCheck(FREELDR_IMAGE_CORRUPTION);
218 }
219
220 BiosMemoryMap = MachVtbl.GetMemoryMap(&BiosMemoryMapEntryCount);
221
222 #if DBG
223 // Dump the system memory map
224 TRACE("System Memory Map (Base Address, Length, Type):\n");
225 while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
226 {
227 TRACE("%x\t %x\t %s\n",
228 MemoryDescriptor->BasePage * MM_PAGE_SIZE,
229 MemoryDescriptor->PageCount * MM_PAGE_SIZE,
230 MmGetSystemMemoryMapTypeString(MemoryDescriptor->MemoryType));
231 }
232 #endif
233
234 // Find address for the page lookup table
235 TotalPagesInLookupTable = MmGetAddressablePageCountIncludingHoles();
236 PageLookupTableAddress = MmFindLocationForPageLookupTable(TotalPagesInLookupTable);
237 LastFreePageHint = MmHighestPhysicalPage;
238
239 if (PageLookupTableAddress == 0)
240 {
241 // If we get here then we probably couldn't
242 // find a contiguous chunk of memory big
243 // enough to hold the page lookup table
244 printf("Error initializing memory manager!\n");
245 return FALSE;
246 }
247
248 // Initialize the page lookup table
249 MmInitPageLookupTable(PageLookupTableAddress, TotalPagesInLookupTable);
250
251 MmUpdateLastFreePageHint(PageLookupTableAddress, TotalPagesInLookupTable);
252
253 FreePagesInLookupTable = MmCountFreePagesInLookupTable(PageLookupTableAddress,
254 TotalPagesInLookupTable);
255
256 MmInitializeHeap(PageLookupTableAddress);
257
258 TRACE("Memory Manager initialized. 0x%x pages available.\n", FreePagesInLookupTable);
259
260
261 return TRUE;
262 }
263
264 #if DBG
265 PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type)
266 {
267 ULONG Index;
268
269 for (Index=1; Index<MemoryTypeCount; Index++)
270 {
271 if (MemoryTypeArray[Index].Type == Type)
272 {
273 return MemoryTypeArray[Index].TypeString;
274 }
275 }
276
277 return MemoryTypeArray[0].TypeString;
278 }
279 #endif
280
281 PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address)
282 {
283 return ((ULONG_PTR)Address) / MM_PAGE_SIZE;
284 }
285
286 PFN_NUMBER MmGetAddressablePageCountIncludingHoles(VOID)
287 {
288 const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
289 PFN_NUMBER PageCount;
290
291 //
292 // Go through the whole memory map to get max address
293 //
294 while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
295 {
296 //
297 // Check if we got a higher end page address
298 //
299 if (MemoryDescriptor->BasePage + MemoryDescriptor->PageCount > MmHighestPhysicalPage)
300 {
301 //
302 // Yes, remember it if this is real memory
303 //
304 if (MemoryDescriptor->MemoryType == LoaderFree)
305 MmHighestPhysicalPage = MemoryDescriptor->BasePage + MemoryDescriptor->PageCount;
306 }
307
308 //
309 // Check if we got a higher (usable) start page address
310 //
311 if (MemoryDescriptor->BasePage < MmLowestPhysicalPage)
312 {
313 //
314 // Yes, remember it if this is real memory
315 //
316 MmLowestPhysicalPage = MemoryDescriptor->BasePage;
317 }
318 }
319
320 TRACE("lo/hi %lx %lx\n", MmLowestPhysicalPage, MmHighestPhysicalPage);
321 PageCount = MmHighestPhysicalPage - MmLowestPhysicalPage;
322 TRACE("MmGetAddressablePageCountIncludingHoles() returning 0x%x\n", PageCount);
323 return PageCount;
324 }
325
326 PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount)
327 {
328 const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
329 SIZE_T PageLookupTableSize;
330 PFN_NUMBER PageLookupTablePages;
331 PFN_NUMBER PageLookupTableStartPage = 0;
332 PVOID PageLookupTableMemAddress = NULL;
333
334 // Calculate how much pages we need to keep the page lookup table
335 PageLookupTableSize = TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM);
336 PageLookupTablePages = PageLookupTableSize / MM_PAGE_SIZE;
337
338 // Search the highest memory block big enough to contain lookup table
339 while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
340 {
341 // Continue, if memory is not free
342 if (MemoryDescriptor->MemoryType != LoaderFree) continue;
343
344 // Continue, if the block is not big enough?
345 if (MemoryDescriptor->PageCount < PageLookupTablePages) continue;
346
347 // Continue, if it is not at a higher address than previous address
348 if (MemoryDescriptor->BasePage < PageLookupTableStartPage) continue;
349
350 // Continue, if the address is too high
351 if (MemoryDescriptor->BasePage >= MM_MAX_PAGE) continue;
352
353 // Memory block is more suitable than the previous one
354 PageLookupTableStartPage = MemoryDescriptor->BasePage;
355 PageLookupTableMemAddress = (PVOID)((ULONG_PTR)
356 (MemoryDescriptor->BasePage + MemoryDescriptor->PageCount) * MM_PAGE_SIZE
357 - PageLookupTableSize);
358 }
359
360 TRACE("MmFindLocationForPageLookupTable() returning 0x%x\n", PageLookupTableMemAddress);
361
362 return PageLookupTableMemAddress;
363 }
364
365 VOID MmInitPageLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
366 {
367 const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
368 PFN_NUMBER PageLookupTableStartPage;
369 PFN_NUMBER PageLookupTablePageCount;
370
371 TRACE("MmInitPageLookupTable()\n");
372
373 // Mark every page as allocated initially
374 // We will go through and mark pages again according to the memory map
375 // But this will mark any holes not described in the map as allocated
376 MmMarkPagesInLookupTable(PageLookupTable, MmLowestPhysicalPage, TotalPageCount, LoaderFirmwarePermanent);
377
378 // Parse the whole memory map
379 while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
380 {
381 // Mark used pages in the lookup table
382
383 if (MemoryDescriptor->BasePage + MemoryDescriptor->PageCount <= TotalPageCount)
384 {
385 TRACE("Marking pages 0x%lx-0x%lx as type %s\n",
386 MemoryDescriptor->BasePage,
387 MemoryDescriptor->BasePage + MemoryDescriptor->PageCount,
388 MmGetSystemMemoryMapTypeString(MemoryDescriptor->MemoryType));
389 MmMarkPagesInLookupTable(PageLookupTable,
390 MemoryDescriptor->BasePage,
391 MemoryDescriptor->PageCount,
392 MemoryDescriptor->MemoryType);
393 }
394 else
395 TRACE("Ignoring pages 0x%lx-0x%lx (%s)\n",
396 MemoryDescriptor->BasePage,
397 MemoryDescriptor->BasePage + MemoryDescriptor->PageCount,
398 MmGetSystemMemoryMapTypeString(MemoryDescriptor->MemoryType));
399 }
400
401 // Mark the pages that the lookup table occupies as reserved
402 PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
403 PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
404 TRACE("Marking the page lookup table pages as reserved StartPage: 0x%x PageCount: 0x%x\n", PageLookupTableStartPage, PageLookupTablePageCount);
405 MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, LoaderFirmwareTemporary);
406 }
407
408 VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY PageAllocated)
409 {
410 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
411 PFN_NUMBER Index;
412 TRACE("MmMarkPagesInLookupTable()\n");
413
414 /* Validate the range */
415 if ((StartPage < MmLowestPhysicalPage) ||
416 ((StartPage + PageCount - 1) > MmHighestPhysicalPage))
417 {
418 ERR("Memory (0x%lx:0x%lx) outside of lookup table! Valid range: 0x%lx-0x%lx.\n",
419 StartPage, PageCount, MmLowestPhysicalPage, MmHighestPhysicalPage);
420 return;
421 }
422
423 StartPage -= MmLowestPhysicalPage;
424 for (Index=StartPage; Index<(StartPage+PageCount); Index++)
425 {
426 #if 0
427 if ((Index <= (StartPage + 16)) || (Index >= (StartPage+PageCount-16)))
428 {
429 TRACE("Index = 0x%x StartPage = 0x%x PageCount = 0x%x\n", Index, StartPage, PageCount);
430 }
431 #endif
432 RealPageLookupTable[Index].PageAllocated = PageAllocated;
433 RealPageLookupTable[Index].PageAllocationLength = (PageAllocated != LoaderFree) ? 1 : 0;
434 }
435 TRACE("MmMarkPagesInLookupTable() Done\n");
436 }
437
438 VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY MemoryType)
439 {
440 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
441 PFN_NUMBER Index;
442
443 StartPage -= MmLowestPhysicalPage;
444 for (Index=StartPage; Index<(StartPage+PageCount); Index++)
445 {
446 RealPageLookupTable[Index].PageAllocated = MemoryType;
447 RealPageLookupTable[Index].PageAllocationLength = (Index == StartPage) ? PageCount : 0;
448 }
449 }
450
451 PFN_NUMBER MmCountFreePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
452 {
453 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
454 PFN_NUMBER Index;
455 PFN_NUMBER FreePageCount;
456
457 FreePageCount = 0;
458 for (Index=0; Index<TotalPageCount; Index++)
459 {
460 if (RealPageLookupTable[Index].PageAllocated == LoaderFree)
461 {
462 FreePageCount++;
463 }
464 }
465
466 return FreePageCount;
467 }
468
469 PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, BOOLEAN FromEnd)
470 {
471 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
472 PFN_NUMBER AvailablePagesSoFar;
473 PFN_NUMBER Index;
474
475 if (LastFreePageHint > TotalPageCount)
476 {
477 LastFreePageHint = TotalPageCount;
478 }
479
480 AvailablePagesSoFar = 0;
481 if (FromEnd)
482 {
483 /* Allocate "high" (from end) pages */
484 for (Index=LastFreePageHint-1; Index>0; Index--)
485 {
486 if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
487 {
488 AvailablePagesSoFar = 0;
489 continue;
490 }
491 else
492 {
493 AvailablePagesSoFar++;
494 }
495
496 if (AvailablePagesSoFar >= PagesNeeded)
497 {
498 return Index + MmLowestPhysicalPage;
499 }
500 }
501 }
502 else
503 {
504 TRACE("Alloc low memory, LastFreePageHint 0x%x, TPC 0x%x\n", LastFreePageHint, TotalPageCount);
505 /* Allocate "low" pages */
506 for (Index=1; Index < LastFreePageHint; Index++)
507 {
508 if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
509 {
510 AvailablePagesSoFar = 0;
511 continue;
512 }
513 else
514 {
515 AvailablePagesSoFar++;
516 }
517
518 if (AvailablePagesSoFar >= PagesNeeded)
519 {
520 return Index - AvailablePagesSoFar + 1 + MmLowestPhysicalPage;
521 }
522 }
523 }
524
525 return 0;
526 }
527
528 PFN_NUMBER MmFindAvailablePagesBeforePage(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, PFN_NUMBER LastPage)
529 {
530 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
531 PFN_NUMBER AvailablePagesSoFar;
532 PFN_NUMBER Index;
533
534 if (LastPage > TotalPageCount)
535 {
536 return MmFindAvailablePages(PageLookupTable, TotalPageCount, PagesNeeded, TRUE);
537 }
538
539 AvailablePagesSoFar = 0;
540 for (Index=LastPage-1; Index>0; Index--)
541 {
542 if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
543 {
544 AvailablePagesSoFar = 0;
545 continue;
546 }
547 else
548 {
549 AvailablePagesSoFar++;
550 }
551
552 if (AvailablePagesSoFar >= PagesNeeded)
553 {
554 return Index + MmLowestPhysicalPage;
555 }
556 }
557
558 return 0;
559 }
560
561 VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
562 {
563 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
564 PFN_NUMBER Index;
565
566 for (Index=TotalPageCount-1; Index>0; Index--)
567 {
568 if (RealPageLookupTable[Index].PageAllocated == LoaderFree)
569 {
570 LastFreePageHint = Index + 1 + MmLowestPhysicalPage;
571 break;
572 }
573 }
574 }
575
576 BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PVOID PageAddress, PFN_NUMBER PageCount)
577 {
578 PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
579 PFN_NUMBER StartPage;
580 PFN_NUMBER Index;
581
582 StartPage = MmGetPageNumberFromAddress(PageAddress);
583
584 if (StartPage < MmLowestPhysicalPage) return FALSE;
585
586 StartPage -= MmLowestPhysicalPage;
587
588 // Make sure they aren't trying to go past the
589 // end of availabe memory
590 if ((StartPage + PageCount) > TotalPageCount)
591 {
592 return FALSE;
593 }
594
595 for (Index = StartPage; Index < (StartPage + PageCount); Index++)
596 {
597 // If this page is allocated then there obviously isn't
598 // memory availabe so return FALSE
599 if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
600 {
601 return FALSE;
602 }
603 }
604
605 return TRUE;
606 }