Author: greatlrd
Date: Sun Jan 27 22:21:53 2008
New Revision: 32032
URL: http://svn.reactos.org/svn/reactos?rev=32032&view=rev
Log:
revert codepage 862 changes from rev 31935
Now swedish should work again in usetup
Modified:
trunk/reactos/base/setup/usetup/lang/sv-SE.h
Modified: trunk/reactos/base/setup/usetup/lang/sv-SE.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/sv-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/sv-SE.h (original)
+++ trunk/reactos/base/setup/usetup/lang/sv-SE.h Sun Jan 27 22:21:53 2008
@@ -58,7 +58,7 @@
{
6,
8,
- "Vlkommen till ReactOS Setup!",
+ "Välkommen till ReactOS Setup!",
TEXT_HIGHLIGHT
},
{
@@ -70,37 +70,37 @@
{
6,
12,
- "dator och frbereder den andra delen av installationen.",
+ "dator och förbereder den andra delen av installationen.",
TEXT_NORMAL
},
{
8,
15,
- "\x07 Tryck p ENTER fr att installera ReactOS.",
+ "\x07 Tryck på ENTER för att installera ReactOS.",
TEXT_NORMAL
},
{
8,
17,
- "\x07 Tryck p R fr att reparera ReactOS.",
+ "\x07 Tryck på R för att reparera ReactOS.",
TEXT_NORMAL
},
{
8,
19,
- "\x07 Tryck p L fr att lsa licensavtalet till ReactOS.",
+ "\x07 Tryck på L för att läsa licensavtalet till ReactOS.",
TEXT_NORMAL
},
{
8,
21,
- "\x07 Tryck p F3 fr att avbryta installationen av ReactOS.",
+ "\x07 Tryck på F3 för att avbryta installationen av ReactOS.",
TEXT_NORMAL
},
{
6,
23,
- "Fr mer information om ReactOS, besk:",
+ "För mer information om ReactOS, besök:",
TEXT_NORMAL
},
{
@@ -112,7 +112,7 @@
{
0,
0,
- " ENTER = Fortstt R = Reparera F3 = Avbryt",
+ " ENTER = Fortsätt R = Reparera F3 = Avbryt",
TEXT_STATUS
},
{
@@ -134,79 +134,79 @@
{
6,
8,
- "ReactOS Setup r i en tidig utvecklingsfas och saknar drfr ett antal",
+ "ReactOS Setup är i en tidig utvecklingsfas och saknar därför ett antal",
TEXT_NORMAL
},
{
6,
9,
- "funktioner som kan frvntas av ett fullt anvndbart setup-program.",
+ "funktioner som kan förväntas av ett fullt användbart setup-program.",
TEXT_NORMAL
},
{
6,
12,
- "Fljande begrnsningar gller:",
+ "Följande begränsningar gäller:",
TEXT_NORMAL
},
{
8,
13,
- "- Setup kan ej hantera mer n 1 primr partition per hrddisk.",
+ "- Setup kan ej hantera mer än 1 primär partition per hårddisk.",
TEXT_NORMAL
},
{
8,
14,
- "- Setup kan ej radera en primr partition frn en hrddisk",
+ "- Setup kan ej radera en primär partition från en hårddisk",
TEXT_NORMAL
},
{
8,
15,
- " om utkade partitioner existerar p hrddisken.",
+ " om utökade partitioner existerar på hårddisken.",
TEXT_NORMAL
},
{
8,
16,
- "- Setup kan ej radera den frsta utkade partitionen frn en hrddisk",
+ "- Setup kan ej radera den första utökade partitionen från en hårddisk",
TEXT_NORMAL
},
{
8,
17,
- " om andra utkade partitioner existerar p hrddisken.",
+ " om andra utökade partitioner existerar på hårddisken.",
TEXT_NORMAL
},
{
8,
18,
- "- Setup stder endast filsystem av typen FAT.",
+ "- Setup stöder endast filsystem av typen FAT.",
TEXT_NORMAL
},
{
8,
19,
- "- Kontrollering av hrddiskens filsystem stds (nnu) ej.",
+ "- Kontrollering av hårddiskens filsystem stöds (ännu) ej.",
TEXT_NORMAL
},
{
8,
23,
- "\x07 Tryck p ENTER fr att installera ReactOS.",
+ "\x07 Tryck på ENTER för att installera ReactOS.",
TEXT_NORMAL
},
{
8,
25,
- "\x07 Tryck p F3 fr att avbryta installationen.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ENTER = Fortstt F3 = Avbryt",
+ "\x07 Tryck på F3 för att avbryta installationen.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Fortsätt F3 = Avbryt",
TEXT_STATUS
},
{
@@ -234,67 +234,67 @@
{
8,
8,
- "ReactOS r licenserad under GNU GPL med delar",
+ "ReactOS är licenserad under GNU GPL med delar",
TEXT_NORMAL
},
{
8,
9,
- "av den medfljande koden licenserad under GPL-frenliga",
- TEXT_NORMAL
- },
- {
- 8,
- 10,
- "licenser ssom X11-, BSD- och GNU LGPL-licenserna.",
+ "av den medföljande koden licenserad under GPL-förenliga",
+ TEXT_NORMAL
+ },
+ {
+ 8,
+ 10,
+ "licenser såsom X11-, BSD- och GNU LGPL-licenserna.",
TEXT_NORMAL
},
{
8,
11,
- "All mjukvara som r del av ReactOS r publicerad",
+ "All mjukvara som är del av ReactOS är publicerad",
TEXT_NORMAL
},
{
8,
12,
- "under GNU GPL, men ven den ursprungliga",
+ "under GNU GPL, men även den ursprungliga",
TEXT_NORMAL
},
{
8,
13,
- "licensen r upprtthllen.",
+ "licensen är upprätthållen.",
TEXT_NORMAL
},
{
8,
15,
- "Denna mjukvara har INGEN GARANTI eller begrnsing p anvndning",
+ "Denna mjukvara har INGEN GARANTI eller begränsing på användning",
TEXT_NORMAL
},
{
8,
16,
- "bortsett frn tillmplig lokal och internationell lag. Licenseringen av",
+ "bortsett från tillämplig lokal och internationell lag. Licenseringen av",
TEXT_NORMAL
},
{
8,
17,
- "ReactOS tcker endast distrubering till tredje part.",
+ "ReactOS täcker endast distrubering till tredje part.",
TEXT_NORMAL
},
{
8,
18,
- "Om Ni av ngon anledning ej ftt en kopia av",
+ "Om Ni av någon anledning ej fått en kopia av",
TEXT_NORMAL
},
{
8,
19,
- "GNU General Public License med ReactOS, besk",
+ "GNU General Public License med ReactOS, besök",
TEXT_NORMAL
},
{
@@ -312,25 +312,25 @@
{
8,
24,
- "Detta r gratis mjukvara; se kllkoden fr restriktioner angende kopiering.",
+ "Detta är gratis mjukvara; se källkoden för restriktioner angående kopiering.",
TEXT_NORMAL
},
{
8,
25,
- "INGEN GARANTI ges; inte ens fr SLJBARHET eller PASSANDE FR ETT",
+ "INGEN GARANTI ges; inte ens för SÄLJBARHET eller PASSANDE FÖR ETT",
TEXT_NORMAL
},
{
8,
26,
- "SPECIELLT SYFTE. ALL ANVNDNING SKER P EGEN RISK!",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ENTER = tervnd",
+ "SPECIELLT SYFTE. ALL ANVÄNDNING SKER PÅ EGEN RISK!",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Återvänd",
TEXT_STATUS
},
{
@@ -352,7 +352,7 @@
{
6,
8,
- "Listan nedanfr visar instllningarna fr maskinvaran.",
+ "Listan nedanför visar inställningarna för maskinvaran.",
TEXT_NORMAL
},
{
@@ -364,7 +364,7 @@
{
8,
12,
- " Bildskrm:",
+ " Bildskärm:",
TEXT_NORMAL,
},
{
@@ -387,43 +387,43 @@
},
{
25,
- 16, "Acceptera dessa maskinvaruinstllningar",
+ 16, "Acceptera dessa maskinvaruinställningar",
TEXT_NORMAL
},
{
6,
19,
- "ndra instllningarna genom att trycka p UPP- och NED-piltangenterna",
+ "Ändra inställningarna genom att trycka på UPP- och NED-piltangenterna",
TEXT_NORMAL
},
{
6,
20,
- "fr att markera en instllning, och tryck p ENTER fr att vlja",
+ "för att markera en inställning, och tryck på ENTER för att välja",
TEXT_NORMAL
},
{
6,
21,
- "instllningen.",
+ "inställningen.",
TEXT_NORMAL
},
{
6,
23,
- "Nr alla instllningar r korrekta, vlj \"Acceptera dessa maskinvaruinstllningar\"",
+ "När alla inställningar är korrekta, välj \"Acceptera dessa maskinvaruinställningar\"",
TEXT_NORMAL
},
{
6,
24,
- "och tryck p ENTER.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ENTER = Fortstt F3 = Avbryt",
+ "och tryck på ENTER.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Fortsätt F3 = Avbryt",
TEXT_STATUS
},
{
@@ -445,13 +445,13 @@
{
6,
8,
- "ReactOS Setup r i en tidig utvecklingsfas och saknar drfr ett antal",
+ "ReactOS Setup är i en tidig utvecklingsfas och saknar därför ett antal",
TEXT_NORMAL
},
{
6,
9,
- "funktioner som kan frvntas av ett fullt anvndbart setup-program.",
+ "funktioner som kan förväntas av ett fullt användbart setup-program.",
TEXT_NORMAL
},
{
@@ -463,31 +463,31 @@
{
8,
15,
- "\x07 Tryck p U fr att uppdatera ReactOS.",
+ "\x07 Tryck på U för att uppdatera ReactOS.",
TEXT_NORMAL
},
{
8,
17,
- "\x07 Tryck p R fr terstllningskonsolen.",
+ "\x07 Tryck på R för Återställningskonsolen.",
TEXT_NORMAL
},
{
8,
19,
- "\x07 Tryck p ESC fr att tervnda till fregende sida.",
+ "\x07 Tryck på ESC för att återvända till föregående sida.",
TEXT_NORMAL
},
{
8,
21,
- "\x07 Tryck p ENTER fr att starta om datorn.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ESC = G till fregende sida ENTER = Starta om datorn",
+ "\x07 Tryck på ENTER för att starta om datorn.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ESC = Gå till föregående sida ENTER = Starta om datorn",
TEXT_STATUS
},
{
@@ -508,37 +508,37 @@
{
6,
8,
- "ndra vilken typ av dator som ska installeras.",
- TEXT_NORMAL
- },
- {
- 8,
- 10,
- "\x07 Anvnd UPP- och NED-piltangenterna fr att vlja nskad datortyp.",
+ "Ändra vilken typ av dator som ska installeras.",
+ TEXT_NORMAL
+ },
+ {
+ 8,
+ 10,
+ "\x07 Använd UPP- och NED-piltangenterna för att välja önskad datortyp.",
TEXT_NORMAL
},
{
8,
11,
- " Tryck sen p ENTER.",
+ " Tryck sen på ENTER.",
TEXT_NORMAL
},
{
8,
13,
- "\x07 Tryck p ESC fr att tervnda till den fregende sidan utan",
+ "\x07 Tryck på ESC för att återvända till den föregående sidan utan",
TEXT_NORMAL
},
{
8,
14,
- " att ndra datortypen.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ENTER = Fortstt ESC = tervnd F3 = Avbryt",
+ " att ändra datortypen.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Fortsätt ESC = Återvänd F3 = Avbryt",
TEXT_STATUS
},
{
@@ -560,7 +560,7 @@
{
10,
6,
- "Datorn frskrar sig om att all data r lagrad p hrdisken.",
+ "Datorn försäkrar sig om att all data är lagrad på hårdisken.",
TEXT_NORMAL
},
{
@@ -572,7 +572,7 @@
{
10,
9,
- "Nr detta r frdigt kommer datorn att startas om automatiskt.",
+ "När detta är färdigt kommer datorn att startas om automatiskt.",
TEXT_NORMAL
},
{
@@ -600,31 +600,31 @@
{
10,
6,
- "Installationen av ReactOS har inte slutfrts.",
- TEXT_NORMAL
- },
- {
- 10,
- 8,
- "Se till att ingen floppy-disk finns i floppy-lsare A:",
+ "Installationen av ReactOS har inte slutförts.",
+ TEXT_NORMAL
+ },
+ {
+ 10,
+ 8,
+ "Se till att ingen floppy-disk finns i floppy-läsare A:",
TEXT_NORMAL
},
{
10,
9,
- "och tag ur alla skivor frn CD/DVD-lsarna.",
+ "och tag ur alla skivor från CD/DVD-läsarna.",
TEXT_NORMAL
},
{
10,
11,
- "Tryck p ENTER fr att starta om datorn.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " Var god vnta ...",
+ "Tryck på ENTER för att starta om datorn.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " Var god vänta ...",
TEXT_STATUS,
},
{
@@ -646,36 +646,36 @@
{
6,
8,
- "ndra vilken typ av bildskrmsinstllning som ska installeras.",
+ "Ändra vilken typ av bildskärmsinställning som ska installeras.",
TEXT_NORMAL
},
{ 8,
10,
- "\x07 Anvnd UPP- och NED-piltangenterna fr att vlja nskad instllning.",
+ "\x07 Använd UPP- och NED-piltangenterna för att välja önskad inställning.",
TEXT_NORMAL
},
{
8,
11,
- " Tryck sedan p ENTER.",
+ " Tryck sedan på ENTER.",
TEXT_NORMAL
},
{
8,
13,
- "\x07 Tryck p ESC fr att tervnda till den fregende sidan utan",
+ "\x07 Tryck på ESC för att återvända till den föregående sidan utan",
TEXT_NORMAL
},
{
8,
14,
- " att ndra bildskrmsinstllningen.",
- TEXT_NORMAL
- },
- {
- 0,
- 0,
- " ENTER = Fortstt ESC = tervnd F3 = Avbryt",
+ " att ändra bildskärmsinställningen.",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Fortsätt ESC = Återvänd F3 = Avbryt",
TEXT_STATUS
},
{
@@ -697,25 +697,25 @@
{
10,
6,
- "ReactOS har nu installerats p datorn.",
- TEXT_NORMAL
- },
- {
- 10,
- 8,
- "Se till att ingen floppy-disk finns i floppy-lsare A:",
+ "ReactOS har nu installerats på datorn.",
+ TEXT_NORMAL
+ },
+ {
+ 10,
+ 8,
+ "Se till att ingen floppy-disk finns i floppy-läsare A:",
TEXT_NORMAL
},
{
10,
9,
- "och tag ur alla skivor frn CD/DVD-lsarna.",
+ "och tag ur alla skivor från CD/DVD-läsarna.",
TEXT_NORMAL
},
{
10,
11,
- "Tryck p ENTER fr att starta om datorn.",
+ "Tryck på ENTER för att starta om datorn.",
TEXT_NORMAL
},
{
@@ -743,31 +743,31 @@
{
6,
8,
- "Setup misslyckades med att installera bootloadern p datorns",
+ "Setup misslyckades med att installera bootloadern på datorns",
TEXT_NORMAL
},
{
6,
9,
- "hrddisk",
+ "hårddisk",
TEXT_NORMAL
},
{
6,
13,
- "Var god stt in en formatterad floppy-disk i lsare A: och",
+ "Var god sätt in en formatterad floppy-disk i läsare A: och",
TEXT_NORMAL
},
{
6,
14,
- "tryck p ENTER.",
+ "tryck på ENTER.",
TEXT_NORMAL,
},
{
0,
0,
- " ENTER = Fortstt F3 = Avbryt",
+ " ENTER = Fortsätt F3 = Avbryt",
TEXT_STATUS
},
{
Author: fireball
Date: Sun Jan 27 20:38:15 2008
New Revision: 32031
URL: http://svn.reactos.org/svn/reactos?rev=32031&view=rev
Log:
- Finally switch to the new memory manager, which is compatible both with ReactOS and NT-style boot types.
- Added: memory types for each allocation request, ability to alloc and free memory from the heap, ability to use 1 megabyte of low memory too (which was just wasted previously).
- Removed: a bunch of hacky stuff.
Modified:
trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
trunk/reactos/boot/freeldr/freeldr/mm/mm.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/me…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c Sun Jan 27 20:38:15 2008
@@ -1,6 +1,6 @@
/*
* FreeLoader
- * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
+ * Copyright (C) 2006-2008 Aleksey Bragin <aleksey(a)reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,6 +43,9 @@
ULONG FreePagesInLookupTable = 0;
ULONG LastFreePageHint = 0;
+extern ULONG_PTR MmHeapPointer;
+extern ULONG_PTR MmHeapStart;
+
BOOLEAN MmInitializeMemoryManager(VOID)
{
BIOS_MEMORY_MAP BiosMemoryMap[32];
@@ -93,10 +96,56 @@
MmInitPageLookupTable(PageLookupTableAddress, TotalPagesInLookupTable, BiosMemoryMap, BiosMemoryMapEntryCount);
MmUpdateLastFreePageHint(PageLookupTableAddress, TotalPagesInLookupTable);
+ // Add machine-dependent stuff
+ // FIXME: this is only for i386
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x00, 1, LoaderFirmwarePermanent); // realmode int vectors
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x01, 7, LoaderFirmwareTemporary); // freeldr stack + cmdline
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x08, 0x70, LoaderLoadedProgram); // freeldr image (roughly max. 0x64 pages)
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x78, 8, LoaderOsloaderStack); // prot mode stack. BIOSCALLBUFFER
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x80, 0x10, LoaderOsloaderHeap); // File system read buffer. FILESYSBUFFER
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x90, 0x10, LoaderOsloaderHeap); // Disk read buffer for int 13h. DISKREADBUFFER
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0xA0, 0x60, LoaderFirmwarePermanent); // ROM / Video
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0xFFF, 1, LoaderSpecialMemory); // unusable memory
+
+ // This one is strange, without it WinNT crashes with PHASE0_EXCEPTION
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x59, 0x5, LoaderFirmwarePermanent);
+
FreePagesInLookupTable = MmCountFreePagesInLookupTable(PageLookupTableAddress, TotalPagesInLookupTable);
+
+ MmInitializeHeap(PageLookupTableAddress);
DbgPrint((DPRINT_MEMORY, "Memory Manager initialized. %d pages available.\n", FreePagesInLookupTable));
return TRUE;
+}
+
+VOID MmInitializeHeap(PVOID PageLookupTable)
+{
+ ULONG PagesNeeded;
+ ULONG HeapStart;
+
+ // HACK: Make it so it doesn't overlap kernel space
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderSystemCode);
+
+ // Find contigious memory block for HEAP:STACK
+ PagesNeeded = HEAP_PAGES + STACK_PAGES;
+ HeapStart = MmFindAvailablePages(PageLookupTable, TotalPagesInLookupTable, PagesNeeded, FALSE);
+
+ // Unapply the hack
+ MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderFree);
+
+ if (HeapStart == 0)
+ {
+ UiMessageBox("Critical error: Can't allocate heap!");
+ return;
+ }
+
+ // Initialize BGET
+ bpool(HeapStart << MM_PAGE_SHIFT, PagesNeeded << MM_PAGE_SHIFT);
+
+ // Mark those pages as used
+ MmMarkPagesInLookupTable(PageLookupTableAddress, HeapStart, PagesNeeded, LoaderOsloaderHeap);
+
+ DbgPrint((DPRINT_MEMORY, "Heap initialized, base 0x%08x, pages %d\n", (HeapStart << MM_PAGE_SHIFT), PagesNeeded));
}
#ifdef DBG
@@ -188,13 +237,21 @@
RtlCopyMemory(TempBiosMemoryMap, BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32);
MmSortBiosMemoryMap(TempBiosMemoryMap, MapCount);
+ // Find a place, starting from the highest memory
+ // (thus leaving low memory for kernel/drivers)
for (Index=(MapCount-1); Index>=0; Index--)
{
// If this is usable memory with a big enough length
// then we'll put our page lookup table here
- if (TempBiosMemoryMap[Index].Type == BiosMemoryUsable && TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
- {
- PageLookupTableMemAddress = (PVOID)(ULONG)(TempBiosMemoryMap[Index].BaseAddress + (TempBiosMemoryMap[Index].Length - PageLookupTableSize));
+
+ // skip if this is not usable region
+ if (TempBiosMemoryMap[Index].Type != BiosMemoryUsable)
+ continue;
+
+ if (TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
+ {
+ PageLookupTableMemAddress = (PVOID)(ULONG)
+ (TempBiosMemoryMap[Index].BaseAddress + (TempBiosMemoryMap[Index].Length - PageLookupTableSize));
break;
}
}
@@ -241,7 +298,7 @@
// Mark every page as allocated initially
// We will go through and mark pages again according to the memory map
// But this will mark any holes not described in the map as allocated
- MmMarkPagesInLookupTable(PageLookupTable, 0, TotalPageCount, 1);
+ MmMarkPagesInLookupTable(PageLookupTable, 0, TotalPageCount, LoaderFirmwarePermanent);
for (Index=0; Index<MapCount; Index++)
{
@@ -254,8 +311,9 @@
}
// Mark the low memory region below 1MB as reserved (256 pages in region)
- DbgPrint((DPRINT_MEMORY, "Marking the low 1MB region as reserved.\n"));
- MmMarkPagesInLookupTable(PageLookupTable, 0, 256, LoaderFirmwarePermanent);
+ //FIXME: Not needed now since we mark low 1Mb with really used and free areas
+ //DbgPrint((DPRINT_MEMORY, "Marking the low 1MB region as reserved.\n"));
+ //MmMarkPagesInLookupTable(PageLookupTable, 0, 256, LoaderFirmwarePermanent);
// Mark the pages that the lookup table occupies as reserved
PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
@@ -271,10 +329,12 @@
for (Index=StartPage; Index<(StartPage+PageCount); Index++)
{
+#if 0
if ((Index <= (StartPage + 16)) || (Index >= (StartPage+PageCount-16)))
{
DbgPrint((DPRINT_MEMORY, "Index = %d StartPage = %d PageCount = %d\n", Index, StartPage, PageCount));
}
+#endif
RealPageLookupTable[Index].PageAllocated = PageAllocated;
RealPageLookupTable[Index].PageAllocationLength = (PageAllocated != LoaderFree) ? 1 : 0;
}
@@ -288,7 +348,7 @@
for (Index=StartPage; Index<(StartPage+PageCount); Index++)
{
- RealPageLookupTable[Index].PageAllocated = LoaderSystemCode;
+ RealPageLookupTable[Index].PageAllocated = MemoryType;
RealPageLookupTable[Index].PageAllocationLength = (Index == StartPage) ? PageCount : 0;
}
}
@@ -326,7 +386,8 @@
if (FromEnd)
{
/* Allocate "high" (from end) pages */
- for (Index=LastFreePageHint-1; Index>0; Index--)
+ for (Index=/*LastFreePageHint-1*/LOADER_HIGH_ZONE-1; Index>0; Index--)
+ //for (Index=LastFreePageHint-1; Index>0; Index--)
{
if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
{
Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mm…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c Sun Jan 27 20:38:15 2008
@@ -1,6 +1,6 @@
/*
* FreeLoader
- * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
+ * Copyright (C) 2006-2008 Aleksey Bragin <aleksey(a)reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,35 +20,10 @@
#include <freeldr.h>
#include <debug.h>
-ULONG AllocationCount = 0;
-
-#ifdef DBG
-VOID VerifyHeap(VOID);
+#ifdef DBG
VOID DumpMemoryAllocMap(VOID);
-VOID IncrementAllocationCount(VOID);
-VOID DecrementAllocationCount(VOID);
VOID MemAllocTest(VOID);
#endif // DBG
-
-/*
- * Hack alert
- * Normally, we allocate whole pages. This is ofcourse wastefull for small
- * allocations (a few bytes). So, for small allocations (smaller than a page)
- * we sub-allocate. When the first small allocation is done, a page is
- * requested. We keep a pointer to that page in SubAllocationPage. The alloc
- * is satisfied by returning a pointer to the beginning of the page. We also
- * keep track of how many bytes are still available in the page in SubAllocationRest.
- * When the next small request comes in, we try to allocate it just after the
- * memory previously allocated. If it won't fit, we allocate a new page and
- * the whole process starts again.
- * Note that suballocations are done back-to-back, there's no bookkeeping at all.
- * That also means that we cannot really free suballocations. So, when a free is
- * done and it is determined that this might be a free of a sub-allocation, we
- * just no-op the free.
- * Perhaps we should use the heap routines from ntdll here.
- */
-static PVOID SubAllocationPage = NULL;
-static unsigned SubAllocationRest = 0;
BOOLEAN AllocateFromEnd = TRUE;
@@ -71,12 +46,6 @@
}
MemorySize = ROUND_UP(MemorySize, 4);
- if (MemorySize <= SubAllocationRest)
- {
- MemPointer = (PVOID)((ULONG_PTR)SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest);
- SubAllocationRest -= MemorySize;
- return MemPointer;
- }
// Find out how many blocks it will take to
// satisfy this allocation
@@ -86,7 +55,7 @@
// then return NULL
if (FreePagesInLookupTable < PagesNeeded)
{
- DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes. AllocationCount: %d\n", MemorySize, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize));
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@@ -95,7 +64,7 @@
if (FirstFreePageFromEnd == (ULONG)-1)
{
- DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes. AllocationCount: %d\n", MemorySize, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize));
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@@ -105,22 +74,47 @@
FreePagesInLookupTable -= PagesNeeded;
MemPointer = (PVOID)(FirstFreePageFromEnd * MM_PAGE_SIZE);
- if (MemorySize < MM_PAGE_SIZE)
- {
- SubAllocationPage = MemPointer;
- SubAllocationRest = MM_PAGE_SIZE - MemorySize;
- }
-
-
-#ifdef DBG
- IncrementAllocationCount();
- DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d. AllocCount: %d\n", MemorySize, PagesNeeded, FirstFreePageFromEnd, AllocationCount));
+#ifdef DBG
+ DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
//VerifyHeap();
#endif // DBG
// Now return the pointer
return MemPointer;
+}
+
+PVOID MmHeapAlloc(ULONG MemorySize)
+{
+ PVOID Result;
+ LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels;
+
+ if (MemorySize > MM_PAGE_SIZE)
+ {
+ DbgPrint((DPRINT_MEMORY, "Consider using other functions to allocate %d bytes of memory!\n", MemorySize));
+ }
+
+ // Get the buffer from BGET pool
+ Result = bget(MemorySize);
+
+ if (Result == NULL)
+ {
+ DbgPrint((DPRINT_MEMORY, "Heap allocation for %d bytes failed\n", MemorySize));
+ }
+
+ // Gather some stats
+ bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels);
+
+ DbgPrint((DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n",
+ CurAlloc, TotalFree, NumberOfGets, NumberOfRels));
+
+ return Result;
+}
+
+VOID MmHeapFree(PVOID MemoryPointer)
+{
+ // Release the buffer to the pool
+ brel(MemoryPointer);
}
PVOID MmAllocateMemory(ULONG MemorySize)
@@ -155,7 +149,7 @@
{
DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemoryAtAddress(). "
"Not enough free memory to allocate %d bytes (requesting %d pages but have only %d). "
- "AllocationCount: %d\n", MemorySize, PagesNeeded, FreePagesInLookupTable, AllocationCount));
+ "\n", MemorySize, PagesNeeded, FreePagesInLookupTable));
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@@ -163,8 +157,8 @@
if (MmAreMemoryPagesAvailable(PageLookupTableAddress, TotalPagesInLookupTable, DesiredAddress, PagesNeeded) == FALSE)
{
DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemoryAtAddress(). "
- "Not enough free memory to allocate %d bytes at address %p. AllocationCount: %d\n",
- MemorySize, DesiredAddress, AllocationCount));
+ "Not enough free memory to allocate %d bytes at address %p.\n",
+ MemorySize, DesiredAddress));
// Don't tell this to user since caller should try to alloc this memory
// at a different address
@@ -178,8 +172,7 @@
MemPointer = (PVOID)(StartPageNumber * MM_PAGE_SIZE);
#ifdef DBG
- IncrementAllocationCount();
- DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d. AllocCount: %d\n", MemorySize, PagesNeeded, StartPageNumber, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, StartPageNumber));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
//VerifyHeap();
#endif // DBG
@@ -213,7 +206,7 @@
// then return NULL
if (FreePagesInLookupTable < PagesNeeded)
{
- DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes. AllocationCount: %d\n", MemorySize, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize));
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@@ -222,7 +215,7 @@
if (FirstFreePageFromEnd == 0)
{
- DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes. AllocationCount: %d\n", MemorySize, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize));
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@@ -233,8 +226,7 @@
MemPointer = (PVOID)(FirstFreePageFromEnd * MM_PAGE_SIZE);
#ifdef DBG
- IncrementAllocationCount();
- DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d. AllocCount: %d\n", MemorySize, PagesNeeded, FirstFreePageFromEnd, AllocationCount));
+ DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
//VerifyHeap();
#endif // DBG
@@ -245,141 +237,9 @@
VOID MmFreeMemory(PVOID MemoryPointer)
{
- ULONG PageNumber;
- ULONG PageCount;
- ULONG Idx;
- PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
-
-#ifdef DBG
-
- // Make sure we didn't get a bogus pointer
- if (MemoryPointer >= (PVOID)(TotalPagesInLookupTable * MM_PAGE_SIZE))
- {
- BugCheck((DPRINT_MEMORY, "Bogus memory pointer (0x%x) passed to MmFreeMemory()\n", MemoryPointer));
- }
-#endif // DBG
-
- // Find out the page number of the first
- // page of memory they allocated
- PageNumber = MmGetPageNumberFromAddress(MemoryPointer);
- PageCount = RealPageLookupTable[PageNumber].PageAllocationLength;
-
-#ifdef DBG
- // Make sure we didn't get a bogus pointer
- if ((PageCount < 1) || (PageCount > (TotalPagesInLookupTable - PageNumber)))
- {
- BugCheck((DPRINT_MEMORY, "Invalid page count in lookup table. PageLookupTable[%d].PageAllocationLength = %d\n", PageNumber, RealPageLookupTable[PageNumber].PageAllocationLength));
- }
-
- // Loop through our array check all the pages
- // to make sure they are allocated with a length of 0
- for (Idx=PageNumber+1; Idx<(PageNumber + PageCount); Idx++)
- {
- if ((RealPageLookupTable[Idx].PageAllocated == LoaderFree) ||
- (RealPageLookupTable[Idx].PageAllocationLength != 0))
- {
- BugCheck((DPRINT_MEMORY, "Invalid page entry in lookup table, PageAllocated should = 1 and PageAllocationLength should = 0 because this is not the first block in the run. PageLookupTable[%d].PageAllocated = %d PageLookupTable[%d].PageAllocationLength = %d\n", PageNumber, RealPageLookupTable[PageNumber].PageAllocated, PageNumber, RealPageLookupTable[PageNumber].PageAllocationLength));
- }
- }
-
-#endif
-
- /* If this allocation is only a single page, it could be a sub-allocated page.
- * Just don't free it */
- if (1 == PageCount)
- {
- return;
- }
-
- // Loop through our array and mark all the
- // blocks as free
- for (Idx=PageNumber; Idx<(PageNumber + PageCount); Idx++)
- {
- RealPageLookupTable[Idx].PageAllocated = LoaderFree;
- RealPageLookupTable[Idx].PageAllocationLength = 0;
- }
-
- FreePagesInLookupTable += PageCount;
-
-#ifdef DBG
- DecrementAllocationCount();
- DbgPrint((DPRINT_MEMORY, "Freed %d pages of memory starting at page %d. AllocationCount: %d\n", PageCount, PageNumber, AllocationCount));
- //VerifyHeap();
-#endif // DBG
-}
-
-PVOID MmHeapAlloc(ULONG MemorySize)
-{
- // Temporary forwarder...
- return MmAllocateMemoryWithType(MemorySize, LoaderOsloaderHeap);
-}
-
-VOID MmHeapFree(PVOID MemoryPointer)
-{
- // Stub for WinLdr
-}
-
-
-#ifdef DBG
-VOID VerifyHeap(VOID)
-{
- ULONG Idx;
- ULONG Idx2;
- ULONG Count;
- PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
-
- if (DUMP_MEM_MAP_ON_VERIFY)
- {
- DumpMemoryAllocMap();
- }
-
- // Loop through the array and verify that
- // everything is kosher
- for (Idx=0; Idx<TotalPagesInLookupTable; Idx++)
- {
- // Check if this block is allocated
- if (RealPageLookupTable[Idx].PageAllocated != LoaderFree)
- {
- // This is the first block in the run so it
- // had better have a length that is within range
- if ((RealPageLookupTable[Idx].PageAllocationLength < 1) || (RealPageLookupTable[Idx].PageAllocationLength > (TotalPagesInLookupTable - Idx)))
- {
- BugCheck((DPRINT_MEMORY, "Allocation length out of range in heap table. PageLookupTable[Idx].PageAllocationLength = %d\n", RealPageLookupTable[Idx].PageAllocationLength));
- }
-
- // Now go through and verify that the rest of
- // this run has the blocks marked allocated
- // with a length of zero but don't check the
- // first one because we already did
- Count = RealPageLookupTable[Idx].PageAllocationLength;
- for (Idx2=1; Idx2<Count; Idx2++)
- {
- // Make sure it's allocated
- if (RealPageLookupTable[Idx + Idx2].PageAllocated == LoaderFree)
- {
- BugCheck((DPRINT_MEMORY, "Lookup table indicates hole in memory allocation. RealPageLookupTable[Idx + Idx2].PageAllocated == 0\n"));
- }
-
- // Make sure the length is zero
- if (RealPageLookupTable[Idx + Idx2].PageAllocationLength != 0)
- {
- BugCheck((DPRINT_MEMORY, "Allocation chain has non-zero value in non-first block in lookup table. RealPageLookupTable[Idx + Idx2].PageAllocationLength != 0\n"));
- }
- }
-
- // Move on to the next run
- Idx += (Count - 1);
- }
- else
- {
- // Nope, not allocated so make sure the length is zero
- if (RealPageLookupTable[Idx].PageAllocationLength != 0)
- {
- BugCheck((DPRINT_MEMORY, "Free block is start of memory allocation. RealPageLookupTable[Idx].PageAllocationLength != 0\n"));
- }
- }
- }
-}
+}
+
+#ifdef DBG
VOID DumpMemoryAllocMap(VOID)
{
@@ -393,7 +253,7 @@
if ((Idx % 32) == 0)
{
DbgPrint((DPRINT_MEMORY, "\n"));
- DbgPrint((DPRINT_MEMORY, "%x:\t", (Idx * MM_PAGE_SIZE)));
+ DbgPrint((DPRINT_MEMORY, "%08x:\t", (Idx * MM_PAGE_SIZE)));
}
else if ((Idx % 4) == 0)
{
@@ -455,47 +315,6 @@
DbgPrint((DPRINT_MEMORY, "\n"));
}
-
-VOID IncrementAllocationCount(VOID)
-{
- AllocationCount++;
-}
-
-VOID DecrementAllocationCount(VOID)
-{
- AllocationCount--;
-}
-
-VOID MemAllocTest(VOID)
-{
- PVOID MemPtr1;
- PVOID MemPtr2;
- PVOID MemPtr3;
- PVOID MemPtr4;
- PVOID MemPtr5;
-
- MemPtr1 = MmAllocateMemory(4096);
- printf("MemPtr1: 0x%x\n", (int)MemPtr1);
- MachConsGetCh();
- MemPtr2 = MmAllocateMemory(4096);
- printf("MemPtr2: 0x%x\n", (int)MemPtr2);
- MachConsGetCh();
- MemPtr3 = MmAllocateMemory(4096);
- printf("MemPtr3: 0x%x\n", (int)MemPtr3);
- DumpMemoryAllocMap();
- VerifyHeap();
- MachConsGetCh();
-
- MmFreeMemory(MemPtr2);
- MachConsGetCh();
-
- MemPtr4 = MmAllocateMemory(2048);
- printf("MemPtr4: 0x%x\n", (int)MemPtr4);
- MachConsGetCh();
- MemPtr5 = MmAllocateMemory(4096);
- printf("MemPtr5: 0x%x\n", (int)MemPtr5);
- MachConsGetCh();
-}
#endif // DBG
ULONG GetSystemMemorySize(VOID)
Author: pschweitzer
Date: Sun Jan 27 16:51:48 2008
New Revision: 32027
URL: http://svn.reactos.org/svn/reactos?rev=32027&view=rev
Log:
Get back DO_DIRECT_IO flag that has been removed in r31747
Modified:
trunk/reactos/drivers/filesystems/ntfs/ntfs.c
Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.c (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.c Sun Jan 27 16:51:48 2008
@@ -89,6 +89,8 @@
WARN_(NTFS, "IoCreateDevice failed with status: %lx\n", Status);
goto ErrorEnd;
}
+
+ NtfsGlobalData->DeviceObject->Flags |= DO_DIRECT_IO;
/* Register file system */
IoRegisterFileSystem(NtfsGlobalData->DeviceObject);