ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2006
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
357 discussions
Start a n
N
ew thread
[ion] 24363: - Combine SeInit1 and SeInit2 into SeInit since both can be done together now. - Call PsInitSystem instead of PspInitPhase0, since PsInitsystem is the "external" phase-choosing routine. - Implement ExComputeTickCountMultiplier to create a 24-bit precision remainder + whole integer of the ms/clock tick used in SharedUserData. - Set the OS version and Machine Type (i386/PPC (<3 Arty) in SharedUserData. - Move some HAL calls in Phase 2 (actually Phase 1...), same for KeInit2. - Break i
by ion@svn.reactos.org
Author: ion Date: Mon Oct 2 19:52:58 2006 New Revision: 24363 URL:
http://svn.reactos.org/svn/reactos?rev=24363&view=rev
Log: - Combine SeInit1 and SeInit2 into SeInit since both can be done together now. - Call PsInitSystem instead of PspInitPhase0, since PsInitsystem is the "external" phase-choosing routine. - Implement ExComputeTickCountMultiplier to create a 24-bit precision remainder + whole integer of the ms/clock tick used in SharedUserData. - Set the OS version and Machine Type (i386/PPC (<3 Arty) in SharedUserData. - Move some HAL calls in Phase 2 (actually Phase 1...), same for KeInit2. - Break into KDBG a bit earlier. Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/ex/time.c trunk/reactos/ntoskrnl/include/internal/ex.h trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h trunk/reactos/ntoskrnl/include/internal/ps.h trunk/reactos/ntoskrnl/include/internal/se.h trunk/reactos/ntoskrnl/ps/psmgr.c trunk/reactos/ntoskrnl/se/semgr.c Modified: trunk/reactos/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Mon Oct 2 19:52:58 2006 @@ -367,6 +367,38 @@ ExpInitUuids(); } +ULONG +NTAPI +ExComputeTickCountMultiplier(IN ULONG ClockIncrement) +{ + ULONG MsRemainder = 0, MsIncrement; + ULONG IncrementRemainder; + ULONG i; + + /* Count the number of milliseconds for each clock interrupt */ + MsIncrement = ClockIncrement / (10 * 1000); + + /* Count the remainder from the division above, with 24-bit precision */ + IncrementRemainder = ClockIncrement - (MsIncrement * (10 * 1000)); + for (i= 0; i < 24; i++) + { + /* Shift the remainders */ + MsRemainder <<= 1; + IncrementRemainder <<= 1; + + /* Check if we've went past 1 ms */ + if (IncrementRemainder >= (10 * 1000)) + { + /* Increase the remainder by one, and substract from increment */ + IncrementRemainder -= (10 * 1000); + MsRemainder |= 1; + } + } + + /* Return the increment */ + return (MsIncrement << 24) | MsRemainder; +} + BOOLEAN NTAPI ExpInitSystemPhase0(VOID) @@ -574,11 +606,11 @@ /* Setup system time */ KiInitializeSystemClock(); - /* Initialize the second stage of the kernel */ - KeInit2(); - /* Initialize the executive at phase 0 */ if (!ExInitSystem()) KEBUGCHECK(PHASE0_INITIALIZATION_FAILED); + + /* Break into the Debugger if requested */ + if (KdPollBreakIn()) DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C); /* Set system ranges */ SharedUserData->Reserved1 = (ULONG_PTR)MmHighestUserAddress; @@ -611,10 +643,7 @@ */ ExpNlsTableSize += 2 * PAGE_SIZE; // BIAS FOR FREELDR. HACK! - /* - * Allocate the table in pool memory, so we can stop depending on the - * memory given to use by the loader, which is freed later. - */ + /* Allocate the NLS buffer in the pool since loader memory will be freed */ ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool, ExpNlsTableSize, TAG('R', 't', 'l', 'i')); @@ -661,8 +690,7 @@ if (!ObInit()) KEBUGCHECK(OBJECT_INITIALIZATION_FAILED); /* Load basic Security for other Managers */ - if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED); - if (!SeInit2()) KEBUGCHECK(SECURITY1_INITIALIZATION_FAILED); + if (!SeInit()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED); /* Set up Region Maps, Sections and the Paging File */ MmInit2(); @@ -671,16 +699,26 @@ if (!ObInit()) KEBUGCHECK(OBJECT_INITIALIZATION_FAILED); /* Initialize the Process Manager */ - PspInitPhase0(); - - /* Break into the Debugger if requested */ - if (KdPollBreakIn()) DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); - - /* Initialize all processors */ - HalAllProcessorsStarted(); - - /* Do Phase 1 HAL Initialization */ - HalInitSystem(1, KeLoaderBlock); + if (!PsInitSystem()) KEBUGCHECK(PROCESS_INITIALIZATION_FAILED); + + /* Calculate the tick count multiplier */ + ExpTickCountMultiplier = ExComputeTickCountMultiplier(KeMaximumIncrement); + SharedUserData->TickCountMultiplier = ExpTickCountMultiplier; + + /* Set the OS Version */ + SharedUserData->NtMajorVersion = NtMajorVersion; + SharedUserData->NtMinorVersion = NtMinorVersion; + + /* Set the machine type */ +#if defined(_X86_) + SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_I386; + SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_I386; +#elif defined(_PPC_) // <3 Arty + SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_POWERPC; + SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_POWERPC; +#elif +#error "Unsupported ReactOS Target" +#endif } VOID @@ -697,6 +735,15 @@ /* Set us at maximum priority */ KeSetPriorityThread(KeGetCurrentThread(), HIGH_PRIORITY); + + /* Initialize the second stage of the kernel */ + KeInit2(); + + /* Initialize all processors */ + HalAllProcessorsStarted(); + + /* Do Phase 1 HAL Initialization */ + HalInitSystem(1, KeLoaderBlock); /* Initialize Basic System Objects and Worker Threads */ ExInit3(); Modified: trunk/reactos/ntoskrnl/ex/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/time.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/ex/time.c (original) +++ trunk/reactos/ntoskrnl/ex/time.c Mon Oct 2 19:52:58 2006 @@ -25,6 +25,7 @@ TIME_ZONE_INFORMATION ExpTimeZoneInfo; LARGE_INTEGER ExpTimeZoneBias; ULONG ExpTimeZoneId; +ULONG ExpTickCountMultiplier; /* FUNCTIONS ****************************************************************/ Modified: trunk/reactos/ntoskrnl/include/internal/ex.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ex.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ex.h Mon Oct 2 19:52:58 2006 @@ -6,6 +6,7 @@ extern TIME_ZONE_INFORMATION ExpTimeZoneInfo; extern LARGE_INTEGER ExpTimeZoneBias; extern ULONG ExpTimeZoneId; +extern ULONG ExpTickCountMultiplier; extern POBJECT_TYPE ExEventPairObjectType; extern ULONG NtBuildNumber; extern ULONG NtMajorVersion; Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Mon Oct 2 19:52:58 2006 @@ -64,7 +64,6 @@ VOID IoInit2(BOOLEAN BootLog); VOID NTAPI IoInit3(VOID); BOOLEAN NTAPI ObInit(VOID); -VOID PsInit(VOID); VOID CmInitializeRegistry(VOID); VOID NTAPI CmInitHives(BOOLEAN SetupBoot); VOID CmInit2(PCHAR CommandLine); Modified: trunk/reactos/ntoskrnl/include/internal/ps.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ps.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ps.h Mon Oct 2 19:52:58 2006 @@ -81,7 +81,7 @@ BOOLEAN NTAPI -PspInitPhase0( +PsInitSystem( VOID ); Modified: trunk/reactos/ntoskrnl/include/internal/se.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/se.h (original) +++ trunk/reactos/ntoskrnl/include/internal/se.h Mon Oct 2 19:52:58 2006 @@ -86,11 +86,7 @@ /* Functions */ BOOLEAN NTAPI -SeInit1(VOID); - -BOOLEAN -NTAPI -SeInit2(VOID); +SeInit(VOID); BOOLEAN NTAPI Modified: trunk/reactos/ntoskrnl/ps/psmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=24…
============================================================================== --- trunk/reactos/ntoskrnl/ps/psmgr.c (original) +++ trunk/reactos/ntoskrnl/ps/psmgr.c Mon Oct 2 19:52:58 2006 @@ -397,6 +397,14 @@ return TRUE; } +BOOLEAN +NTAPI +PsInitSystem(VOID) +{ + /* For now, do only Phase 0 */ + return PspInitPhase0(); +} + /* PUBLIC FUNCTIONS **********************************************************/ /* Modified: trunk/reactos/ntoskrnl/se/semgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/semgr.c?rev=24…
============================================================================== --- trunk/reactos/ntoskrnl/se/semgr.c (original) +++ trunk/reactos/ntoskrnl/se/semgr.c Mon Oct 2 19:52:58 2006 @@ -27,8 +27,7 @@ static BOOLEAN SepInitExports(VOID); #if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, SeInit1) -#pragma alloc_text(INIT, SeInit2) +#pragma alloc_text(INIT, SeInit) #pragma alloc_text(INIT, SepInitExports) #endif @@ -37,7 +36,7 @@ BOOLEAN INIT_FUNCTION NTAPI -SeInit1(VOID) +SeInit(VOID) { SepInitLuid(); @@ -58,29 +57,19 @@ /* Initialize the subject context lock */ ExInitializeResource(&SepSubjectContextLock); + /* Initialize token objects */ + SepInitializeTokenImplementation(); + + /* Clear impersonation info for the idle thread */ + PsGetCurrentThread()->ImpersonationInfo = NULL; + PspClearCrossThreadFlag(PsGetCurrentThread(), CT_ACTIVE_IMPERSONATION_INFO_BIT); + + /* Initailize the boot token */ + ObInitializeFastReference(&PsGetCurrentProcess()->Token, NULL); + ObInitializeFastReference(&PsGetCurrentProcess()->Token, + SepCreateSystemProcessToken()); return TRUE; } - - -BOOLEAN -INIT_FUNCTION -NTAPI -SeInit2(VOID) -{ - /* Initialize token objects */ - SepInitializeTokenImplementation(); - - /* Clear impersonation info for the idle thread */ - PsGetCurrentThread()->ImpersonationInfo = NULL; - PspClearCrossThreadFlag(PsGetCurrentThread(), CT_ACTIVE_IMPERSONATION_INFO_BIT); - - /* Initailize the boot token */ - ObInitializeFastReference(&PsGetCurrentProcess()->Token, NULL); - ObInitializeFastReference(&PsGetCurrentProcess()->Token, - SepCreateSystemProcessToken()); - return TRUE; -} - BOOLEAN NTAPI
18 years, 2 months
1
0
0
0
[ion] 24362: - Setup memory limits in shared user data. - Loop security descriptors to find NLS data and make a copy of it in kernel pool, because the NLS buffer from NTLDR will be freed on NT. Also discovered a bug in Freeldr where it doesn't allocate ths NLS files sequentially, leaving a hole of 0x1000 between them. Added a hack to compensate (won't break NTLDR booting, just will waste 8KB of memory). - Allocate the system call count table on checked builds. - Refactor Ob/Se booting to match m
by ion@svn.reactos.org
Author: ion Date: Mon Oct 2 19:05:03 2006 New Revision: 24362 URL:
http://svn.reactos.org/svn/reactos?rev=24362&view=rev
Log: - Setup memory limits in shared user data. - Loop security descriptors to find NLS data and make a copy of it in kernel pool, because the NLS buffer from NTLDR will be freed on NT. Also discovered a bug in Freeldr where it doesn't allocate ths NLS files sequentially, leaving a hole of 0x1000 between them. Added a hack to compensate (won't break NTLDR booting, just will waste 8KB of memory). - Allocate the system call count table on checked builds. - Refactor Ob/Se booting to match more closely NT, and so that we can do Se initialization in one shot. Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h trunk/reactos/ntoskrnl/ke/krnlinit.c trunk/reactos/ntoskrnl/ob/obinit.c Modified: trunk/reactos/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Mon Oct 2 19:05:03 2006 @@ -25,10 +25,9 @@ ULONG NtGlobalFlag; ULONG ExSuiteMask; -extern ULONG MmCoreDumpType; extern LOADER_MODULE KeLoaderModules[64]; extern ULONG KeLoaderModuleCount; -extern PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; +extern ULONG KiServiceLimit; BOOLEAN NoGuiBoot = FALSE; /* Init flags and settings */ @@ -45,6 +44,7 @@ ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset; ULONG ExpUnicodeCaseTableDataOffset; NLSTABLEINFO ExpNlsTableInfo; +ULONG ExpNlsTableSize; /* FUNCTIONS ****************************************************************/ @@ -456,6 +456,8 @@ CHAR Buffer[256]; ANSI_STRING AnsiPath; NTSTATUS Status; + PLIST_ENTRY NextEntry, ListHead; + PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; /* FIXME: Deprecate soon */ ParseAndCacheLoadedModules(); @@ -578,22 +580,97 @@ /* Initialize the executive at phase 0 */ if (!ExInitSystem()) KEBUGCHECK(PHASE0_INITIALIZATION_FAILED); + /* Set system ranges */ + SharedUserData->Reserved1 = (ULONG_PTR)MmHighestUserAddress; + SharedUserData->Reserved3 = (ULONG_PTR)MmSystemRangeStart; + + /* Loop the memory descriptors */ + ListHead = &LoaderBlock->MemoryDescriptorListHead; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the current block */ + MdBlock = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Check if this is an NLS block */ + if (MdBlock->MemoryType == LoaderNlsData) + { + /* Increase the table size */ + ExpNlsTableSize += MdBlock->PageCount * PAGE_SIZE; + } + + /* Go to the next block */ + NextEntry = MdBlock->ListEntry.Flink; + } + + /* + * In NT, the memory blocks are contiguous, but in ReactOS they are not, + * so unless someone fixes FreeLdr, we'll have to use this icky hack. + */ + ExpNlsTableSize += 2 * PAGE_SIZE; // BIAS FOR FREELDR. HACK! + + /* + * Allocate the table in pool memory, so we can stop depending on the + * memory given to use by the loader, which is freed later. + */ + ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool, + ExpNlsTableSize, + TAG('R', 't', 'l', 'i')); + if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED); + + /* Copy the codepage data in its new location. */ + RtlMoveMemory(ExpNlsTableBase, + LoaderBlock->NlsData->AnsiCodePageData, + ExpNlsTableSize); + + /* Initialize and reset the NLS TAbles */ + RtlInitNlsTables((PVOID)((ULONG_PTR)ExpNlsTableBase + + ExpAnsiCodePageDataOffset), + (PVOID)((ULONG_PTR)ExpNlsTableBase + + ExpOemCodePageDataOffset), + (PVOID)((ULONG_PTR)ExpNlsTableBase + + ExpUnicodeCaseTableDataOffset), + &ExpNlsTableInfo); + RtlResetRtlTranslations(&ExpNlsTableInfo); + + /* Initialize the Handle Table */ + ExpInitializeHandleTables(); + +#if DBG + /* On checked builds, allocate the system call count table */ + KeServiceDescriptorTable[0].Count = + ExAllocatePoolWithTag(NonPagedPool, + KiServiceLimit * sizeof(ULONG), + TAG('C', 'a', 'l', 'l')); + + /* Use it for the shadow table too */ + KeServiceDescriptorTableShadow[0].Count = KeServiceDescriptorTable[0].Count; + + /* Make sure allocation succeeded */ + if (KeServiceDescriptorTable[0].Count) + { + /* Zero the call counts to 0 */ + RtlZeroMemory(KeServiceDescriptorTable[0].Count, + KiServiceLimit * sizeof(ULONG)); + } +#endif + + /* Create the Basic Object Manager Types to allow new Object Types */ + if (!ObInit()) KEBUGCHECK(OBJECT_INITIALIZATION_FAILED); + /* Load basic Security for other Managers */ if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED); - - /* Initialize the Handle Table */ - ExpInitializeHandleTables(); - - /* Create the Basic Object Manager Types to allow new Object Types */ - ObInit(); + if (!SeInit2()) KEBUGCHECK(SECURITY1_INITIALIZATION_FAILED); /* Set up Region Maps, Sections and the Paging File */ MmInit2(); - /* Initialize Tokens now that the Object Manager is ready */ - if (!SeInit2()) KEBUGCHECK(SECURITY1_INITIALIZATION_FAILED); - - /* Initalize the Process Manager */ + /* Call OB initialization again */ + if (!ObInit()) KEBUGCHECK(OBJECT_INITIALIZATION_FAILED); + + /* Initialize the Process Manager */ PspInitPhase0(); /* Break into the Debugger if requested */ @@ -602,7 +679,7 @@ /* Initialize all processors */ HalAllProcessorsStarted(); - /* Do Phase 1 HAL Initalization */ + /* Do Phase 1 HAL Initialization */ HalInitSystem(1, KeLoaderBlock); } Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Mon Oct 2 19:05:03 2006 @@ -63,7 +63,7 @@ VOID IoInit(VOID); VOID IoInit2(BOOLEAN BootLog); VOID NTAPI IoInit3(VOID); -VOID ObInit(VOID); +BOOLEAN NTAPI ObInit(VOID); VOID PsInit(VOID); VOID CmInitializeRegistry(VOID); VOID NTAPI CmInitHives(BOOLEAN SetupBoot); Modified: trunk/reactos/ntoskrnl/ke/krnlinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/krnlinit.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/krnlinit.c (original) +++ trunk/reactos/ntoskrnl/ke/krnlinit.c Mon Oct 2 19:05:03 2006 @@ -14,6 +14,9 @@ #include <internal/napi.h> /* GLOBALS *******************************************************************/ + +/* System call count */ +ULONG KiServiceLimit = NUMBER_OF_SYSCALLS; /* ARC Loader Block */ PLOADER_PARAMETER_BLOCK KeLoaderBlock; @@ -96,7 +99,7 @@ /* Initialize the syscall table */ KeServiceDescriptorTable[0].Base = MainSSDT; KeServiceDescriptorTable[0].Count = NULL; - KeServiceDescriptorTable[0].Limit = NUMBER_OF_SYSCALLS; + KeServiceDescriptorTable[0].Limit = KiServiceLimit; KeServiceDescriptorTable[1].Limit = 0; KeServiceDescriptorTable[0].Number = MainSSPT; Modified: trunk/reactos/ntoskrnl/ob/obinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obinit.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obinit.c (original) +++ trunk/reactos/ntoskrnl/ob/obinit.c Mon Oct 2 19:05:03 2006 @@ -44,33 +44,18 @@ NTAPI PsInitializeQuotaSystem(VOID); +ULONG ObpInitializationPhase; + /* PRIVATE FUNCTIONS *********************************************************/ -VOID +BOOLEAN INIT_FUNCTION +NTAPI ObInit2(VOID) { ULONG i; PKPRCB Prcb; PNPAGED_LOOKASIDE_LIST CurrentList = NULL; - - /* Initialize the OBJECT_CREATE_INFORMATION List */ - ExInitializeNPagedLookasideList(&ObpCiLookasideList, - NULL, - NULL, - 0, - sizeof(OBJECT_CREATE_INFORMATION), - TAG('O', 'b', 'C', 'I'), - 32); - - /* Set the captured UNICODE_STRING Object Name List */ - ExInitializeNPagedLookasideList(&ObpNmLookasideList, - NULL, - NULL, - 0, - 248, - TAG('O', 'b', 'N', 'M'), - 16); /* Now allocate the per-processor lists */ for (i = 0; i < KeNumberProcessors; i++) @@ -128,10 +113,13 @@ /* Link it */ Prcb->PPLookasideList[LookasideNameBufferList].P = &CurrentList->L; } + + return TRUE; } -VOID +BOOLEAN INIT_FUNCTION +NTAPI ObInit(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -139,6 +127,34 @@ SECURITY_DESCRIPTOR SecurityDescriptor; OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; OBP_LOOKUP_CONTEXT Context; + PKPRCB Prcb = KeGetCurrentPrcb(); + + /* Check if this is actually Phase 1 initialization */ + if (ObpInitializationPhase != 0) goto ObPostPhase0; + + /* Initialize the OBJECT_CREATE_INFORMATION List */ + ExInitializeNPagedLookasideList(&ObpCiLookasideList, + NULL, + NULL, + 0, + sizeof(OBJECT_CREATE_INFORMATION), + TAG('O', 'b', 'C', 'I'), + 32); + + /* Set the captured UNICODE_STRING Object Name List */ + ExInitializeNPagedLookasideList(&ObpNmLookasideList, + NULL, + NULL, + 0, + 248, + TAG('O', 'b', 'N', 'M'), + 16); + + /* Temporarily setup both pointers to the shared list */ + Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCiLookasideList.L; + Prcb->PPLookasideList[LookasideCreateInfoList].P = &ObpCiLookasideList.L; + Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNmLookasideList.L; + Prcb->PPLookasideList[LookasideNameBufferList].P = &ObpNmLookasideList.L; /* Initialize the security descriptor cache */ ObpInitSdCache(); @@ -148,9 +164,6 @@ /* Setup the Object Reaper */ ExInitializeWorkItem(&ObpReaperWorkItem, ObpReapObject, NULL); - - /* Initialize lookaside lists */ - ObInit2(); /* Initialize default Quota block */ PsInitializeQuotaSystem(); @@ -160,7 +173,6 @@ ObpKernelHandleTable = PsGetCurrentProcess()->ObjectTable; /* Create the Type Type */ - DPRINT("Creating Type Type\n"); RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Type"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); @@ -173,7 +185,6 @@ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObTypeObjectType); /* Create the Directory Type */ - DPRINT("Creating Directory Type\n"); RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Directory"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); @@ -183,6 +194,15 @@ ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping; ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY); ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObDirectoryType); + + /* Phase 0 initialization complete */ + ObpInitializationPhase++; + return TRUE; + +ObPostPhase0: + + /* Re-initialize lookaside lists */ + ObInit2(); /* Create security descriptor */ RtlCreateSecurityDescriptor(&SecurityDescriptor, @@ -199,7 +219,6 @@ FALSE); /* Create root directory */ - DPRINT("Creating Root Directory\n"); InitializeObjectAttributes(&ObjectAttributes, NULL, OBJ_PERMANENT, @@ -271,5 +290,7 @@ /* FIXME: Hack Hack! */ ObSystemDeviceMap = ExAllocatePoolWithTag(NonPagedPool, sizeof(*ObSystemDeviceMap), TAG('O', 'b', 'D', 'm')); RtlZeroMemory(ObSystemDeviceMap, sizeof(*ObSystemDeviceMap)); + return TRUE; } + /* EOF */
18 years, 2 months
1
0
0
0
[weiden] 24361: Fix some warnings
by weiden@svn.reactos.org
Author: weiden Date: Mon Oct 2 17:29:55 2006 New Revision: 24361 URL:
http://svn.reactos.org/svn/reactos?rev=24361&view=rev
Log: Fix some warnings Modified: trunk/reactos/tools/mkhive/cmi.c trunk/reactos/tools/mkhive/mkhive.h trunk/reactos/tools/mkhive/rtl.c Modified: trunk/reactos/tools/mkhive/cmi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.c?rev=243…
============================================================================== --- trunk/reactos/tools/mkhive/cmi.c (original) +++ trunk/reactos/tools/mkhive/cmi.c Mon Oct 2 17:29:55 2006 @@ -31,7 +31,7 @@ IN SIZE_T Size, IN BOOLEAN Paged) { - return (PVOID) malloc(Size); + return (PVOID) malloc((size_t)Size); } static VOID Modified: trunk/reactos/tools/mkhive/mkhive.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.h?rev=…
============================================================================== --- trunk/reactos/tools/mkhive/mkhive.h (original) +++ trunk/reactos/tools/mkhive/mkhive.h Mon Oct 2 17:29:55 2006 @@ -28,6 +28,7 @@ #define __MKHIVE_H__ #include <stdio.h> +#include <stdlib.h> /* We have to do this because psdk/windef.h will _always_ define _WIN32... */ #if defined(_WIN32) || defined(_WIN64) Modified: trunk/reactos/tools/mkhive/rtl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/rtl.c?rev=243…
============================================================================== --- trunk/reactos/tools/mkhive/rtl.c (original) +++ trunk/reactos/tools/mkhive/rtl.c Mon Oct 2 17:29:55 2006 @@ -3,6 +3,8 @@ * FILE: tools/mkhive/rtl.c * PURPOSE: Runtime Library */ + +#include <stdlib.h> #define RTL_H @@ -11,7 +13,7 @@ #include <ntddk.h> #include <bitmap.c> -SIZE_T xwcslen( PWSTR String ) { +SIZE_T xwcslen( PCWSTR String ) { SIZE_T i; for( i = 0; String[i]; i++ );
18 years, 2 months
1
0
0
0
[ion] 24360: - Implement Phase 0 Ex initialization (Resource, Lookaside initialization) and generic Ex initialization routine. - Clear the crypto exponent on boot-up. - Set default global flags for checked builds. - Set NtSystemRoot (SharedUserData) to C:<NT BOOT PATH> on startup. - Cleanup lookas.c file and implement routines to initialize the system lookaside list in phase 0.
by ion@svn.reactos.org
Author: ion Date: Mon Oct 2 17:23:03 2006 New Revision: 24360 URL:
http://svn.reactos.org/svn/reactos?rev=24360&view=rev
Log: - Implement Phase 0 Ex initialization (Resource, Lookaside initialization) and generic Ex initialization routine. - Clear the crypto exponent on boot-up. - Set default global flags for checked builds. - Set NtSystemRoot (SharedUserData) to C:<NT BOOT PATH> on startup. - Cleanup lookas.c file and implement routines to initialize the system lookaside list in phase 0. Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/ex/lookas.c trunk/reactos/ntoskrnl/ex/sysinfo.c trunk/reactos/ntoskrnl/include/internal/ex.h Modified: trunk/reactos/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Mon Oct 2 17:23:03 2006 @@ -22,7 +22,8 @@ ULONG NtMinorVersion = 0; ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0); ULONG NtBuildNumber = KERNEL_VERSION_BUILD; -ULONG NtGlobalFlag = 0; +ULONG NtGlobalFlag; +ULONG ExSuiteMask; extern ULONG MmCoreDumpType; extern LOADER_MODULE KeLoaderModules[64]; @@ -35,6 +36,9 @@ BOOLEAN ExpInTextModeSetup; BOOLEAN IoRemoteBootClient; ULONG InitSafeBootMode; + +/* NT Boot Path */ +UNICODE_STRING NtSystemRoot; /* Boot NLS information */ PVOID ExpNlsTableBase; @@ -350,14 +354,6 @@ VOID NTAPI -ExInit2(VOID) -{ - ExpInitLookasideLists(); - ExpInitializeHandleTables(); -} - -VOID -NTAPI ExInit3(VOID) { ExpInitializeEventImplementation(); @@ -373,6 +369,61 @@ BOOLEAN NTAPI +ExpInitSystemPhase0(VOID) +{ + /* Initialize EXRESOURCE Support */ + ExpResourceInitialization(); + + /* Initialize the environment lock */ + ExInitializeFastMutex(&ExpEnvironmentLock); + + /* Initialize the lookaside lists and locks */ + ExpInitLookasideLists(); + + /* Initialize the Firmware Table resource and listhead */ + InitializeListHead(&ExpFirmwareTableProviderListHead); + ExInitializeResourceLite(&ExpFirmwareTableResource); + + /* Set the suite mask to maximum and return */ + ExSuiteMask = 0xFFFFFFFF; + return TRUE; +} + +BOOLEAN +NTAPI +ExpInitSystemPhase1(VOID) +{ + /* Not yet done */ + return FALSE; +} + +BOOLEAN +NTAPI +ExInitSystem(VOID) +{ + /* Check the initialization phase */ + switch (ExpInitializationPhase) + { + case 0: + + /* Do Phase 0 */ + return ExpInitSystemPhase0(); + + case 1: + + /* Do Phase 1 */ + return ExpInitSystemPhase1(); + + default: + + /* Don't know any other phase! Bugcheck! */ + KeBugCheck(UNEXPECTED_INITIALIZATION_CALL); + return FALSE; + } +} + +BOOLEAN +NTAPI ExpIsLoaderValid(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { PLOADER_PARAMETER_EXTENSION Extension; @@ -402,6 +453,9 @@ IN PLOADER_PARAMETER_BLOCK LoaderBlock) { PNLS_DATA_BLOCK NlsData; + CHAR Buffer[256]; + ANSI_STRING AnsiPath; + NTSTATUS Status; /* FIXME: Deprecate soon */ ParseAndCacheLoadedModules(); @@ -487,6 +541,31 @@ /* Make sure interrupts are active now */ _enable(); + /* Clear the crypto exponent */ + SharedUserData->CryptoExponent = 0; + + /* Set global flags for the checked build */ +#if DBG + NtGlobalFlag |= FLG_ENABLE_CLOSE_EXCEPTIONS | + FLG_ENABLE_KDEBUG_SYMBOL_LOAD; +#endif + + /* Setup NT System Root Path */ + sprintf(Buffer, "C:%s", LoaderBlock->NtBootPathName); + + /* Convert to ANSI_STRING and null-terminate it */ + RtlInitString(&AnsiPath, Buffer ); + Buffer[--AnsiPath.Length] = UNICODE_NULL; + + /* Get the string from KUSER_SHARED_DATA's buffer */ + NtSystemRoot.Buffer = SharedUserData->NtSystemRoot; + NtSystemRoot.MaximumLength = sizeof(SharedUserData->NtSystemRoot) / sizeof(WCHAR); + NtSystemRoot.Length = 0; + + /* Now fill it in */ + Status = RtlAnsiStringToUnicodeString(&NtSystemRoot, &AnsiPath, FALSE); + if (!NT_SUCCESS(Status)) KEBUGCHECK(SESSION3_INITIALIZATION_FAILED); + /* Setup bugcheck messages */ KiInitializeBugCheck(); @@ -496,14 +575,14 @@ /* Initialize the second stage of the kernel */ KeInit2(); - /* Initialize resources */ - ExpResourceInitialization(); + /* Initialize the executive at phase 0 */ + if (!ExInitSystem()) KEBUGCHECK(PHASE0_INITIALIZATION_FAILED); /* Load basic Security for other Managers */ if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED); - /* Initialize Lookaside Lists and Handle Table */ - ExInit2(); + /* Initialize the Handle Table */ + ExpInitializeHandleTables(); /* Create the Basic Object Manager Types to allow new Object Types */ ObInit(); Modified: trunk/reactos/ntoskrnl/ex/lookas.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/lookas.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/ex/lookas.c (original) +++ trunk/reactos/ntoskrnl/ex/lookas.c Mon Oct 2 17:23:03 2006 @@ -1,18 +1,16 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ex/lookas.c - * PURPOSE: Lookaside lists - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) - * David Welch (welch(a)mcmail.com) - * Casper S. Hornstrup (chorns(a)users.sourceforge.net) - */ - -/* INCLUDES *****************************************************************/ +* PROJECT: ReactOS Kernel +* LICENSE: GPL - See COPYING in the top level directory +* FILE: ntoskrnl/ex/lookas.c +* PURPOSE: Lookaside Lists +* PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) +*/ + +/* INCLUDES ******************************************************************/ #include <ntoskrnl.h> #define NDEBUG -#include <internal/debug.h> +#include <debug.h> #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, ExpInitLookasideLists) @@ -24,10 +22,41 @@ KSPIN_LOCK ExpNonPagedLookasideListLock; LIST_ENTRY ExpPagedLookasideListHead; KSPIN_LOCK ExpPagedLookasideListLock; +LIST_ENTRY ExSystemLookasideListHead; +LIST_ENTRY ExPoolLookasideListHead; NPAGED_LOOKASIDE_LIST ExpSmallNPagedPoolLookasideLists[MAXIMUM_PROCESSORS]; PAGED_LOOKASIDE_LIST ExpSmallPagedPoolLookasideLists[MAXIMUM_PROCESSORS]; -/* FUNCTIONS *****************************************************************/ +/* PRIVATE FUNCTIONS *********************************************************/ + +VOID +NTAPI +ExInitializeSystemLookasideList(IN PGENERAL_LOOKASIDE List, + IN POOL_TYPE Type, + IN ULONG Size, + IN ULONG Tag, + IN USHORT MaximumDepth, + IN PLIST_ENTRY ListHead) +{ + /* Initialize the list */ + List->Tag = Tag; + List->Type = Type; + List->Size = Size; + InsertHeadList(ListHead, &List->ListEntry); + List->MaximumDepth = MaximumDepth; + List->Depth = 2; + List->Allocate = ExAllocatePoolWithTag; + List->Free = ExFreePool; + List->ListHead.Next.Next = NULL; + List->ListHead.Depth = 0; + List->ListHead.Sequence = 0; + List->TotalAllocates = 0; + List->AllocateHits = 0; + List->TotalFrees = 0; + List->FreeHits = 0; + List->LastTotalAllocates = 0; + List->LastAllocateHits = 0; +} VOID NTAPI @@ -60,23 +89,49 @@ Entry->P = &PagedListEntry->L; } } -VOID -INIT_FUNCTION -STDCALL + +VOID +NTAPI ExpInitLookasideLists() { - /* Initialize Lock and Listhead */ + ULONG i, j; + + /* Initialize locks and lists */ InitializeListHead(&ExpNonPagedLookasideListHead); + InitializeListHead(&ExpPagedLookasideListHead); + InitializeListHead(&ExSystemLookasideListHead); + InitializeListHead(&ExPoolLookasideListHead); KeInitializeSpinLock(&ExpNonPagedLookasideListLock); - InitializeListHead(&ExpPagedLookasideListHead); KeInitializeSpinLock(&ExpPagedLookasideListLock); -} + + /* Initialize the system lookaside lists */ + for (i = 0, j = 1; i < (MAXIMUM_PROCESSORS - 1); j++, i++) + { + /* Initialize the non-paged list */ + ExInitializeSystemLookasideList(&ExpSmallNPagedPoolLookasideLists[i].L, + NonPagedPool, + j * 8, + TAG('P', 'o', 'o', 'l'), + 256, + &ExPoolLookasideListHead); + + /* Initialize the paged list */ + ExInitializeSystemLookasideList(&ExpSmallPagedPoolLookasideLists[i].L, + PagedPool, + j * 8, + TAG('P', 'o', 'o', 'l'), + 256, + &ExPoolLookasideListHead); + } +} + +/* PUBLIC FUNCTIONS **********************************************************/ /* * @implemented */ PVOID -STDCALL +NTAPI ExiAllocateFromPagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside) { PVOID Entry; @@ -87,7 +142,7 @@ { Lookaside->L.AllocateMisses++; Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, - Lookaside->L.Size, + Lookaside->L.Size, Lookaside->L.Tag); } return Entry; @@ -97,7 +152,7 @@ * @implemented */ VOID -STDCALL +NTAPI ExiFreeToPagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PVOID Entry) { @@ -117,21 +172,20 @@ * @implemented */ VOID -STDCALL -ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside) +NTAPI +ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside) { KIRQL OldIrql; PVOID Entry; - /* Pop all entries off the stack and release the resources allocated - for them */ + /* Pop all entries off the stack and release their resources */ for (;;) { Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); if (!Entry) break; (*Lookaside->L.Free)(Entry); } - + /* Remove from list */ KeAcquireSpinLock(&ExpNonPagedLookasideListLock, &OldIrql); RemoveEntryList(&Lookaside->L.ListEntry); @@ -142,21 +196,20 @@ * @implemented */ VOID -STDCALL -ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside) +NTAPI +ExDeletePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside) { KIRQL OldIrql; PVOID Entry; - /* Pop all entries off the stack and release the resources allocated - for them */ + /* Pop all entries off the stack and release their resources */ for (;;) { Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); if (!Entry) break; (*Lookaside->L.Free)(Entry); } - + /* Remove from list */ KeAcquireSpinLock(&ExpPagedLookasideListLock, &OldIrql); RemoveEntryList(&Lookaside->L.ListEntry); @@ -167,17 +220,15 @@ * @implemented */ VOID -STDCALL -ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside, - PALLOCATE_FUNCTION Allocate, - PFREE_FUNCTION Free, - ULONG Flags, - ULONG Size, - ULONG Tag, - USHORT Depth) -{ - DPRINT("Initializing nonpaged lookaside list at 0x%p\n", Lookaside); - +NTAPI +ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, + IN PALLOCATE_FUNCTION Allocate OPTIONAL, + IN PFREE_FUNCTION Free OPTIONAL, + IN ULONG Flags, + IN ULONG Size, + IN ULONG Tag, + IN USHORT Depth) +{ /* Initialize the Header */ ExInitializeSListHead(&Lookaside->L.ListHead); Lookaside->L.TotalAllocates = 0; @@ -221,17 +272,15 @@ * @implemented */ VOID -STDCALL -ExInitializePagedLookasideList (PPAGED_LOOKASIDE_LIST Lookaside, - PALLOCATE_FUNCTION Allocate, - PFREE_FUNCTION Free, - ULONG Flags, - ULONG Size, - ULONG Tag, - USHORT Depth) -{ - DPRINT("Initializing paged lookaside list at 0x%p\n", Lookaside); - +NTAPI +ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, + IN PALLOCATE_FUNCTION Allocate OPTIONAL, + IN PFREE_FUNCTION Free OPTIONAL, + IN ULONG Flags, + IN ULONG Size, + IN ULONG Tag, + IN USHORT Depth) +{ /* Initialize the Header */ ExInitializeSListHead(&Lookaside->L.ListHead); Lookaside->L.TotalAllocates = 0; @@ -264,7 +313,7 @@ { Lookaside->L.Free = ExFreePool; } - + /* Insert it into the list */ ExInterlockedInsertTailList(&ExpNonPagedLookasideListHead, &Lookaside->L.ListEntry, Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ex/sysinfo.c (original) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c Mon Oct 2 17:23:03 2006 @@ -20,6 +20,10 @@ ULONGLONG STDCALL KeQueryInterruptTime(VOID); VOID MmPrintMemoryStatistic(VOID); + +FAST_MUTEX ExpEnvironmentLock; +ERESOURCE ExpFirmwareTableResource; +LIST_ENTRY ExpFirmwareTableProviderListHead; /* FUNCTIONS *****************************************************************/ Modified: trunk/reactos/ntoskrnl/include/internal/ex.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ex.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ex.h Mon Oct 2 17:23:03 2006 @@ -10,6 +10,9 @@ extern ULONG NtBuildNumber; extern ULONG NtMajorVersion; extern ULONG NtMinorVersion; +extern FAST_MUTEX ExpEnvironmentLock; +extern ERESOURCE ExpFirmwareTableResource; +extern LIST_ENTRY ExpFirmwareTableProviderListHead; #define MAX_FAST_REFS 7 @@ -65,6 +68,17 @@ VOID NTAPI ExpInitLookasideLists(VOID); + +VOID +NTAPI +ExInitializeSystemLookasideList( + IN PGENERAL_LOOKASIDE List, + IN POOL_TYPE Type, + IN ULONG Size, + IN ULONG Tag, + IN USHORT MaximumDepth, + IN PLIST_ENTRY ListHead +); VOID NTAPI
18 years, 2 months
1
0
0
0
[weiden] 24359: Define NTOSAPI before including ntddk.h to avoid including function prototypes with dllimport
by weiden@svn.reactos.org
Author: weiden Date: Mon Oct 2 16:22:17 2006 New Revision: 24359 URL:
http://svn.reactos.org/svn/reactos?rev=24359&view=rev
Log: Define NTOSAPI before including ntddk.h to avoid including function prototypes with dllimport Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h (original) +++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h Mon Oct 2 16:22:17 2006 @@ -25,6 +25,7 @@ #include <stdlib.h> #include <stdio.h> #include <ctype.h> +#define NTOSAPI #include <ntddk.h> #include <arc/arc.h> #include <ketypes.h>
18 years, 2 months
1
0
0
0
[ion] 24358: - Continue implementation of KiRosFrldrLpbToNtLpb by parsing the FreeLDR command line and: * Removing the ARC Boot path and splitting it into the ARC Boot Device Name, the ARC HAL Device Name, and the NT Boot and HAL Path Names, saved in their respective LoaderBlock pointers. * Converting every slash to a space. ("/DEBUGPORT" -> " DEBUGPORT") * Now we can fully parse and read NTLDR command lines. - Update various code in the kernel to: * Use LoaderBlock->ArcDeviceNamePath & friends
by ion@svn.reactos.org
Author: ion Date: Mon Oct 2 09:40:36 2006 New Revision: 24358 URL:
http://svn.reactos.org/svn/reactos?rev=24358&view=rev
Log: - Continue implementation of KiRosFrldrLpbToNtLpb by parsing the FreeLDR command line and: * Removing the ARC Boot path and splitting it into the ARC Boot Device Name, the ARC HAL Device Name, and the NT Boot and HAL Path Names, saved in their respective LoaderBlock pointers. * Converting every slash to a space. ("/DEBUGPORT" -> " DEBUGPORT") * Now we can fully parse and read NTLDR command lines. - Update various code in the kernel to: * Use LoaderBlock->ArcDeviceNamePath & friends instead of the command line. * Stop depending on slashes, and instead use strstr for parameters. Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/include/internal/po.h trunk/reactos/ntoskrnl/io/iomgr/arcname.c trunk/reactos/ntoskrnl/io/iomgr/iomgr.c trunk/reactos/ntoskrnl/kd/kdinit.c trunk/reactos/ntoskrnl/kd/kdio.c trunk/reactos/ntoskrnl/ke/freeldr.c trunk/reactos/ntoskrnl/po/power.c Modified: trunk/reactos/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Mon Oct 2 09:40:36 2006 @@ -29,7 +29,6 @@ extern ULONG KeLoaderModuleCount; extern PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; BOOLEAN NoGuiBoot = FALSE; -static BOOLEAN ForceAcpiDisable = FALSE; /* Init flags and settings */ ULONG ExpInitializationPhase; @@ -48,7 +47,7 @@ static VOID INIT_FUNCTION -InitSystemSharedUserPage (PCSZ ParameterLine) +InitSystemSharedUserPage (IN PLOADER_PARAMETER_BLOCK LoaderBlock) { UNICODE_STRING ArcDeviceName; UNICODE_STRING ArcName; @@ -56,9 +55,7 @@ UNICODE_STRING DriveDeviceName; UNICODE_STRING DriveName; WCHAR DriveNameBuffer[20]; - PCHAR ParamBuffer; PWCHAR ArcNameBuffer; - PCHAR p; NTSTATUS Status; ULONG Length; OBJECT_ATTRIBUTES ObjectAttributes; @@ -86,39 +83,16 @@ * Format: "<arc_name>\<path> [options...]" */ - /* Create local parameter line copy */ - ParamBuffer = ExAllocatePool(PagedPool, 256); - strcpy (ParamBuffer, (const char *)ParameterLine); - DPRINT("%s\n", ParamBuffer); - - /* Cut options off */ - p = strchr (ParamBuffer, ' '); - if (p) *p = 0; - DPRINT("%s\n", ParamBuffer); - - /* Extract path */ - p = strchr (ParamBuffer, '\\'); - if (p) { - - DPRINT("Boot path: %s\n", p); - RtlCreateUnicodeStringFromAsciiz (&BootPath, p); - *p = 0; - - } else { - - DPRINT("Boot path: %s\n", "\\"); - RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\"); - } - DPRINT("Arc name: %s\n", ParamBuffer); + RtlCreateUnicodeStringFromAsciiz(&BootPath, LoaderBlock->NtBootPathName); + + /* Remove the trailing backslash */ + BootPath.Length -= sizeof(WCHAR); + BootPath.MaximumLength -= sizeof(WCHAR); /* Only ARC Name left - Build full ARC Name */ ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR)); - swprintf (ArcNameBuffer, L"\\ArcName\\%S", ParamBuffer); + swprintf (ArcNameBuffer, L"\\ArcName\\%S", LoaderBlock->ArcBootDeviceName); RtlInitUnicodeString (&ArcName, ArcNameBuffer); - DPRINT("Arc name: %wZ\n", &ArcName); - - /* Free ParamBuffer */ - ExFreePool (ParamBuffer); /* Allocate ARC Device Name string */ ArcDeviceName.Length = 0; @@ -163,7 +137,6 @@ CPRINT("NtQuerySymbolicLinkObject() failed (Status %x)\n", Status); KEBUGCHECK(0); } - DPRINT("Length: %lu ArcDeviceName: %wZ\n", Length, &ArcDeviceName); /* Allocate Device Name string */ DriveDeviceName.Length = 0; @@ -228,48 +201,6 @@ DbgPrint("No system drive found!\n"); KEBUGCHECK (NO_BOOT_DEVICE); - } -} - -__inline -VOID -STDCALL -ParseCommandLine(PBOOLEAN NoGuiBoot, - PBOOLEAN ForceAcpiDisable) -{ - PCHAR p1, p2; - - p1 = KeLoaderBlock->LoadOptions; - while(*p1 && (p2 = strchr(p1, '/'))) { - - p2++; - if (!_strnicmp(p2, "NOGUIBOOT", 9)) { - - p2 += 9; - *NoGuiBoot = TRUE; - - } else if (!_strnicmp(p2, "CRASHDUMP", 9)) { - - p2 += 9; - if (*p2 == ':') { - - p2++; - if (!_strnicmp(p2, "FULL", 4)) { - - MmCoreDumpType = MM_CORE_DUMP_TYPE_FULL; - - } else { - - MmCoreDumpType = MM_CORE_DUMP_TYPE_NONE; - } - } - } else if (!_strnicmp(p2, "NOACPI", 6)) { - - p2 += 6; - *ForceAcpiDisable = TRUE; - } - - p1 = p2; } } @@ -472,9 +403,6 @@ { PNLS_DATA_BLOCK NlsData; - /* Parse Command Line Settings */ - ParseCommandLine(&NoGuiBoot, &ForceAcpiDisable); - /* FIXME: Deprecate soon */ ParseAndCacheLoadedModules(); @@ -630,7 +558,7 @@ IoInit(); /* TBD */ - PoInit(AcpiTableDetected, ForceAcpiDisable); + PoInit(AcpiTableDetected, KeLoaderBlock); /* Initialize the Registry (Hives are NOT yet loaded!) */ CmInitializeRegistry(); @@ -649,6 +577,9 @@ /* Clear the screen to blue */ HalInitSystem(2, KeLoaderBlock); + + /* Check if GUI Boot is enabled */ + if (strstr(KeLoaderBlock->LoadOptions, "NOGUIBOOT")) NoGuiBoot = TRUE; /* Display version number and copyright/warranty message */ if (NoGuiBoot) ExpDisplayNotice(); @@ -685,7 +616,7 @@ PsLocateSystemDll(); /* Initialize shared user page. Set dos system path, dos device map, etc. */ - InitSystemSharedUserPage (KeLoaderBlock->LoadOptions); + InitSystemSharedUserPage(KeLoaderBlock); /* Create 'ReactOSInitDone' event */ RtlInitUnicodeString(&EventName, L"\\ReactOSInitDone"); Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h Mon Oct 2 09:40:36 2006 @@ -568,7 +568,7 @@ NTSTATUS IoCreateSystemRootLink( - IN PCHAR ParameterLine + IN PLOADER_PARAMETER_BLOCK LoaderBlock ); // Modified: trunk/reactos/ntoskrnl/include/internal/po.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/po.h (original) +++ trunk/reactos/ntoskrnl/include/internal/po.h Mon Oct 2 09:40:36 2006 @@ -39,7 +39,7 @@ NTAPI PoInit( BOOLEAN HaveAcpiTable, - BOOLEAN ForceAcpiDisable + IN PLOADER_PARAMETER_BLOCK LoaderBlock ); VOID Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/arcname.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c Mon Oct 2 09:40:36 2006 @@ -679,7 +679,7 @@ NTSTATUS INIT_FUNCTION -IoCreateSystemRootLink(PCHAR ParameterLine) +IoCreateSystemRootLink(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; @@ -694,33 +694,14 @@ ULONG Length; HANDLE Handle; - /* Create local parameter line copy */ - ParamBuffer = ExAllocatePool(PagedPool, 256); - strcpy(ParamBuffer, (char *)ParameterLine); - - DPRINT("%s\n", ParamBuffer); - /* Format: <arc_name>\<path> [options...] */ - - /* cut options off */ - p = strchr(ParamBuffer, ' '); - if (p) - *p = 0; - DPRINT("%s\n", ParamBuffer); - - /* extract path */ - p = strchr(ParamBuffer, '\\'); - if (p) - { - DPRINT("Boot path: %s\n", p); - RtlCreateUnicodeStringFromAsciiz(&BootPath, p); - *p = 0; - } - else - { - DPRINT("Boot path: %s\n", "\\"); - RtlCreateUnicodeStringFromAsciiz(&BootPath, "\\"); - } - DPRINT("ARC name: %s\n", ParamBuffer); + RtlCreateUnicodeStringFromAsciiz(&BootPath, LoaderBlock->NtBootPathName); + + /* Remove the trailing backslash */ + BootPath.Length -= sizeof(WCHAR); + BootPath.MaximumLength -= sizeof(WCHAR); + + /* Only ARC Name left - Build full ARC Name */ + ParamBuffer = LoaderBlock->ArcBootDeviceName; p = strstr(ParamBuffer, "cdrom"); if (p != NULL) @@ -740,7 +721,7 @@ DPRINT("New ARC name: %s\n", ParamBuffer); /* Adjust original command line */ - p = strstr(ParameterLine, "cdrom"); + p = strstr(LoaderBlock->ArcBootDeviceName, "cdrom"); if (p != NULL); { char temp[256]; @@ -763,10 +744,6 @@ swprintf(ArcNameBuffer, L"\\ArcName\\%S", ParamBuffer); RtlInitUnicodeString(&ArcName, ArcNameBuffer); - DPRINT("Arc name: %wZ\n", &ArcName); - - /* free ParamBuffer */ - ExFreePool(ParamBuffer); /* allocate device name string */ DeviceName.Length = 0; @@ -808,13 +785,11 @@ return(Status); } - DPRINT("Length: %lu DeviceName: %wZ\n", Length, &DeviceName); RtlAppendUnicodeStringToString(&DeviceName, &BootPath); RtlFreeUnicodeString(&BootPath); - DPRINT("DeviceName: %wZ\n", &DeviceName); /* create the '\SystemRoot' link */ Status = IoCreateSymbolicLink(&LinkName, Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Mon Oct 2 09:40:36 2006 @@ -483,7 +483,7 @@ /* Create the SystemRoot symbolic link */ DPRINT("CommandLine: %s\n", KeLoaderBlock->LoadOptions); - Status = IoCreateSystemRootLink(KeLoaderBlock->LoadOptions); + Status = IoCreateSystemRootLink(KeLoaderBlock); if (!NT_SUCCESS(Status)) { CPRINT("IoCreateSystemRootLink FAILED: (0x%x) - ", Status); KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE); Modified: trunk/reactos/ntoskrnl/kd/kdinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdinit.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/kd/kdinit.c (original) +++ trunk/reactos/ntoskrnl/kd/kdinit.c Mon Oct 2 09:40:36 2006 @@ -166,87 +166,83 @@ { ULONG Value; ULONG i; - PCHAR p1, p2; - -#if 0 - /* NTLDR HACK */ - KdpSerialInit(&DispatchTable[KdSerial], 0); - KdpDebugMode.Serial = TRUE; - SerialPortInfo.ComPort = 1; - KdpPort = 1; - KdDebuggerEnabled = TRUE; -#endif + PCHAR CommandLine, Port, BaudRate, Irq; /* Set Default Port Options */ if (BootPhase == 0) { - - /* Parse the Command Line */ - p1 = LoaderBlock->LoadOptions; - while (p1 && (p2 = strchr(p1, '/'))) - { - /* Move past the slash */ - p2++; - - /* Identify the Debug Type being Used */ - if (!_strnicmp(p2, "DEBUGPORT=", 10)) + /* Get the Command Line */ + CommandLine = LoaderBlock->LoadOptions; + + /* Upcase it */ + _strupr(CommandLine); + + /* Check for settings that we support */ + if (strstr(CommandLine, "BREAK")) KdpEarlyBreak = TRUE; + if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE; + if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE; + if (strstr(CommandLine, "DEBUG")) + { + /* Enable on the serial port */ + KdDebuggerEnabled = TRUE; + KdpDebugMode.Serial = TRUE; + } + + /* Get the port and baud rate */ + Port = strstr(CommandLine, "DEBUGPORT"); + BaudRate = strstr(CommandLine, "BAUDRATE"); + Irq = strstr(CommandLine, "IRQ"); + + /* Check if we got the /DEBUGPORT parameter */ + if (Port) + { + /* Move past the actual string, to reach the port*/ + Port += strlen("DEBUGPORT"); + + /* Now get past any spaces and skip the equal sign */ + while (*Port == ' ') Port++; + Port++; + + /* Get the debug mode and wrapper */ + Port = KdpGetDebugMode(Port); + Port = KdpGetWrapperDebugMode(Port, LoaderBlock); + KdDebuggerEnabled = TRUE; + } + + /* Check if we got a baud rate */ + if (BaudRate) + { + /* Move past the actual string, to reach the rate */ + BaudRate += strlen("BAUDRATE"); + + /* Now get past any spaces */ + while (*BaudRate == ' ') BaudRate++; + + /* And make sure we have a rate */ + if (*BaudRate) { - p2 += 10; - p2 = KdpGetDebugMode(p2); - p2 = KdpGetWrapperDebugMode(p2, LoaderBlock); - KdDebuggerEnabled = TRUE; + /* Read and set it */ + Value = atol(BaudRate + 1); + if (Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; } - /* Check for early breakpoint */ - else if (!_strnicmp(p2, "BREAK", 5)) + } + + /* Check Serial Port Settings [IRQ] */ + if (Irq) + { + /* Move past the actual string, to reach the rate */ + Irq += strlen("IRQ"); + + /* Now get past any spaces */ + while (*Irq == ' ') Irq++; + + /* And make sure we have an IRQ */ + if (*Irq) { - p2 += 5; - KdpEarlyBreak = TRUE; + /* Read and set it */ + Value = atol(Irq + 1); + if (Value) KdpPortIrq = Value; } - /* Check for Kernel Debugging Enable */ - else if (!_strnicmp(p2, "DEBUG", 5)) - { - /* Enable it on the Serial Port */ - p2 += 5; - KdDebuggerEnabled = TRUE; - KdpDebugMode.Serial = TRUE; - } - /* Check for Kernel Debugging Bypass */ - else if (!_strnicmp(p2, "NODEBUG", 7)) - { - /* Disable Debugging */ - p2 += 7; - KdDebuggerEnabled = FALSE; - } - /* Check for Kernel Debugging Bypass unless STOP Error */ - else if (!_strnicmp(p2, "CRASHDEBUG", 10)) - { - /* Disable Debugging */ - p2 += 10; - KdDebuggerEnabled = FALSE; - } - /* Check Serial Port Settings [Baud Rate] */ - else if (!_strnicmp(p2, "BAUDRATE=", 9)) - { - /* Get the Baud Rate */ - p2 += 9; - Value = (ULONG)atol(p2); - - /* Check if it's valid and Set it */ - if (0 < Value) PortInfo.BaudRate = SerialPortInfo.BaudRate = Value; - } - /* Check Serial Port Settings [IRQ] */ - else if (!_strnicmp(p2, "IRQ=", 4)) - { - /* Get the IRQ */ - p2 += 3; - Value = (ULONG)atol(p2); - - /* Check if it's valid and set it */ - if (0 < Value) KdpPortIrq = Value; - } - - /* Move to next */ - p1 = p2; } /* Call Providers at Phase 0 */ @@ -257,7 +253,6 @@ /* Call Wrapper at Phase 0 */ if (WrapperInitRoutine) WrapperInitRoutine(&WrapperTable, 0); - return; } Modified: trunk/reactos/ntoskrnl/kd/kdio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdio.c?rev=243…
============================================================================== --- trunk/reactos/ntoskrnl/kd/kdio.c (original) +++ trunk/reactos/ntoskrnl/kd/kdio.c Mon Oct 2 09:40:36 2006 @@ -188,10 +188,15 @@ /* Register as a Provider */ InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); - + /* Display separator + ReactOS version at start of the debug log */ - DPRINT1("---------------------------------------------------------------\n"); + DPRINT1("-----------------------------------------------------\n"); DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); + DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); + DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, + KeLoaderBlock->NtHalPathName, + KeLoaderBlock->ArcHalDeviceName, + KeLoaderBlock->NtBootPathName); } else if (BootPhase == 2) { Modified: trunk/reactos/ntoskrnl/ke/freeldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ke/freeldr.c (original) +++ trunk/reactos/ntoskrnl/ke/freeldr.c Mon Oct 2 09:40:36 2006 @@ -43,6 +43,10 @@ LOADER_PARAMETER_BLOCK BldrLoaderBlock; LOADER_PARAMETER_EXTENSION BldrExtensionBlock; CHAR BldrCommandLine[256]; +CHAR BldrArcBootPath[64]; +CHAR BldrArcHalPath[64]; +CHAR BldrNtHalPath[64]; +CHAR BldrNtBootPath[64]; LDR_DATA_TABLE_ENTRY BldrModules[64]; MEMORY_ALLOCATION_DESCRIPTOR BldrMemoryDescriptors[64]; WCHAR BldrModuleStrings[64][260]; @@ -63,6 +67,8 @@ ULONG i, j, ModSize; PVOID ModStart; PCHAR DriverName; + PCHAR BootPath, HalPath; + CHAR CommandLine[256]; /* First get some kernel-loader globals */ AcpiTableDetected = (RosLoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) ? TRUE : FALSE; @@ -256,6 +262,36 @@ /* All we'll setup right now is the flag for text-mode setup */ LoaderBlock->SetupLdrBlock->Flags = 1; } + + /* Make a copy of the command line */ + strcpy(CommandLine, LoaderBlock->LoadOptions); + + /* Find the first \, separating the ARC path from NT path */ + BootPath = strchr(CommandLine, '\\'); + *BootPath = ANSI_NULL; + strncpy(BldrArcBootPath, CommandLine, 63); + LoaderBlock->ArcBootDeviceName = BldrArcBootPath; + + /* The rest of the string is the NT path */ + HalPath = strchr(BootPath + 1, ' '); + *HalPath = ANSI_NULL; + BldrNtBootPath[0] = '\\'; + strncat(BldrNtBootPath, BootPath + 1, 63); + strcat(BldrNtBootPath,"\\"); + LoaderBlock->NtBootPathName = BldrNtBootPath; + + /* Set the HAL paths */ + strncpy(BldrArcHalPath, BldrArcBootPath, 63); + LoaderBlock->ArcHalDeviceName = BldrArcHalPath; + strcpy(BldrNtHalPath, "\\"); + LoaderBlock->NtHalPathName = BldrNtHalPath; + + /* Use this new command line */ + strncpy(LoaderBlock->LoadOptions, HalPath + 2, 255); + + /* Parse it and change every slash to a space */ + BootPath = LoaderBlock->LoadOptions; + do {if (*BootPath == '/') *BootPath = ' ';} while (*BootPath++); } VOID Modified: trunk/reactos/ntoskrnl/po/power.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=24…
============================================================================== --- trunk/reactos/ntoskrnl/po/power.c (original) +++ trunk/reactos/ntoskrnl/po/power.c Mon Oct 2 09:40:36 2006 @@ -307,9 +307,20 @@ INIT_FUNCTION NTAPI PoInit(BOOLEAN HaveAcpiTable, - BOOLEAN ForceAcpiDisable) + IN PLOADER_PARAMETER_BLOCK LoaderBlock) { PVOID NotificationEntry; + PCHAR CommandLine; + BOOLEAN ForceAcpiDisable = FALSE; + + /* Get the Command Line */ + CommandLine = KeLoaderBlock->LoadOptions; + + /* Upcase it */ + _strupr(CommandLine); + + /* Check for ACPI disable */ + if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE; if (ForceAcpiDisable) {
18 years, 2 months
1
0
0
0
[arty] 24357: A 'boot logo' of sorts to show we're about to switch to kernel mode. We'll pass the FB address into kernel land so we can continue writing on it.
by arty@svn.reactos.org
Author: arty Date: Mon Oct 2 02:57:16 2006 New Revision: 24357 URL:
http://svn.reactos.org/svn/reactos?rev=24357&view=rev
Log: A 'boot logo' of sorts to show we're about to switch to kernel mode. We'll pass the FB address into kernel land so we can continue writing on it. Added: branches/powerpc/reactos/include/reactos/ppcboot.h Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.c branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.h Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c Mon Oct 2 02:57:16 2006 @@ -201,11 +201,31 @@ } } +/* Appropriated from linux' btext.c + * author: + * Benjamin Herrenschmidt <benh(a)kernel.crashing.org> + */ VOID PpcVideoPrepareForReactOS() { - int i, j, display_handle, display_size = 0; + int i, j, k, /* display_handle, */ display_package, display_size = 0; int node, ret, elts; - pci_reg_property display_regs[8]; + int device_address; + //pci_reg_property display_regs[8]; char type[256], path[256], name[256]; + char logo[] = { + " " + " XXXXXX " + " X X " + " X X X X " + " X X " + " X XXXX X " + " X XX X " + " X X " + " XXXXXX " + " " + }; + int logo_x = 10, logo_y = 10; + int logo_scale_x = 8, logo_scale_y = 8; + for( node = ofw_finddevice("/"); prom_next_node(&node); ) { memset(type, 0, sizeof(type)); @@ -231,62 +251,56 @@ } printf("Opening display package: %s\n", path); - - display_handle = ofw_open(path); - - printf("display handle %x\n", display_handle); + display_package = ofw_finddevice(path); + printf("display package %x\n", display_package); BootInfo.dispDeviceRect[0] = BootInfo.dispDeviceRect[1] = 0; - ofw_getprop(display_handle, "width", + ofw_getprop(display_package, "width", (void *)&BootInfo.dispDeviceRect[2], sizeof(int)); - ofw_getprop(display_handle, "height", + ofw_getprop(display_package, "height", (void *)&BootInfo.dispDeviceRect[3], sizeof(int)); - ofw_getprop(display_handle, "depth", + ofw_getprop(display_package, "depth", (void *)&BootInfo.dispDeviceDepth, sizeof(int)); - ofw_getprop(display_handle, "linebytes", + ofw_getprop(display_package, "linebytes", (void *)&BootInfo.dispDeviceRowBytes, sizeof(int)); + BootInfo.dispDeviceRect[2] = REV(BootInfo.dispDeviceRect[2]); + BootInfo.dispDeviceRect[3] = REV(BootInfo.dispDeviceRect[3]); + BootInfo.dispDeviceDepth = REV(BootInfo.dispDeviceDepth); + BootInfo.dispDeviceRowBytes = REV(BootInfo.dispDeviceRowBytes); + if(ofw_getprop - (display_handle, + (display_package, "address", - (void *)&BootInfo.dispDeviceBase, - sizeof(BootInfo.dispDeviceBase)) > 0) { - goto finish; - } - - if((elts = ofw_getprop(display_handle, - "assigned-addresses", - (void *)display_regs, - sizeof(display_regs))) <= 0) { - printf("Could not get assigned addresses\n"); + (void *)&device_address, + sizeof(device_address)) < 1) { + printf("Could not get device base\n"); return; } - elts /= sizeof(display_regs[0]); - for( i = 0; i < elts; i++ ) { - display_size = display_regs[i].size_lo; - if( display_size >= (1 << 20) ) { - BootInfo.dispDeviceBase = (void *)display_regs[i].addr.a_lo; - - /* Map pages for display at some location */ - BootInfo.logicalDisplayBase = (void *)0xc0000000; - - for( i = 0; i < display_size; i += (1 << 12) ) { - InsertPageEntry((ULONG_PTR)((PCHAR)BootInfo.logicalDisplayBase)+i, - (ULONG_PTR)((PCHAR)BootInfo.dispDeviceBase)+i); + BootInfo.dispDeviceBase = (PVOID)(REV(device_address)); + + display_size = BootInfo.dispDeviceRowBytes * BootInfo.dispDeviceRect[3]; + + printf("Display size is %x bytes (%x per row times %x rows)\n", + display_size, + BootInfo.dispDeviceRowBytes, + BootInfo.dispDeviceRect[3]); + + printf("display is at %x\n", BootInfo.dispDeviceBase); + + for( i = 0; i < logo_y * logo_scale_y; i++ ) { + for( j = 0; j < logo_x * logo_scale_x; j++ ) { + elts = (j/logo_scale_x) + ((i/logo_scale_y) * logo_x); + + for( k = 0; k < BootInfo.dispDeviceDepth/8; k++ ) { + SetPhysByte(((ULONG_PTR)BootInfo.dispDeviceBase)+ + k + + ((j * (BootInfo.dispDeviceDepth/8)) + + (i * (BootInfo.dispDeviceRowBytes))), + logo[elts] == ' ' ? 0 : 255); } - } - } - -finish: - /* Draw something ... */ - elts = 0; - for( i = 0; i < BootInfo.dispDeviceRect[3]; i++ ) { - for( j = 0; j < BootInfo.dispDeviceRect[2]; j++ ) { - ((PCHAR)BootInfo.logicalDisplayBase) - [(j * (BootInfo.dispDeviceDepth/8)) + - (i * (BootInfo.dispDeviceRowBytes))] = elts++; } } } Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.c URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.c Mon Oct 2 02:57:16 2006 @@ -4,6 +4,12 @@ inline int GetMSR() { register int res asm ("r3"); __asm__("mfmsr 3"); + return res; +} + +inline int GetDEC() { + register int res asm ("r3"); + __asm__("mfdec 3"); return res; } @@ -15,8 +21,12 @@ "xori 3,3,4\n\t" /* Undo effects of LE without swapping */ "andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */ "mtmsr 6\n\t" + "isync\n\t" + "sync\n\t" "lwz 3,0(3)\n\t" /* Get actual value at phys addr r3 */ "mtmsr 5\n\t" + "isync\n\t" + "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" @@ -31,8 +41,35 @@ "xori 3,3,4\n\t" /* Undo effects of LE without swapping */ "andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */ "mtmsr 6\n\t" - "stw 4,0(3)\n\t" /* Get actual value at phys addr r3 */ + "sync\n\t" + "eieio\n\t" + "stw 4,0(3)\n\t" /* Set actual value at phys addr r3 */ + "dcbst 0,3\n\t" "mtmsr 5\n\t" + "sync\n\t" + "eieio\n\t" + "mr 3,4\n\t" + "lwz 0,0(1)\n\t" + "addi 1,1,16\n\t" + "mtlr 0\n\t" + "blr" + ); + +__asm__("\t.globl SetPhysByte\n" + "SetPhysByte:\t\n" + "mflr 0\n\t" + "stwu 0,-16(1)\n\t" + "mfmsr 5\n\t" + "xori 3,3,7\n\t" /* Undo effects of LE without swapping */ + "andi. 6,5,0xffef\n\t"/* turn off MSR[DR] */ + "mtmsr 6\n\t" + "sync\n\t" + "eieio\n\t" + "stb 4,0(3)\n\t" /* Set actual value at phys addr r3 */ + "dcbst 0,3\n\t" + "mtmsr 5\n\t" + "sync\n\t" + "eieio\n\t" "mr 3,4\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" @@ -183,6 +220,7 @@ break; } } + __asm__("isync\n\tsync"); } inline int GetSDR1() { Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.h URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.h (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mmu.h Mon Oct 2 02:57:16 2006 @@ -1,9 +1,11 @@ #ifndef FREELDR_MMU_H #define FREELDR_MMU_H +int GetDEC(); int GetMSR(); int GetPhys( int addr ); void SetPhys( int addr, int val ); +void SetPhysByte( int addr, int val ); int GetSR(int n); void GetBat( int bat, int inst, int *batHi, int *batLo ); void SetBat( int bat, int inst, int batHi, int batLo ); Added: branches/powerpc/reactos/include/reactos/ppcboot.h URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos…
============================================================================== --- branches/powerpc/reactos/include/reactos/ppcboot.h (added) +++ branches/powerpc/reactos/include/reactos/ppcboot.h Mon Oct 2 02:57:16 2006 @@ -1,0 +1,11 @@ +#ifndef REACTOS_PPCBOOT_H +#define REACTOS_PPCBOOT_H + +typedef struct _boot_infos_t { + int dispDeviceRect[4]; + int dispDeviceRowBytes; + int dispDeviceDepth; + void *dispDeviceBase; +} boot_infos_t; + +#endif/*REACTOS_PPCBOOT_H*/
18 years, 2 months
1
0
0
0
[fireball] 24356: - Add a check to the boot.ini-changing code, to prevent creation of a new ReactOS entry after each installation.
by fireball@svn.reactos.org
Author: fireball Date: Mon Oct 2 01:48:05 2006 New Revision: 24356 URL:
http://svn.reactos.org/svn/reactos?rev=24356&view=rev
Log: - Add a check to the boot.ini-changing code, to prevent creation of a new ReactOS entry after each installation. Modified: trunk/reactos/base/setup/usetup/bootsup.c Modified: trunk/reactos/base/setup/usetup/bootsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/bootsup.…
============================================================================== --- trunk/reactos/base/setup/usetup/bootsup.c (original) +++ trunk/reactos/base/setup/usetup/bootsup.c Mon Oct 2 01:48:05 2006 @@ -1665,6 +1665,7 @@ PINICACHESECTION Section = NULL; NTSTATUS Status; ULONG FileAttribute; + PWCHAR OldValue = NULL; RtlInitUnicodeString(&Name, BootIniPath); @@ -1685,11 +1686,20 @@ return(STATUS_UNSUCCESSFUL); } - IniCacheInsertKey(Section, + /* Check - maybe record already exists */ + Status = IniCacheGetKey(Section, + EntryName, + &OldValue); + + /* If either key was not found, or contains something else - add new one */ + if (!NT_SUCCESS(Status) || wcscmp(OldValue, EntryValue)) + { + IniCacheInsertKey(Section, NULL, INSERT_LAST, EntryName, EntryValue); + } Status = UnprotectBootIni(BootIniPath, &FileAttribute);
18 years, 2 months
1
0
0
0
[amunger] 24355: Resource sync from trunk. Merged 24269, 24281, 24285, 24292, 24294-24295, 24298-24299, and 24303.
by amunger@svn.reactos.org
Author: amunger Date: Mon Oct 2 01:32:47 2006 New Revision: 24355 URL:
http://svn.reactos.org/svn/reactos?rev=24355&view=rev
Log: Resource sync from trunk. Merged 24269, 24281, 24285, 24292, 24294-24295, 24298-24299, and 24303. Added: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/res/ - copied from r24299, trunk/reactos/dll/win32/setupapi/res/ branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/134.ico - copied unchanged from r24295, trunk/reactos/dll/win32/shell32/res/icons/134.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/40.ico - copied unchanged from r24295, trunk/reactos/dll/win32/shell32/res/icons/40.ico Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Bg.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Cs.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Da.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/De.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/En.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Eo.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Es.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Fi.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Fr.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Hu.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/It.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ja.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ko.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Nl.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/No.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Pl.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Pt.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ru.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Sv.rc branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Tr.rc Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Cs.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Da.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/De.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/En.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Es.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Fi.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Fr.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Gr.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Hu.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/It.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Ja.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Nl.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Pl.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Pt.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Ru.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Si.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Sk.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Sv.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Th.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Uk.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Wa.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Zh.rc (contents, props changed) branches/ros-branch-0_3_1/reactos/dll/cpl/hdwwiz/resources/applet.ico branches/ros-branch-0_3_1/reactos/dll/cpl/intl/resources/applet.ico branches/ros-branch-0_3_1/reactos/dll/cpl/intl_new/resources/applet.ico branches/ros-branch-0_3_1/reactos/dll/cpl/powercfg/resources/ac.ico branches/ros-branch-0_3_1/reactos/dll/cpl/sysdm/resources/applet.ico branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Cz.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/De.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Dk.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/En.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Fr.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Gr.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Hu.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/It.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Ja.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Nl.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Pl.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Ru.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Sv.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Uk.rc branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/resources/applet.ico branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/resource.h branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/setupapi.rc branches/ros-branch-0_3_1/reactos/dll/win32/shell32/icon_res.rc branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/10.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/11.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/25.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/328.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/6.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/7.ico branches/ros-branch-0_3_1/reactos/dll/win32/shell32/shresdef.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Cs.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Da.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/De.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/En.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Es.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Fi.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Fr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Gr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Hu.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/It.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Ja.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Nl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Pl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Pt.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Ru.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Si.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Sk.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Sv.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Th.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Uk.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Wa.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/base/applications/notepad/lang/Zh.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/hdwwiz/resources/applet.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/intl/resources/applet.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/intl_new/resources/applet.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/powercfg/resources/ac.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/sysdm/resources/applet.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Cz.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/De.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Dk.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/En.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Fr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Gr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Hu.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/It.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Ja.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Nl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Pl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Ru.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Sv.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/Uk.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Modified: branches/ros-branch-0_3_1/reactos/dll/cpl/timedate/resources/applet.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/cp…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Bg.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Cs.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Da.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/De.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/En.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Eo.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Es.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Fi.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Fr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Hu.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/It.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ja.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ko.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Nl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/No.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Pl.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Pt.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Ru.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Sv.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Removed: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/Tr.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/resource.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/setupapi/setupapi.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/icon_res.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/10.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/11.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/25.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/328.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/6.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/res/icons/7.ico URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
Modified: branches/ros-branch-0_3_1/reactos/dll/win32/shell32/shresdef.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
18 years, 2 months
1
0
0
0
[fireball] 24354: - Implement loading of NLS data, SYSTEM hive data (just simple loading into memory, without any kind of parsing or even checking if that data is correct) - Add a function for creating a stub of hardware config (config consisting of only one node - root) - Implement two steps of LPB initialization (names Phase 0 and Phase 1 are used internally by me, and doesn't correspond to anything) - Implement a WinLdrSetupForNt, which allocates and initializes some specific structures (PCR,
by fireball@svn.reactos.org
Author: fireball Date: Mon Oct 2 01:15:15 2006 New Revision: 24354 URL:
http://svn.reactos.org/svn/reactos?rev=24354&view=rev
Log: - Implement loading of NLS data, SYSTEM hive data (just simple loading into memory, without any kind of parsing or even checking if that data is correct) - Add a function for creating a stub of hardware config (config consisting of only one node - root) - Implement two steps of LPB initialization (names Phase 0 and Phase 1 are used internally by me, and doesn't correspond to anything) - Implement a WinLdrSetupForNt, which allocates and initializes some specific structures (PCR, TSS, GDT, IDT) - Respectively enable calls to these functions from LoadAndBootWindows() Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c Mon Oct 2 01:15:15 2006 @@ -27,6 +27,422 @@ VOID DumpMemoryAllocMap(VOID); VOID WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock); +BOOLEAN +WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, + IN LPCSTR DirectoryPath, + IN LPCSTR AnsiFileName, + IN LPCSTR OemFileName, + IN LPCSTR LanguageFileName) +{ + CHAR FileName[255]; + PFILE AnsiFileHandle; + PFILE OemFileHandle; + PFILE LanguageFileHandle; + ULONG AnsiFileSize, OemFileSize, LanguageFileSize; + ULONG TotalSize; + ULONG_PTR NlsDataBase; + PVOID NlsVirtual; + BOOLEAN Status, AnsiEqualsOem = FALSE; + + /* There may be a case, when OEM and ANSI page coincide */ + if (!strcmp(AnsiFileName, OemFileName)) + AnsiEqualsOem = TRUE; + + /* Open file with ANSI and store its size */ + //Print(L"Loading %s...\n", Filename); + strcpy(FileName, DirectoryPath); + strcat(FileName, AnsiFileName); + AnsiFileHandle = FsOpenFile(FileName); + + if (AnsiFileHandle == NULL) + goto Failure; + + AnsiFileSize = FsGetFileSize(AnsiFileHandle); + DbgPrint((DPRINT_WINDOWS, "AnsiFileSize: %d\n", AnsiFileSize)); + FsCloseFile(AnsiFileHandle); + + /* Open OEM file and store its length */ + if (AnsiEqualsOem) + { + OemFileSize = 0; + } + else + { + //Print(L"Loading %s...\n", Filename); + strcpy(FileName, DirectoryPath); + strcat(FileName, OemFileName); + OemFileHandle = FsOpenFile(FileName); + + if (OemFileHandle == NULL) + goto Failure; + + OemFileSize = FsGetFileSize(OemFileHandle); + FsCloseFile(OemFileHandle); + } + DbgPrint((DPRINT_WINDOWS, "OemFileSize: %d\n", OemFileSize)); + + /* And finally open the language codepage file and store its length */ + //Print(L"Loading %s...\n", Filename); + strcpy(FileName, DirectoryPath); + strcat(FileName, LanguageFileName); + LanguageFileHandle = FsOpenFile(FileName); + + if (LanguageFileHandle == NULL) + goto Failure; + + LanguageFileSize = FsGetFileSize(LanguageFileHandle); + FsCloseFile(LanguageFileHandle); + DbgPrint((DPRINT_WINDOWS, "LanguageFileSize: %d\n", LanguageFileSize)); + + /* Sum up all three length, having in mind that every one of them + must start at a page boundary => thus round up each file to a page */ + TotalSize = MM_SIZE_TO_PAGES(AnsiFileSize) + + MM_SIZE_TO_PAGES(OemFileSize) + + MM_SIZE_TO_PAGES(LanguageFileSize); + + NlsDataBase = (ULONG_PTR)MmAllocateMemory(TotalSize*MM_PAGE_SIZE); + + if (NlsDataBase == 0) + goto Failure; + + NlsVirtual = (PVOID)(KSEG0_BASE | NlsDataBase); + LoaderBlock->NlsData->AnsiCodePageData = NlsVirtual; + LoaderBlock->NlsData->OemCodePageData = (PVOID)((PUCHAR)NlsVirtual + + (MM_SIZE_TO_PAGES(AnsiFileSize) << MM_PAGE_SHIFT)); + LoaderBlock->NlsData->UnicodeCodePageData = (PVOID)((PUCHAR)NlsVirtual + + (MM_SIZE_TO_PAGES(AnsiFileSize) << MM_PAGE_SHIFT) + + (MM_SIZE_TO_PAGES(OemFileSize) << MM_PAGE_SHIFT)); + + /* Ansi and OEM data are the same - just set pointers to the same area */ + if (AnsiEqualsOem) + LoaderBlock->NlsData->OemCodePageData = LoaderBlock->NlsData->AnsiCodePageData; + + + /* Now actually read the data into memory, starting with Ansi file */ + strcpy(FileName, DirectoryPath); + strcat(FileName, AnsiFileName); + AnsiFileHandle = FsOpenFile(FileName); + + if (AnsiFileHandle == NULL) + goto Failure; + + Status = FsReadFile(AnsiFileHandle, AnsiFileSize, NULL, VaToPa(LoaderBlock->NlsData->AnsiCodePageData)); + + if (!Status) + goto Failure; + + FsCloseFile(AnsiFileHandle); + + /* OEM now, if it doesn't equal Ansi of course */ + if (!AnsiEqualsOem) + { + strcpy(FileName, DirectoryPath); + strcat(FileName, OemFileName); + OemFileHandle = FsOpenFile(FileName); + + if (OemFileHandle == NULL) + goto Failure; + + Status = FsReadFile(OemFileHandle, OemFileSize, NULL, VaToPa(LoaderBlock->NlsData->OemCodePageData)); + + if (!Status) + goto Failure; + + FsCloseFile(AnsiFileHandle); + } + + /* finally the language file */ + strcpy(FileName, DirectoryPath); + strcat(FileName, LanguageFileName); + LanguageFileHandle = FsOpenFile(FileName); + + if (LanguageFileHandle == NULL) + goto Failure; + + Status = FsReadFile(LanguageFileHandle, LanguageFileSize, NULL, VaToPa(LoaderBlock->NlsData->UnicodeCodePageData)); + + if (!Status) + goto Failure; + + FsCloseFile(LanguageFileHandle); + + // + // THIS IS HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACK + // Should go to WinLdrLoadOemHalFont(), when it will be implemented + // + LoaderBlock->OemFontFile = VaToPa(LoaderBlock->NlsData->UnicodeCodePageData); + + /* Convert NlsTables address to VA */ + LoaderBlock->NlsData = PaToVa(LoaderBlock->NlsData); + + return TRUE; + +Failure: + //UiMessageBox("Error reading NLS file %s\n", Filename); + UiMessageBox("Error reading NLS file!"); + return FALSE; +} + +BOOLEAN +WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, + IN LPCSTR DirectoryPath, + IN LPCSTR HiveName) +{ + PFILE FileHandle; + CHAR FullHiveName[256]; + BOOLEAN Status; + ULONG HiveFileSize; + ULONG_PTR HiveDataPhysical; + PVOID HiveDataVirtual; + + /* Concatenate path and filename to get the full name */ + strcpy(FullHiveName, DirectoryPath); + strcat(FullHiveName, HiveName); + //Print(L"Loading %s...\n", FullHiveName); + FileHandle = FsOpenFile(FullHiveName); + + if (FileHandle == NULL) + { + UiMessageBox("Opening hive file failed!"); + return FALSE; + } + + /* Get the file length */ + HiveFileSize = FsGetFileSize(FileHandle); + + if (HiveFileSize == 0) + { + FsCloseFile(FileHandle); + UiMessageBox("Hive file has 0 size!"); + return FALSE; + } + + /* Round up the size to page boundary and alloc memory */ + HiveDataPhysical = (ULONG_PTR)MmAllocateMemory( + MM_SIZE_TO_PAGES(HiveFileSize + MM_PAGE_SIZE - 1) << MM_PAGE_SHIFT); + + if (HiveDataPhysical == 0) + { + FsCloseFile(FileHandle); + UiMessageBox("Unable to alloc memory for a hive!"); + return FALSE; + } + + /* Convert address to virtual */ + HiveDataVirtual = (PVOID)(KSEG0_BASE | HiveDataPhysical); + + /* Fill LoaderBlock's entries */ + LoaderBlock->RegistryLength = HiveFileSize; + LoaderBlock->RegistryBase = HiveDataVirtual; + + /* Finally read from file to the memory */ + Status = FsReadFile(FileHandle, HiveFileSize, NULL, (PVOID)HiveDataPhysical); + FsCloseFile(FileHandle); + if (!Status) + { + UiMessageBox("Unable to read from hive file!"); + return FALSE; + } + + return TRUE; +} + +void InitializeHWConfig(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PCONFIGURATION_COMPONENT_DATA ConfigurationRoot; + PCONFIGURATION_COMPONENT Component; + PCONFIGURATION_COMPONENT_DATA /*CurrentEntry,*/ PreviousEntry, AdapterEntry; + BOOLEAN IsNextEntryChild; + + DbgPrint((DPRINT_WINDOWS, "InitializeHWConfig()\n")); + + LoaderBlock->ConfigurationRoot = MmAllocateMemory(sizeof(CONFIGURATION_COMPONENT_DATA)); + RtlZeroMemory(LoaderBlock->ConfigurationRoot, sizeof(CONFIGURATION_COMPONENT_DATA)); + + /* Fill root == SystemClass */ + ConfigurationRoot = LoaderBlock->ConfigurationRoot; + Component = &LoaderBlock->ConfigurationRoot->ComponentEntry; + + Component->Class = SystemClass; + Component->Type = MaximumType; + Component->Version = 0; // FIXME: ? + Component->Key = 0; + Component->AffinityMask = 0; + + IsNextEntryChild = TRUE; + PreviousEntry = ConfigurationRoot; + + /* Enumerate all PCI buses */ + AdapterEntry = ConfigurationRoot; + + /* TODO: Disk Geometry */ + /* TODO: Keyboard */ + + /* TODO: Serial port */ + + //Config->ConfigurationData = alloc(sizeof(CONFIGURATION_COMPONENT_DATA), EfiLoaderData); + + /* Convert everything to VA */ + ConvertConfigToVA(LoaderBlock->ConfigurationRoot); + LoaderBlock->ConfigurationRoot = PaToVa(LoaderBlock->ConfigurationRoot); +} + + +// Init "phase 0" +VOID +AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK *OutLoaderBlock) +{ + PLOADER_PARAMETER_BLOCK LoaderBlock; + + /* Allocate and zero-init the LPB */ + LoaderBlock = MmAllocateMemory(sizeof(LOADER_PARAMETER_BLOCK)); + RtlZeroMemory(LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK)); + + /* Init three critical lists, used right away */ + InitializeListHead(&LoaderBlock->LoadOrderListHead); + InitializeListHead(&LoaderBlock->MemoryDescriptorListHead); + InitializeListHead(&LoaderBlock->BootDriverListHead); + + + *OutLoaderBlock = LoaderBlock; +} + +// Init "phase 1" +VOID +WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + //CHAR Options[] = "/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200"; + CHAR Options[] = "/NODEBUG"; + CHAR SystemRoot[] = "\\WINNT"; + CHAR HalPath[] = "\\"; + CHAR ArcBoot[] = "multi(0)"; + CHAR ArcHal[] = "multi(0)"; + + PLOADER_PARAMETER_EXTENSION Extension; + + LoaderBlock->u.I386.CommonDataArea = NULL; // Force No ABIOS support + + /* Fill Arc BootDevice */ + LoaderBlock->ArcBootDeviceName = MmAllocateMemory(strlen(ArcBoot)+1); + strcpy(LoaderBlock->ArcBootDeviceName, ArcBoot); + LoaderBlock->ArcBootDeviceName = PaToVa(LoaderBlock->ArcBootDeviceName); + + /* Fill Arc HalDevice */ + LoaderBlock->ArcHalDeviceName = MmAllocateMemory(strlen(ArcHal)+1); + strcpy(LoaderBlock->ArcHalDeviceName, ArcHal); + LoaderBlock->ArcHalDeviceName = PaToVa(LoaderBlock->ArcHalDeviceName); + + /* Fill SystemRoot */ + LoaderBlock->NtBootPathName = MmAllocateMemory(strlen(SystemRoot)+1); + strcpy(LoaderBlock->NtBootPathName, SystemRoot); + LoaderBlock->NtBootPathName = PaToVa(LoaderBlock->NtBootPathName); + + /* Fill NtHalPathName */ + LoaderBlock->NtHalPathName = MmAllocateMemory(strlen(HalPath)+1); + strcpy(LoaderBlock->NtHalPathName, HalPath); + LoaderBlock->NtHalPathName = PaToVa(LoaderBlock->NtHalPathName); + + /* Fill load options */ + LoaderBlock->LoadOptions = MmAllocateMemory(strlen(Options)+1); + strcpy(LoaderBlock->LoadOptions, Options); + LoaderBlock->LoadOptions = PaToVa(LoaderBlock->LoadOptions); + + /* Arc devices */ + LoaderBlock->ArcDiskInformation = (PARC_DISK_INFORMATION)MmAllocateMemory(sizeof(ARC_DISK_INFORMATION)); + InitializeListHead(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead); + List_PaToVa(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead); + LoaderBlock->ArcDiskInformation = PaToVa(LoaderBlock->ArcDiskInformation); + + /* Alloc space for NLS (it will be converted to VA in WinLdrLoadNLS) */ + LoaderBlock->NlsData = MmAllocateMemory(sizeof(NLS_DATA_BLOCK)); + if (LoaderBlock->NlsData == NULL) + { + UiMessageBox("Failed to allocate memory for NLS table data!"); + return; + } + RtlZeroMemory(LoaderBlock->NlsData, sizeof(NLS_DATA_BLOCK)); + + /* Create configuration entries */ + InitializeHWConfig(LoaderBlock); + + /* Convert all DTE into virtual addresses */ + //TODO: !!! + + /* Convert all list's to Virtual address */ + List_PaToVa(&LoaderBlock->LoadOrderListHead); + + /* this one will be converted right before switching to + virtual paging mode */ + //List_PaToVa(&LoaderBlock->MemoryDescriptorListHead); + + List_PaToVa(&LoaderBlock->BootDriverListHead); + + /* Initialize Extension now */ + Extension = MmAllocateMemory(sizeof(LOADER_PARAMETER_EXTENSION)); + if (Extension == NULL) + { + UiMessageBox("Failed to allocate LPB Extension!"); + return; + } + RtlZeroMemory(Extension, sizeof(LOADER_PARAMETER_EXTENSION)); + + Extension->Size = sizeof(LOADER_PARAMETER_EXTENSION); + Extension->MajorVersion = 4; + Extension->MinorVersion = 0; + + + LoaderBlock->Extension = PaToVa(Extension); +} + +// Last step before going virtual +void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock, + PVOID *GdtIdt, + ULONG *PcrBasePage, + ULONG *TssBasePage) +{ + ULONG TssSize; + ULONG TssPages; + ULONG_PTR Pcr = 0; + ULONG_PTR Tss = 0; + ULONG BlockSize, NumPages; + + LoaderBlock->u.I386.CommonDataArea = NULL;//CommonDataArea; + //LoaderBlock->u.I386.MachineType = MachineType; //FIXME: MachineType? + + /* Allocate 2 pages for PCR */ + Pcr = (ULONG_PTR)MmAllocateMemory(2 * MM_PAGE_SIZE); + *PcrBasePage = Pcr >> MM_PAGE_SHIFT; + + if (Pcr == 0) + { + UiMessageBox("Can't allocate PCR\n"); + return; + } + + /* Allocate TSS */ + TssSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1); + TssPages = TssSize / MM_PAGE_SIZE; + + Tss = (ULONG_PTR)MmAllocateMemory(TssSize); + + *TssBasePage = Tss >> MM_PAGE_SHIFT; + + /* Allocate space for new GDT + IDT */ + BlockSize = NUM_GDT*sizeof(KGDTENTRY) + NUM_IDT*sizeof(KIDTENTRY);//FIXME: Use GDT/IDT limits here? + NumPages = (BlockSize + MM_PAGE_SIZE - 1) >> MM_PAGE_SHIFT; + *GdtIdt = (PKGDTENTRY)MmAllocateMemory(NumPages * MM_PAGE_SIZE); + + if (*GdtIdt == NULL) + { + UiMessageBox("Can't allocate pages for GDT+IDT!\n"); + return; + } + + /* Zero newly prepared GDT+IDT */ + RtlZeroMemory(*GdtIdt, NumPages << MM_PAGE_SHIFT); +} + + VOID LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion) { @@ -96,7 +512,7 @@ DbgPrint((DPRINT_WINDOWS,"SystemRoot: '%s'\n", BootPath)); /* Allocate and minimalistic-initialize LPB */ - //AllocateAndInitLPB(&LoaderBlock); + AllocateAndInitLPB(&LoaderBlock); // Load kernel strcpy(FileName, BootPath); @@ -122,19 +538,19 @@ WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); /* Initialize Phase 1 - before NLS */ - //WinLdrInitializePhase1(LoaderBlock); + WinLdrInitializePhase1(LoaderBlock); /* Load SYSTEM hive and its LOG file */ strcpy(SearchPath, BootPath); strcat(SearchPath, "SYSTEM32\\CONFIG\\"); - //Status = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM"); + Status = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM"); DbgPrint((DPRINT_WINDOWS, "SYSTEM hive loaded with status %d\n", Status)); /* Load NLS data */ strcpy(SearchPath, BootPath); strcat(SearchPath, "SYSTEM32\\"); - //Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, - // "c_1252.nls", "c_437.nls", "l_intl.nls"); + Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, + "c_1252.nls", "c_437.nls", "l_intl.nls"); DbgPrint((DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status)); /* Load OEM HAL font */ @@ -142,7 +558,7 @@ /* Load boot drivers */ /* Alloc PCR, TSS, do magic things with the GDT/IDT */ - //WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage); + WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage); /* Save entry-point pointer (VA) */ KiSystemStartup = (KERNEL_ENTRY_POINT)KernelDTE->EntryPoint;
18 years, 2 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Results per page:
10
25
50
100
200