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
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
August 2008
----- 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
27 participants
853 discussions
Start a n
N
ew thread
[hpoussin] 35534: Calling IoSynchronousInvalidateDeviceRelations with type TargetDeviceRelation returns success. Spotted by Alex
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Aug 22 14:06:25 2008 New Revision: 35534 URL:
http://svn.reactos.org/svn/reactos?rev=35534&view=rev
Log: Calling IoSynchronousInvalidateDeviceRelations with type TargetDeviceRelation returns success. Spotted by Alex Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Fri Aug 22 14:06:25 2008 @@ -3400,8 +3400,11 @@ case PowerRelations: /* Not handled yet */ return STATUS_NOT_IMPLEMENTED; + case TargetDeviceRelation: + /* Nothing to do */ + return STATUS_SUCCESS; default: - /* Ejection relations and target relations are not supported */ + /* Ejection relations are not supported */ return STATUS_NOT_SUPPORTED; } }
16 years, 1 month
1
0
0
0
[hpoussin] 35533: Move most of the code of IoSynchronousInvalidateDeviceRelations to IopEnumerateDevice, and use it when possible Fix IoSynchronousInvalidateDeviceRelations prototype
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Aug 22 14:00:31 2008 New Revision: 35533 URL:
http://svn.reactos.org/svn/reactos?rev=35533&view=rev
Log: Move most of the code of IoSynchronousInvalidateDeviceRelations to IopEnumerateDevice, and use it when possible Fix IoSynchronousInvalidateDeviceRelations prototype Modified: trunk/reactos/include/ndk/iofuncs.h trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/iomgr.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/include/ndk/iofuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/iofuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/iofuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/iofuncs.h [iso-8859-1] Fri Aug 22 14:00:31 2008 @@ -37,6 +37,13 @@ OUT PUCHAR NtSystemPath, OUT PSTRING NtSystemPathString ); + +NTSTATUS +NTAPI +IoSynchronousInvalidateDeviceRelations( + IN PDEVICE_OBJECT DeviceObject, + IN DEVICE_RELATION_TYPE Type +); #endif // 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 [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Fri Aug 22 14:00:31 2008 @@ -557,6 +557,11 @@ ); NTSTATUS +IopEnumerateDevice( + IN PDEVICE_OBJECT DeviceObject +); + +NTSTATUS IoCreateDriverList( VOID ); 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 [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Fri Aug 22 14:00:31 2008 @@ -15,14 +15,6 @@ ULONG IopTraceLevel = 0; BOOLEAN PnpSystemInit = FALSE; - -// should go into a proper header -VOID -NTAPI -IoSynchronousInvalidateDeviceRelations( - IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_RELATION_TYPE Type -); VOID NTAPI @@ -510,10 +502,8 @@ IopReinitializeBootDrivers(); /* Initialize PnP root relations */ - IoSynchronousInvalidateDeviceRelations(IopRootDeviceNode-> - PhysicalDeviceObject, - BusRelations); - + IopEnumerateDevice(IopRootDeviceNode->PhysicalDeviceObject); + /* Check if this was a ramdisk boot */ if (!_strnicmp(LoaderBlock->ArcBootDeviceName, "ramdisk(0)", 10)) { Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Fri Aug 22 14:00:31 2008 @@ -42,13 +42,6 @@ DEVICE_RELATION_TYPE Type; PIO_WORKITEM WorkItem; } INVALIDATE_DEVICE_RELATION_DATA, *PINVALIDATE_DEVICE_RELATION_DATA; - -VOID -NTAPI -IoSynchronousInvalidateDeviceRelations( - IN PDEVICE_OBJECT DeviceObject, - IN DEVICE_RELATION_TYPE Type); - /* FUNCTIONS *****************************************************************/ @@ -206,7 +199,7 @@ DPRINT("Device needs enumeration, invalidating bus relations\n"); /* Invalidate device relations synchronously (otherwise there will be dirty read of DeviceNode) */ - IoSynchronousInvalidateDeviceRelations(DeviceNode->PhysicalDeviceObject, BusRelations); + IopEnumerateDevice(DeviceNode->PhysicalDeviceObject); IopDeviceNodeClearFlag(DeviceNode, DNF_NEED_ENUMERATION_ONLY); } } @@ -1670,6 +1663,125 @@ return STATUS_SUCCESS; } + +NTSTATUS +IopEnumerateDevice( + IN PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); + DEVICETREE_TRAVERSE_CONTEXT Context; + PDEVICE_RELATIONS DeviceRelations; + IO_STATUS_BLOCK IoStatusBlock; + PDEVICE_NODE ChildDeviceNode; + IO_STACK_LOCATION Stack; + NTSTATUS Status; + ULONG i; + + DPRINT("DeviceObject 0x%p\n", DeviceObject); + + DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n"); + + Stack.Parameters.QueryDeviceRelations.Type = BusRelations; + + Status = IopInitiatePnpIrp( + DeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_DEVICE_RELATIONS, + &Stack); + if (!NT_SUCCESS(Status) || Status == STATUS_PENDING) + { + DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); + return Status; + } + + DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + + if (!DeviceRelations || DeviceRelations->Count < 0) + { + DPRINT("No PDOs\n"); + if (DeviceRelations) + { + ExFreePool(DeviceRelations); + } + return STATUS_UNSUCCESSFUL; + } + + DPRINT("Got %d PDOs\n", DeviceRelations->Count); + + /* + * Create device nodes for all discovered devices + */ + for (i = 0; i < DeviceRelations->Count; i++) + { + if (IopGetDeviceNode(DeviceRelations->Objects[i]) != NULL) + { + ObDereferenceObject(DeviceRelations->Objects[i]); + continue; + } + Status = IopCreateDeviceNode( + DeviceNode, + DeviceRelations->Objects[i], + NULL, + &ChildDeviceNode); + DeviceNode->Flags |= DNF_ENUMERATED; + if (!NT_SUCCESS(Status)) + { + DPRINT("No resources\n"); + for (i = 0; i < DeviceRelations->Count; i++) + ObDereferenceObject(DeviceRelations->Objects[i]); + ExFreePool(DeviceRelations); + return Status; + } + } + ExFreePool(DeviceRelations); + + /* + * Retrieve information about all discovered children from the bus driver + */ + IopInitDeviceTreeTraverseContext( + &Context, + DeviceNode, + IopActionInterrogateDeviceStack, + DeviceNode); + + Status = IopTraverseDeviceTree(&Context); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); + return Status; + } + + /* + * Retrieve configuration from the registry for discovered children + */ + IopInitDeviceTreeTraverseContext( + &Context, + DeviceNode, + IopActionConfigureChildServices, + DeviceNode); + + Status = IopTraverseDeviceTree(&Context); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); + return Status; + } + + /* + * Initialize services for discovered children. + */ + Status = IopInitializePnpServices(DeviceNode); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status); + return Status; + } + + DPRINT("IopEnumerateDevice() finished\n"); + return STATUS_SUCCESS; +} + + /* * IopActionConfigureChildServices * @@ -3272,120 +3384,24 @@ /* * @implemented */ -VOID +NTSTATUS NTAPI IoSynchronousInvalidateDeviceRelations( IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type) { - PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); - DEVICETREE_TRAVERSE_CONTEXT Context; - PDEVICE_RELATIONS DeviceRelations; - IO_STATUS_BLOCK IoStatusBlock; - PDEVICE_NODE ChildDeviceNode; - IO_STACK_LOCATION Stack; - NTSTATUS Status; - ULONG i; - - DPRINT("DeviceObject 0x%p\n", DeviceObject); - - DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n"); - - Stack.Parameters.QueryDeviceRelations.Type = Type; - - Status = IopInitiatePnpIrp( - DeviceObject, - &IoStatusBlock, - IRP_MN_QUERY_DEVICE_RELATIONS, - &Stack); - if (!NT_SUCCESS(Status)) + PAGED_CODE(); + + switch (Type) { - DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); - return; + case BusRelations: + /* Enumerate the device */ + return IopEnumerateDevice(DeviceObject); + case PowerRelations: + /* Not handled yet */ + return STATUS_NOT_IMPLEMENTED; + default: + /* Ejection relations and target relations are not supported */ + return STATUS_NOT_SUPPORTED; } - - DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; - - if (!DeviceRelations || DeviceRelations->Count <= 0) - { - DPRINT("No PDOs\n"); - if (DeviceRelations) - { - ExFreePool(DeviceRelations); - } - return; - } - - DPRINT("Got %d PDOs\n", DeviceRelations->Count); - - /* - * Create device nodes for all discovered devices - */ - for (i = 0; i < DeviceRelations->Count; i++) - { - if (IopGetDeviceNode(DeviceRelations->Objects[i]) != NULL) - { - ObDereferenceObject(DeviceRelations->Objects[i]); - continue; - } - Status = IopCreateDeviceNode( - DeviceNode, - DeviceRelations->Objects[i], - NULL, - &ChildDeviceNode); - DeviceNode->Flags |= DNF_ENUMERATED; - if (!NT_SUCCESS(Status)) - { - DPRINT("No resources\n"); - for (i = 0; i < DeviceRelations->Count; i++) - ObDereferenceObject(DeviceRelations->Objects[i]); - ExFreePool(DeviceRelations); - return; - } - } - ExFreePool(DeviceRelations); - - /* - * Retrieve information about all discovered children from the bus driver - */ - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionInterrogateDeviceStack, - DeviceNode); - - Status = IopTraverseDeviceTree(&Context); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); - return; - } - - /* - * Retrieve configuration from the registry for discovered children - */ - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionConfigureChildServices, - DeviceNode); - - Status = IopTraverseDeviceTree(&Context); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopTraverseDeviceTree() failed with status 0x%08lx\n", Status); - return; - } - - /* - * Initialize services for discovered children. - */ - Status = IopInitializePnpServices(DeviceNode); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status); - return; - } - - DPRINT("IopInvalidateDeviceRelations() finished\n"); -} +}
16 years, 1 month
1
0
0
0
[hpoussin] 35532: Clean up code by removing now useless parts Replace 3rd arg of IopActionInitChildServices by a global variable (removes a pointer cast) IopStartDevice: no need to get top of stack, IopInitiatePnpIrp does it for us
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Aug 22 12:47:13 2008 New Revision: 35532 URL:
http://svn.reactos.org/svn/reactos?rev=35532&view=rev
Log: Clean up code by removing now useless parts Replace 3rd arg of IopActionInitChildServices by a global variable (removes a pointer cast) IopStartDevice: no need to get top of stack, IopInitiatePnpIrp does it for us Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/iomgr/iomgr.c trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c 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 [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Fri Aug 22 12:47:13 2008 @@ -553,8 +553,7 @@ NTSTATUS IopActionInitChildServices( IN PDEVICE_NODE DeviceNode, - IN PVOID Context, - IN BOOLEAN BootDrivers + IN PVOID Context ); NTSTATUS @@ -579,8 +578,7 @@ NTSTATUS IopInitializePnpServices( - IN PDEVICE_NODE DeviceNode, - IN BOOLEAN BootDrivers); + IN PDEVICE_NODE DeviceNode); NTSTATUS NTAPI Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Fri Aug 22 12:47:13 2008 @@ -782,10 +782,6 @@ LPWSTR FileExtension; PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName; UNICODE_STRING ServiceName; -#if 1 // Disable for FreeLDR 2.5 - UNICODE_STRING ServiceNameWithExtension; - PLDR_DATA_TABLE_ENTRY ModuleObject; -#endif /* * Display 'Loading XXX...' message @@ -804,19 +800,6 @@ { FileNameWithoutPath++; } - - /* - * Load the module. - */ -#if 1 // Remove for FreeLDR 2.5. - RtlCreateUnicodeString(&ServiceNameWithExtension, FileNameWithoutPath); - Status = LdrProcessDriverModule(LdrEntry, &ServiceNameWithExtension, &ModuleObject); - if (!NT_SUCCESS(Status)) - { - CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); - return Status; - } -#endif /* * Strip the file extension from ServiceName @@ -844,7 +827,6 @@ /* * Initialize the driver */ - DeviceNode->Flags |= DN_DRIVER_LOADED; Status = IopInitializeDriverModule(DeviceNode, LdrEntry, &DeviceNode->ServiceName, FALSE, &DriverObject); @@ -1729,9 +1711,6 @@ /* Store its DriverSection, so that it could be unloaded */ DriverObject->DriverSection = ModuleObject; - - /* We have a driver for this DeviceNode */ - DeviceNode->Flags |= DN_DRIVER_LOADED; } IopInitializeDevice(DeviceNode, DriverObject); 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 [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Fri Aug 22 12:47:13 2008 @@ -14,6 +14,7 @@ #include <internal/debug.h> ULONG IopTraceLevel = 0; +BOOLEAN PnpSystemInit = FALSE; // should go into a proper header VOID @@ -535,9 +536,10 @@ #endif /* Load services for devices found by PnP manager */ - IopInitializePnpServices(IopRootDeviceNode, FALSE); + IopInitializePnpServices(IopRootDeviceNode); /* Load system start drivers */ + PnpSystemInit = TRUE; IopInitializeSystemDrivers(); /* Destroy the group driver list */ Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/plugpla…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] Fri Aug 22 12:47:13 2008 @@ -576,7 +576,7 @@ Status = IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent); if (NT_SUCCESS(Status)) - Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent, FALSE); + Status = IopActionInitChildServices(DeviceNode, DeviceNode->Parent); ObDereferenceObject(DeviceObject); Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Fri Aug 22 12:47:13 2008 @@ -24,6 +24,7 @@ RTL_AVL_TABLE PpDeviceReferenceTable; extern ULONG ExpInitializationPhase; +extern BOOLEAN PnpSystemInit; /* DATA **********************************************************************/ @@ -139,16 +140,13 @@ IO_STATUS_BLOCK IoStatusBlock; IO_STACK_LOCATION Stack; ULONG RequiredLength; - PDEVICE_OBJECT Fdo; NTSTATUS Status; - - Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject); IopDeviceNodeSetFlag(DeviceNode, DNF_ASSIGNING_RESOURCES); DPRINT("Sending IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device stack\n"); Stack.Parameters.FilterResourceRequirements.IoResourceRequirementList = DeviceNode->ResourceRequirements; Status = IopInitiatePnpIrp( - Fdo, + DeviceNode->PhysicalDeviceObject, &IoStatusBlock, IRP_MN_FILTER_RESOURCE_REQUIREMENTS, &Stack); @@ -190,7 +188,7 @@ KeEnterCriticalRegion(); Status = IopInitiatePnpIrp( - Fdo, + DeviceNode->PhysicalDeviceObject, &IoStatusBlock, IRP_MN_START_DEVICE, &Stack); @@ -213,10 +211,8 @@ } } - ObDereferenceObject(Fdo); - if (NT_SUCCESS(Status)) - DeviceNode->Flags |= DN_STARTED; + IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED); return Status; } @@ -1784,7 +1780,6 @@ * device is started */ DPRINT1("%wZ is using NULL driver\n", &DeviceNode->InstancePath); IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED); - DeviceNode->Flags |= DN_STARTED; } return STATUS_SUCCESS; } @@ -1805,8 +1800,6 @@ * Pointer to device node. * Context * Pointer to parent node to initialize child node services for. - * BootDrivers - * Load only driver marked as boot start. * * Remarks * If the driver image for a service is not loaded and initialized @@ -1819,14 +1812,13 @@ NTSTATUS IopActionInitChildServices(PDEVICE_NODE DeviceNode, - PVOID Context, - BOOLEAN BootDrivers) + PVOID Context) { PDEVICE_NODE ParentDeviceNode; NTSTATUS Status; - - DPRINT("IopActionInitChildServices(%p, %p, %d)\n", DeviceNode, Context, - BootDrivers); + BOOLEAN BootDrivers = !PnpSystemInit; + + DPRINT("IopActionInitChildServices(%p, %p)\n", DeviceNode, Context); ParentDeviceNode = (PDEVICE_NODE)Context; @@ -1900,8 +1892,6 @@ /* Driver is loaded and initialized at this point */ if (NT_SUCCESS(Status)) { - /* We have a driver for this DeviceNode */ - DeviceNode->Flags |= DN_DRIVER_LOADED; /* Attach lower level filter drivers. */ IopAttachFilterDrivers(DeviceNode, TRUE); /* Initialize the function driver for the device node */ @@ -1946,34 +1936,6 @@ } /* - * IopActionInitAllServices - * - * Initialize the service for all (direct) child nodes of a parent node. This - * function just calls IopActionInitChildServices with BootDrivers = FALSE. - */ - -NTSTATUS -IopActionInitAllServices(PDEVICE_NODE DeviceNode, - PVOID Context) -{ - return IopActionInitChildServices(DeviceNode, Context, FALSE); -} - -/* - * IopActionInitBootServices - * - * Initialize the boot start services for all (direct) child nodes of a - * parent node. This function just calls IopActionInitChildServices with - * BootDrivers = TRUE. - */ -NTSTATUS -IopActionInitBootServices(PDEVICE_NODE DeviceNode, - PVOID Context) -{ - return IopActionInitChildServices(DeviceNode, Context, TRUE); -} - -/* * IopInitializePnpServices * * Initialize services for discovered children @@ -1982,37 +1944,21 @@ * DeviceNode * Top device node to start initializing services. * - * BootDrivers - * When set to TRUE, only drivers marked as boot start will - * be loaded. Otherwise, all drivers will be loaded. - * * Return Value * Status */ NTSTATUS -IopInitializePnpServices(IN PDEVICE_NODE DeviceNode, - IN BOOLEAN BootDrivers) +IopInitializePnpServices(IN PDEVICE_NODE DeviceNode) { DEVICETREE_TRAVERSE_CONTEXT Context; - DPRINT("IopInitializePnpServices(%p, %d)\n", DeviceNode, BootDrivers); - - if (BootDrivers) - { - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionInitBootServices, - DeviceNode); - } - else - { - IopInitDeviceTreeTraverseContext( - &Context, - DeviceNode, - IopActionInitAllServices, - DeviceNode); - } + DPRINT("IopInitializePnpServices(%p)\n", DeviceNode); + + IopInitDeviceTreeTraverseContext( + &Context, + DeviceNode, + IopActionInitChildServices, + DeviceNode); return IopTraverseDeviceTree(&Context); } @@ -3051,12 +2997,11 @@ if (!NT_SUCCESS(Status)) { - DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength); ExFreePool(ValueInformation); if (Status == STATUS_BUFFER_OVERFLOW) return STATUS_BUFFER_TOO_SMALL; - else - return Status; + DPRINT1("Problem: Status=0x%08x, ResultLength = %d\n", Status, *ResultLength); + return Status; } /* FIXME: Verify the value (NULL-terminated, correct format). */ @@ -3339,10 +3284,6 @@ IO_STATUS_BLOCK IoStatusBlock; PDEVICE_NODE ChildDeviceNode; IO_STACK_LOCATION Stack; - BOOLEAN BootDrivers; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); - HANDLE Handle; NTSTATUS Status; ULONG i; @@ -3437,36 +3378,9 @@ } /* - * Get the state of the system boot. If the \\SystemRoot link isn't - * created yet, we will assume that it's possible to load only boot - * drivers. + * Initialize services for discovered children. */ - InitializeObjectAttributes( - &ObjectAttributes, - &LinkName, - 0, - NULL, - NULL); - Status = ZwOpenFile( - &Handle, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - 0, - 0); - if (NT_SUCCESS(Status)) - { - BootDrivers = FALSE; - ZwClose(Handle); - } - else - BootDrivers = TRUE; - - /* - * Initialize services for discovered children. Only boot drivers will - * be loaded from boot driver! - */ - Status = IopInitializePnpServices(DeviceNode, BootDrivers); + Status = IopInitializePnpServices(DeviceNode); if (!NT_SUCCESS(Status)) { DPRINT("IopInitializePnpServices() failed with status 0x%08lx\n", Status);
16 years, 1 month
1
0
0
0
[sginsberg] 35531: - Replace more magic values with symbolic constants - Fix a peculiar header duplication
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Aug 22 09:55:20 2008 New Revision: 35531 URL:
http://svn.reactos.org/svn/reactos?rev=35531&view=rev
Log: - Replace more magic values with symbolic constants - Fix a peculiar header duplication Modified: trunk/reactos/ntoskrnl/include/internal/i386/v86m.h trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S Modified: trunk/reactos/ntoskrnl/include/internal/i386/v86m.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/i386/v86m.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/i386/v86m.h [iso-8859-1] Fri Aug 22 09:55:20 2008 @@ -59,68 +59,3 @@ } KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME; #endif - -/* EOF */ -#ifndef __V86M_ -#define __V86M_ - -#include "ketypes.h" - -/* Emulate cli/sti instructions */ -#define KV86M_EMULATE_CLI_STI (0x1) -/* Allow the v86 mode code to access i/o ports */ -#define KV86M_ALLOW_IO_PORT_ACCESS (0x2) - -typedef struct _KV86M_REGISTERS -{ - /* - * General purpose registers - */ - ULONG Ebp; - ULONG Edi; - ULONG Esi; - ULONG Edx; - ULONG Ecx; - ULONG Ebx; - ULONG Eax; - ULONG Ds; - ULONG Es; - ULONG Fs; - ULONG Gs; - - /* - * Control registers - */ - ULONG Eip; - ULONG Cs; - ULONG Eflags; - ULONG Esp; - ULONG Ss; - - /* - * Control structures - */ - ULONG RecoveryAddress; - UCHAR RecoveryInstruction[4]; - ULONG Vif; - ULONG Flags; - PNTSTATUS PStatus; -} KV86M_REGISTERS, *PKV86M_REGISTERS; - -typedef struct _KV86M_TRAP_FRAME -{ - KTRAP_FRAME Tf; - - ULONG SavedExceptionStack; - - /* - * These are put on the top of the stack by the routine that entered - * v86 mode so the exception handlers can find the control information - */ - struct _KV86M_REGISTERS* regs; - ULONG orig_ebp; -} KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME; - -#endif - -/* EOF */ Modified: trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86m_sup.…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] Fri Aug 22 09:55:20 2008 @@ -203,7 +203,7 @@ _OpcodePUSHFV86: /* Get VDM state */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT mov eax, [eax] /* Get EFLAGS and mask out IF */ @@ -211,7 +211,7 @@ and eax, ~EFLAGS_INTERRUPT_MASK /* Mask align check and interrupt mask */ - and eax, EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK + and eax, EFLAGS_ALIGN_CHECK + EFLAGS_NESTED_TASK + EFLAGS_INTERRUPT_MASK or eax, edx /* Add IOPL Mask */ @@ -252,7 +252,7 @@ _OpcodePOPFV86: /* Get VDM state */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT /* Get flat ESP */ mov ecx, [ebp+KTRAP_FRAME_SS] @@ -279,8 +279,8 @@ /* Mask out EFLAGS */ and eax, ~EFLAGS_IOPL mov ebx, ebx - and ebx, ~0x4000 - and ecx, EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK + and ebx, ~EFLAGS_NESTED_TASK + and ecx, EFLAGS_ALIGN_CHECK + EFLAGS_NESTED_TASK + EFLAGS_INTERRUPT_MASK /* FIXME: Support VME */ @@ -314,7 +314,7 @@ pop eax /* Update the flags in the VDM State */ - LOCK and dword ptr [eax], ~(EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK) + LOCK and dword ptr [eax], ~(EFLAGS_ALIGN_CHECK + EFLAGS_NESTED_TASK + EFLAGS_INTERRUPT_MASK) LOCK or [eax], ecx /* Update EIP */ @@ -334,7 +334,7 @@ mov edx, [ebp+KTRAP_FRAME_EFLAGS] /* Remove the flag in the VDM State */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT mov ecx, [eax] LOCK and dword ptr [eax], ~EFLAGS_INTERRUPT_MASK @@ -349,7 +349,7 @@ /* Now mask out VIF and TF */ or eax, ecx - and edx, ~(EFLAGS_VIF + 0x4000 + EFLAGS_TF) + and edx, ~(EFLAGS_VIF + EFLAGS_NESTED_TASK + EFLAGS_TF) mov [ebp+KTRAP_FRAME_EFLAGS], edx /* Set the IOPL Mask */ @@ -422,7 +422,7 @@ _OpcodeIRETV86: /* Get the VDM State */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT /* Get flat ESP */ movzx ecx, word ptr [ebp+KTRAP_FRAME_SS] @@ -450,7 +450,7 @@ MaskEFlags: /* Mask out EFLAGS */ - and ebx, ~(EFLAGS_IOPL + EFLAGS_VIF + 0x4000 + EFLAGS_VIP) + and ebx, ~(EFLAGS_IOPL + EFLAGS_VIF + EFLAGS_NESTED_TASK + EFLAGS_VIP) mov ecx, ebx /* FIXME: Check for VME support */ @@ -595,7 +595,7 @@ _OpcodeCLIV86: /* Get VDM State */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT /* FIXME: Support VME */ @@ -616,7 +616,7 @@ _OpcodeSTIV86: /* Get VDM State */ - mov eax, 0x714 + mov eax, FIXED_NTVDMSTATE_LINEAR_PC_AT /* FIXME: Support VME */
16 years, 1 month
1
0
0
0
[jmorlan] 35530: - Extract the line-reading code in ProcessInput to a separate function (ReadLine) that the parser can call. Now line continuations (using ^ at the end of a line) and multi-line parenthesized blocks work. - ReadBatchLine: Don't strip the trailing \n, the parser needs it. Remove handling of :labels and @quiet commands, now done by the parser. - ReadCommand: Add a \n to the line. Move PrintPrompt call out, since the prompt shouldn't be printed for additional lines read in a command
by jmorlan@svn.reactos.org
Author: jmorlan Date: Fri Aug 22 09:37:11 2008 New Revision: 35530 URL:
http://svn.reactos.org/svn/reactos?rev=35530&view=rev
Log: - Extract the line-reading code in ProcessInput to a separate function (ReadLine) that the parser can call. Now line continuations (using ^ at the end of a line) and multi-line parenthesized blocks work. - ReadBatchLine: Don't strip the trailing \n, the parser needs it. Remove handling of :labels and @quiet commands, now done by the parser. - ReadCommand: Add a \n to the line. Move PrintPrompt call out, since the prompt shouldn't be printed for additional lines read in a command beyond the first. Modified: trunk/reactos/base/shell/cmd/batch.c trunk/reactos/base/shell/cmd/batch.h trunk/reactos/base/shell/cmd/cmd.c trunk/reactos/base/shell/cmd/cmd.h trunk/reactos/base/shell/cmd/cmdinput.c trunk/reactos/base/shell/cmd/parser.c Modified: trunk/reactos/base/shell/cmd/batch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.c?rev…
============================================================================== --- trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -332,10 +332,9 @@ * Set eflag to 0 if line is not to be echoed else 1 */ -LPTSTR ReadBatchLine (LPBOOL bLocalEcho) +LPTSTR ReadBatchLine () { LPTSTR first; - LPTSTR ip; /* No batch */ if (bc == NULL) @@ -428,8 +427,6 @@ *dp = _T('\0'); - *bLocalEcho = bEcho; - return textline; } @@ -446,14 +443,7 @@ } TRACE ("ReadBatchLine(): textline: \'%s\'\n", debugstr_aw(textline)); - /* Strip leading spaces and trailing space/control chars */ - for (first = textline; _istspace (*first); first++) - ; - - for (ip = first + _tcslen (first) - 1; _istspace (*ip) || _istcntrl (*ip); ip--) - ; - - *++ip = _T('\0'); + first = textline; /* cmd block over multiple lines (..) */ if (bc->bCmdBlock >= 0) @@ -488,22 +478,6 @@ } } - /* ignore labels and empty lines */ - if (*first == _T(':') || *first == 0) - continue; - - if (*first == _T('@')) - { - /* don't echo this line */ - do - first++; - while (_istspace (*first)); - - *bLocalEcho = 0; - } - else - *bLocalEcho = bEcho; - break; } Modified: trunk/reactos/base/shell/cmd/batch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.h?rev…
============================================================================== --- trunk/reactos/base/shell/cmd/batch.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/batch.h [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -44,7 +44,7 @@ LPTSTR BatchParams (LPTSTR, LPTSTR); VOID ExitBatch (LPTSTR); BOOL Batch (LPTSTR, LPTSTR, LPTSTR); -LPTSTR ReadBatchLine (LPBOOL); +LPTSTR ReadBatchLine(); VOID AddBatchRedirection(REDIRECTION **); #endif /* _BATCH_H_INCLUDED_ */ Modified: trunk/reactos/base/shell/cmd/cmd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=3…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -1239,60 +1239,86 @@ * */ +BOOL bNoInteractive; +BOOL bIsBatch; + +BOOL +ReadLine (TCHAR *commandline, BOOL bMore) +{ + TCHAR readline[CMDLINE_LENGTH]; + LPTSTR ip; + + /* if no batch input then... */ + if (!(ip = ReadBatchLine())) + { + if (bNoInteractive) + { + bExit = TRUE; + return FALSE; + } + + if (bMore) + { + ConOutPrintf(_T("More? ")); + } + else + { + /* JPP 19980807 - if echo off, don't print prompt */ + if (bEcho) + PrintPrompt(); + } + + ReadCommand (readline, CMDLINE_LENGTH - 1); + if (CheckCtrlBreak(BREAK_INPUT)) + { + ConOutPuts(_T("\n")); + return FALSE; + } + ip = readline; + bIsBatch = FALSE; + } + else + { + bIsBatch = TRUE; + } + + if (!SubstituteVars(ip, commandline, _T('%'), bIsBatch)) + return FALSE; + + /* FIXME: !vars! should be substituted later, after parsing. */ + if (!SubstituteVars(commandline, readline, _T('!'), bIsBatch)) + return FALSE; + _tcscpy(commandline, readline); + + return TRUE; +} + static INT ProcessInput (BOOL bFlag) { - TCHAR commandline[CMDLINE_LENGTH]; - TCHAR readline[CMDLINE_LENGTH]; - LPTSTR ip; - BOOL bEchoThisLine; - BOOL bIsBatch; - + PARSED_COMMAND *Cmd; + + bNoInteractive = bFlag; do { - /* if no batch input then... */ - if (!(ip = ReadBatchLine (&bEchoThisLine))) - { - if (bFlag) - return nErrorLevel; - - ReadCommand (readline, CMDLINE_LENGTH); - ip = readline; - bEchoThisLine = FALSE; - bIsBatch = FALSE; - } - else - { - bIsBatch = TRUE; - } - - /* skip leading blanks */ - while ( _istspace(*ip) ) - ++ip; - - if (!SubstituteVars(ip, commandline, _T('%'), bIsBatch)) + Cmd = ParseCommand(NULL); + if (!Cmd) continue; /* JPP 19980807 */ /* Echo batch file line */ - if (bEchoThisLine) + if (bIsBatch && bEcho && Cmd->Type != C_QUIET) { PrintPrompt (); - ConOutPuts (commandline); - } - - /* FIXME: !vars! should be substituted later, after parsing. */ - if (!SubstituteVars(commandline, readline, _T('!'), bIsBatch)) - continue; - _tcscpy(commandline, readline); - - if (!CheckCtrlBreak(BREAK_INPUT) && *commandline) - { - ParseCommandLine (commandline); - if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine)) - ConOutChar ('\n'); - bIgnoreEcho = FALSE; - } + EchoCommand(Cmd); + ConOutChar(_T('\n')); + } + + ExecuteCommand(Cmd); + if (bEcho && !bIgnoreEcho && (!bIsBatch || Cmd->Type != C_QUIET)) + ConOutChar ('\n'); + FreeCommand(Cmd); + bIgnoreEcho = FALSE; } while (!bCanExit || !bExit); Modified: trunk/reactos/base/shell/cmd/cmd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=3…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -103,6 +103,7 @@ VOID AddBreakHandler (VOID); VOID RemoveBreakHandler (VOID); BOOL DoCommand (LPTSTR line); +BOOL ReadLine(TCHAR *commandline, BOOL bMore); int cmd_main (int argc, const TCHAR *argv[]); extern HANDLE CMD_ModuleHandle; @@ -340,6 +341,7 @@ TCHAR CommandLine[]; } PARSED_COMMAND; PARSED_COMMAND *ParseCommand(LPTSTR Line); +VOID EchoCommand(PARSED_COMMAND *Cmd); VOID FreeCommand(PARSED_COMMAND *Cmd); Modified: trunk/reactos/base/shell/cmd/cmdinput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmdinput.c?…
============================================================================== --- trunk/reactos/base/shell/cmd/cmdinput.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmdinput.c [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -152,10 +152,6 @@ /* get screen size */ GetScreenSize (&maxx, &maxy); - /* JPP 19980807 - if echo off, don't print prompt */ - if (bEcho) - PrintPrompt(); - GetCursorXY (&orgx, &orgy); GetCursorXY (&curx, &cury); @@ -431,6 +427,8 @@ if (str[0]) History (0, str); #endif + str[charcount++] = _T('\n'); + str[charcount] = _T('\0'); ConInDummy (); ConOutChar (_T('\n')); bReturn = TRUE; Modified: trunk/reactos/base/shell/cmd/parser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/parser.c?re…
============================================================================== --- trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] Fri Aug 22 09:37:11 2008 @@ -29,7 +29,10 @@ { TCHAR Char; -//restart: + if (bParseError) + return CurChar = 0; + +restart: /* Although CRs can be injected into a line via an environment * variable substitution, the parser ignores them - they won't * even separate tokens. */ @@ -39,9 +42,19 @@ if (!Char) { - /*if (bLineContinuations) - if (ReadLine(ParseLine, TRUE) && *(ParsePos = ParseLine)) - goto restart;*/ + ParsePos--; + if (bLineContinuations) + { + if (!ReadLine(ParseLine, TRUE)) + { + /* ^C pressed, or line was too long */ + bParseError = TRUE; + } + else if (*(ParsePos = ParseLine)) + { + goto restart; + } + } } return CurChar = Char; } @@ -96,7 +109,8 @@ /* Next character is a forced literal */ } } - /* FIXME: potential buffer overflow here */ + if (Out == &CurrentToken[CMDLINE_LENGTH - 1]) + break; *Out++ = Char; Char = ParseChar(); } @@ -247,7 +261,7 @@ /* Read the block contents */ NextPtr = &Cmd->Subcommands; InsideBlock++; - do + while (1) { Sub = ParseCommandOp(C_OP_LOWEST); if (Sub) @@ -261,7 +275,12 @@ FreeCommand(Cmd); return NULL; } - } while (CurrentTokenType != TOK_END_BLOCK); + + if (CurrentTokenType == TOK_END_BLOCK) + break; + /* Skip past the \n */ + ParseChar(); + } InsideBlock--; /* Process any trailing redirections */ @@ -335,6 +354,10 @@ { return ParseBlock(RedirList); } + else if (Type == TOK_END_BLOCK && !RedirList) + { + return NULL; + } else { ParseError(); @@ -352,7 +375,12 @@ Type = ParseToken(0, TRUE); if (Type == TOK_NORMAL) { - /* FIXME: potential buffer overflow here */ + if (Pos + _tcslen(CurrentToken) >= &ParsedLine[CMDLINE_LENGTH]) + { + ParseError(); + FreeRedirection(RedirList); + return NULL; + } Pos = _stpcpy(Pos, CurrentToken); } else if (Type == TOK_REDIRECTION) @@ -426,7 +454,7 @@ } else { - /*if (!ReadLine(ParseLine, FALSE))*/ + if (!ReadLine(ParseLine, FALSE)) return NULL; bLineContinuations = TRUE; } @@ -435,13 +463,59 @@ CurChar = _T(' '); Cmd = ParseCommandOp(C_OP_LOWEST); - if (Cmd && CurrentTokenType != TOK_END) - { - ParseError(); - FreeCommand(Cmd); - Cmd = NULL; + if (Cmd) + { + if (CurrentTokenType != TOK_END) + ParseError(); + if (bParseError) + { + FreeCommand(Cmd); + Cmd = NULL; + } } return Cmd; +} + +/* Reconstruct a parse tree into text form; + * used for echoing batch file commands */ +VOID +EchoCommand(PARSED_COMMAND *Cmd) +{ + PARSED_COMMAND *Sub; + REDIRECTION *Redir; + + switch (Cmd->Type) + { + case C_COMMAND: + ConOutPrintf(_T("%s"), Cmd->CommandLine); + break; + case C_QUIET: + return; + case C_BLOCK: + ConOutChar(_T('(')); + for (Sub = Cmd->Subcommands; Sub; Sub = Sub->Next) + { + EchoCommand(Sub); + ConOutChar(_T('\n')); + } + ConOutChar(_T(')')); + break; + case C_MULTI: + case C_IFFAILURE: + case C_IFSUCCESS: + case C_PIPE: + Sub = Cmd->Subcommands; + EchoCommand(Sub); + ConOutPrintf(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]); + EchoCommand(Sub->Next); + break; + } + + for (Redir = Cmd->Redirections; Redir; Redir = Redir->Next) + { + ConOutPrintf(_T(" %c%s%s"), _T('0') + Redir->Number, + RedirString[Redir->Type], Redir->Filename); + } } VOID
16 years, 1 month
1
0
0
0
[sginsberg] 35529: - Add EFLAGS_IOPL to asm.h and make use of it in assembly - Fix a potential 64-bit warning in handle.c - Comment fixes
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Aug 22 09:29:01 2008 New Revision: 35529 URL:
http://svn.reactos.org/svn/reactos?rev=35529&view=rev
Log: - Add EFLAGS_IOPL to asm.h and make use of it in assembly - Fix a potential 64-bit warning in handle.c - Comment fixes Modified: trunk/reactos/include/ndk/asm.h trunk/reactos/ntoskrnl/ex/handle.c trunk/reactos/ntoskrnl/ex/locale.c trunk/reactos/ntoskrnl/ke/i386/boot.S trunk/reactos/ntoskrnl/ke/i386/exp.c trunk/reactos/ntoskrnl/ke/i386/thrdini.c trunk/reactos/ntoskrnl/ke/i386/trap.s trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S trunk/reactos/ntoskrnl/ps/kill.c Modified: trunk/reactos/include/ndk/asm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=3552…
============================================================================== --- trunk/reactos/include/ndk/asm.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/asm.h [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -450,6 +450,7 @@ #ifdef __ASM__ #define EFLAGS_TF 0x100 #define EFLAGS_INTERRUPT_MASK 0x200 +#define EFLAGS_IOPL 0x3000 #define EFLAGS_NESTED_TASK 0x4000 #define EFLAGS_V86_MASK 0x20000 #define EFLAGS_ALIGN_CHECK 0x40000 Modified: trunk/reactos/ntoskrnl/ex/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/handle.c?rev=3…
============================================================================== --- trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -59,7 +59,7 @@ /* Direct index */ case 0: - /* Use level 1 and just get the entry directlry */ + /* Use level 1 and just get the entry directly */ Level1 = (PUCHAR)TableBase; Entry = (PVOID)&Level1[Handle.Value * (sizeof(HANDLE_TABLE_ENTRY) / @@ -210,8 +210,8 @@ PEPROCESS Process = HandleTable->QuotaProcess; ULONG i, j; ULONG_PTR TableCode = HandleTable->TableCode; - ULONG TableLevel = TableCode & 3; ULONG_PTR TableBase = TableCode & ~3; + ULONG TableLevel = (ULONG)(TableCode & 3); PHANDLE_TABLE_ENTRY Level1, *Level2, **Level3; PAGED_CODE(); Modified: trunk/reactos/ntoskrnl/ex/locale.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/locale.c?rev=3…
============================================================================== --- trunk/reactos/ntoskrnl/ex/locale.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/locale.c [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -74,7 +74,7 @@ /* Success, is the value the right type? */ if (ValueInfo->Type == REG_SZ) { - /* It is. Initailize the data and convert it */ + /* It is. Initialize the data and convert it */ RtlInitUnicodeString(&ValueString, (PWSTR)ValueInfo->Data); Status = RtlUnicodeStringToInteger(&ValueString, 16, &Value); if (NT_SUCCESS(Status)) Modified: trunk/reactos/ntoskrnl/ke/i386/boot.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/boot.S?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/boot.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/boot.S [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -36,7 +36,7 @@ test dword ptr [esp+4], 0x80000000 jnz _KiSystemStartupReal@4 - /* FREELDR Boot: Cal the FreeLDR wrapper */ + /* FREELDR Boot: Call the FreeLDR wrapper */ jmp @KiRosPrepareForSystemStartup@8 .endfunc Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -72,7 +72,7 @@ extern KIDTENTRY KiIdt[MAXIMUM_IDTVECTOR]; /* Loop the IDT */ - for (i = 0; i <= MAXIMUM_IDTVECTOR; i ++) + for (i = 0; i <= MAXIMUM_IDTVECTOR; i++) { /* Save the current Selector */ FlippedSelector = KiIdt[i].Selector; @@ -113,7 +113,7 @@ /* Check if the caller gave us a mask */ if (!DrMask) { - /* He didn't use the one from the thread */ + /* He didn't, use the one from the thread */ Mask = KeGetCurrentThread()->DispatcherHeader.DebugActive; } else @@ -266,7 +266,7 @@ NTAPI KiSsFromTrapFrame(IN PKTRAP_FRAME TrapFrame) { - /* If this was V86 Mode */ + /* Check if this was V86 Mode */ if (TrapFrame->EFlags & EFLAGS_V86_MASK) { /* Just return it */ @@ -274,7 +274,7 @@ } else if (TrapFrame->SegCs & MODE_MASK) { - /* Usermode, return the User SS */ + /* User mode, return the User SS */ return TrapFrame->HardwareSegSs | RPL_MASK; } else @@ -599,7 +599,7 @@ } /* Check if thread has IOPL and force it enabled if so */ - if (KeGetCurrentThread()->Iopl) TrapFrame->EFlags |= 0x3000; + if (KeGetCurrentThread()->Iopl) TrapFrame->EFlags |= EFLAGS_IOPL; /* Restore IRQL */ if (OldIrql < APC_LEVEL) KeLowerIrql(OldIrql); Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -132,7 +132,7 @@ Thread->NpxState = NPX_STATE_NOT_LOADED &~ CR0_MP; } - /* Disable any debug regiseters */ + /* Disable any debug registers */ Context->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS; /* Setup the Trap Frame */ Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/trap.s [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/trap.s [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -1836,7 +1836,7 @@ CheckRing3Io: /* Get EFLAGS and IOPL */ mov ebx, [ebp+KTRAP_FRAME_EFLAGS] - and ebx, 0x3000 + and ebx, EFLAGS_IOPL shr ebx, 12 /* Check the CS's RPL mask */ Modified: trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86m_sup.…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -215,7 +215,7 @@ or eax, edx /* Add IOPL Mask */ - or eax, 0x3000 + or eax, EFLAGS_IOPL /* Get flat ESP */ movzx ecx, word ptr [ebp+KTRAP_FRAME_SS] @@ -277,7 +277,7 @@ mov [ebp+KTRAP_FRAME_ESP], edx /* Mask out EFLAGS */ - and eax, ~0x3000 + and eax, ~EFLAGS_IOPL mov ebx, ebx and ebx, ~0x4000 and ecx, EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK @@ -353,7 +353,7 @@ mov [ebp+KTRAP_FRAME_EFLAGS], edx /* Set the IOPL Mask */ - or eax, 0x3000 + or eax, EFLAGS_IOPL /* Get stack flat address */ movzx ecx, word ptr [ebp+KTRAP_FRAME_SS] @@ -450,7 +450,7 @@ MaskEFlags: /* Mask out EFLAGS */ - and ebx, ~(0x3000 + EFLAGS_VIF + 0x4000 + EFLAGS_VIP) + and ebx, ~(EFLAGS_IOPL + EFLAGS_VIF + 0x4000 + EFLAGS_VIP) mov ecx, ebx /* FIXME: Check for VME support */ Modified: trunk/reactos/ntoskrnl/ps/kill.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/kill.c?rev=355…
============================================================================== --- trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/kill.c [iso-8859-1] Fri Aug 22 09:29:01 2008 @@ -1142,7 +1142,7 @@ /* Lock the Process */ if (!ExAcquireRundownProtection(&Process->RundownProtect)) { - /* Failed to lock, fal */ + /* Failed to lock, fail */ ObDereferenceObject (Process); return STATUS_PROCESS_IS_TERMINATING; } @@ -1182,7 +1182,7 @@ /* Also make sure the caller gave us our handle */ if (KillByHandle) { - /* Dereference the project */ + /* Dereference the process */ ObDereferenceObject(Process); /* Terminate ourselves */
16 years, 1 month
1
0
0
0
[tkreuzer] 35528: LdrPEProcessImportDirectoryEntry: ULONG -> ULONG_PTR to fix imports.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Aug 22 08:06:39 2008 New Revision: 35528 URL:
http://svn.reactos.org/svn/reactos?rev=35528&view=rev
Log: LdrPEProcessImportDirectoryEntry: ULONG -> ULONG_PTR to fix imports. Modified: branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/reactos/imageldr.c Modified: branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/reactos/imageldr.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/boot/…
============================================================================== --- branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] Fri Aug 22 08:06:39 2008 @@ -348,7 +348,7 @@ PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory) { PVOID* ImportAddressList; - PULONG FunctionNameList; + PULONG_PTR FunctionNameList; if (ImportModuleDirectory == NULL || ImportModuleDirectory->Name == 0) { @@ -361,11 +361,11 @@ /* Get the list of functions to import. */ if (ImportModuleDirectory->OriginalFirstThunk != 0) { - FunctionNameList = (PULONG)RVA(DriverBase, ImportModuleDirectory->OriginalFirstThunk); + FunctionNameList = (PULONG_PTR)RVA(DriverBase, ImportModuleDirectory->OriginalFirstThunk); } else { - FunctionNameList = (PULONG)RVA(DriverBase, ImportModuleDirectory->FirstThunk); + FunctionNameList = (PULONG_PTR)RVA(DriverBase, ImportModuleDirectory->FirstThunk); } /* Walk through function list and fixup addresses. */
16 years, 1 month
1
0
0
0
[tkreuzer] 35527: Fix handling of stack
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Aug 22 07:20:01 2008 New Revision: 35527 URL:
http://svn.reactos.org/svn/reactos?rev=35527&view=rev
Log: Fix handling of stack Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S [iso-8859-1] Fri Aug 22 07:20:01 2008 @@ -50,6 +50,7 @@ /* Setup the new stack */ mov rsp, r8 + sub rsp, 0x300 // FIXME /* Copy stack parameters to the new stack */ sub rsp, 0x38 Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] Fri Aug 22 07:20:01 2008 @@ -694,6 +694,9 @@ InitialStack = LoaderBlock->KernelStack; // Chekme InitialThread = (PKTHREAD)LoaderBlock->Thread; + /* Align stack to 16 bytes */ + InitialStack &= ~(16 - 1); + /* Clean the APC List Head */ InitializeListHead(&InitialThread->ApcState.ApcListHead[KernelMode]); @@ -784,10 +787,6 @@ /* Raise to HIGH_LEVEL */ KfRaiseIrql(HIGH_LEVEL); - - /* Align stack and make space for the trap frame */ - InitialStack -= sizeof(KTRAP_FRAME) + 0x100; // FIXME - InitialStack &= ~(16 - 1); /* Switch to new kernel stack and start kernel bootstrapping */ KiSetupStackAndInitializeKernel(&KiInitialProcess.Pcb,
16 years, 1 month
1
0
0
0
[tkreuzer] 35526: Move KiSystemStartup again to kiinit.c, implement an intermediate function KiInitializeKernelAndGotoIdleLoop that is now called from the asm function KiSetupStackAndInitializeKernel. This way we avoid using "hardcoded" constants.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Aug 22 06:13:51 2008 New Revision: 35526 URL:
http://svn.reactos.org/svn/reactos?rev=35526&view=rev
Log: Move KiSystemStartup again to kiinit.c, implement an intermediate function KiInitializeKernelAndGotoIdleLoop that is now called from the asm function KiSetupStackAndInitializeKernel. This way we avoid using "hardcoded" constants. Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/boot.S [iso-8859-1] Fri Aug 22 06:13:51 2008 @@ -28,28 +28,18 @@ _KiDoubleFaultStack: /* FUNCTIONS *****************************************************************/ -.global _KiSystemStartup + .text -.func KiSystemStartup -_KiSystemStartup: - - /* NTLDR Boot: Call the main kernel initialization */ - test rcx, 0x80000000 - jnz _KiSystemStartupReal - - /* FREELDR Boot: Cal the FreeLDR wrapper */ - jmp _KiRosPrepareForSystemStartup -.endfunc /** * VOID * KiSetupStackAndInitializeKernel( - * esp+4 = ? -> rcx - * esp+8 = ? -> rdx - * PVOID pNewstack // esp+12 = new stack -> r8 - * esp+16 -> r9 - * esp+20 -> rsp + 8 - * esp+24 -> rsp + 16? + * IN PKPROCESS InitProcess, <rsp + 0x08, rcx> + * IN PKTHREAD InitThread, <rsp + 0x10, rdx> + * IN PVOID IdleStack, <rsp + 0x18, r8> + * IN PKPRCB Prcb, <rsp + 0x20, r9> + * IN CCHAR Number, <rsp + 0x28> + * IN PLOADER_PARAMETER_BLOCK LoaderBlock) <rsp + 0x30> */ .globl _KiSetupStackAndInitializeKernel .func KiSetupStackAndInitializeKernel @@ -60,27 +50,18 @@ /* Setup the new stack */ mov rsp, r8 - sub rsp, NPX_FRAME_LENGTH + KTRAP_FRAME_ALIGN + KTRAP_FRAME_LENGTH - push CR0_EM + CR0_TS + CR0_MP /* Copy stack parameters to the new stack */ - push [rsi + 16] - push [rsi + 8] - xor rbp, rbp - call _KiInitializeKernel + sub rsp, 0x38 + mov rdi, rsp + movsq + movsq + movsq + movsq + movsq + movsq + movsq - /* Set the priority of this thread to 0 */ - mov rbx, PCR[KPCR_CURRENT_THREAD] - mov byte ptr [rbx+KTHREAD_PRIORITY], 0 + jmp _KiInitializeKernelAndGotoIdleLoop - /* Force interrupts enabled and lower IRQL back to DISPATCH_LEVEL */ - sti - mov rcx, DISPATCH_LEVEL - mov cr8, rcx - - /* Set the right wait IRQL */ - mov byte ptr [rbx+KTHREAD_WAIT_IRQL], DISPATCH_LEVEL; - - /* Jump into the idle loop */ - jmp _KiIdleLoop .endfunc Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/kiinit.c [iso-8859-1] Fri Aug 22 06:13:51 2008 @@ -366,6 +366,7 @@ /* Start us out at PASSIVE_LEVEL */ // Pcr->Irql = PASSIVE_LEVEL; + KeSetCurrentIrql(PASSIVE_LEVEL); /* Set the GDI, IDT, TSS and DPC Stack */ Pcr->GdtBase = (PVOID)Gdt; @@ -386,6 +387,7 @@ IN CCHAR Number, IN PLOADER_PARAMETER_BLOCK LoaderBlock) { + FrLdrDbgPrint("Enter KiInitializeKernel\n"); #if 0 BOOLEAN NpxPresent; ULONG FeatureBits; @@ -642,6 +644,17 @@ (ULONG64)TssSelector.BaseUpper << 32); } +// Hack +VOID KiRosPrepareForSystemStartup(ULONG, PROS_LOADER_PARAMETER_BLOCK); + +VOID +NTAPI +KiSystemStartup(IN ULONG_PTR Dummy, + IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock) +{ + KiRosPrepareForSystemStartup(Dummy, LoaderBlock); +} + VOID NTAPI KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) @@ -746,7 +759,7 @@ { /* Loop until execution can continue */ while (*(volatile PKSPIN_LOCK*)&KiFreezeExecutionLock == (PVOID)1); - } while(InterlockedBitTestAndSet((PLONG)&KiFreezeExecutionLock, 0)); + } while(InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0)); /* Setup CPU-related fields */ Pcr->Prcb.Number = Cpu; @@ -772,11 +785,9 @@ /* Raise to HIGH_LEVEL */ KfRaiseIrql(HIGH_LEVEL); - /* Align stack and make space for the trap frame and NPX frame */ - InitialStack &= ~(KTRAP_FRAME_ALIGN - 1); - -FrLdrDbgPrint("Before KiSetupStackAndInitializeKernel\n"); -for(;;); + /* Align stack and make space for the trap frame */ + InitialStack -= sizeof(KTRAP_FRAME) + 0x100; // FIXME + InitialStack &= ~(16 - 1); /* Switch to new kernel stack and start kernel bootstrapping */ KiSetupStackAndInitializeKernel(&KiInitialProcess.Pcb, @@ -786,3 +797,35 @@ (CCHAR)Cpu, KeLoaderBlock); } + + +VOID +NTAPI +KiInitializeKernelAndGotoIdleLoop(IN PKPROCESS InitProcess, + IN PKTHREAD InitThread, + IN PVOID IdleStack, + IN PKPRCB Prcb, + IN CCHAR Number, + IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + /* Initialize kernel */ + KiInitializeKernel(InitProcess, + InitThread, + IdleStack, + Prcb, + Number, + KeLoaderBlock); + + /* Set the priority of this thread to 0 */ + InitThread->Priority = 0; + + /* Force interrupts enabled and lower IRQL back to DISPATCH_LEVEL */ + _enable(); + KeLowerIrql(DISPATCH_LEVEL); + + /* Set the right wait IRQL */ + InitThread->WaitIrql = DISPATCH_LEVEL; + + /* Jump into the idle loop */ + KiIdleLoop(); +}
16 years, 1 month
1
0
0
0
[tkreuzer] 35525: Fix _interlockedbittest intrinsics. For some strange reason they were working correctly on x86, the compiler seemed to know "what it means". But that doesn't work on amd64, here we need *a as "=m" operand, not a.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Aug 22 05:54:47 2008 New Revision: 35525 URL:
http://svn.reactos.org/svn/reactos?rev=35525&view=rev
Log: Fix _interlockedbittest intrinsics. For some strange reason they were working correctly on x86, the compiler seemed to know "what it means". But that doesn't work on amd64, here we need *a as "=m" operand, not a. Modified: branches/ros-amd64-bringup/reactos/include/psdk/intrin_x86.h Modified: branches/ros-amd64-bringup/reactos/include/psdk/intrin_x86.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
============================================================================== --- branches/ros-amd64-bringup/reactos/include/psdk/intrin_x86.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/psdk/intrin_x86.h [iso-8859-1] Fri Aug 22 05:54:47 2008 @@ -493,7 +493,7 @@ static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b) { unsigned char retval; - __asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); + __asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "=m" (*a) : [b] "Ir" (b) : "memory"); return retval; } @@ -501,7 +501,7 @@ static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset64(volatile long long * a, const long long b) { unsigned char retval; - __asm__("lock; btrq %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); + __asm__("lock; btrq %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "=m" (*a) : [b] "Ir" (b) : "memory"); return retval; } #endif @@ -509,7 +509,7 @@ static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandset(volatile long * a, const long b) { unsigned char retval; - __asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); + __asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "=m" (*a) : [b] "Ir" (b) : "memory"); return retval; } @@ -517,7 +517,7 @@ static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandset64(volatile long long * a, const long long b) { unsigned char retval; - __asm__("lock; btsq %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); + __asm__("lock; btsq %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "=m" (*a) : [b] "Ir" (b) : "memory"); return retval; } #endif
16 years, 1 month
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
86
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Results per page:
10
25
50
100
200