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
November 2010
----- 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
16 participants
491 discussions
Start a n
N
ew thread
[tkreuzer] 49527: [ACLDEDIT] Delete acledit.def
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Nov 8 13:15:54 2010 New Revision: 49527 URL:
http://svn.reactos.org/svn/reactos?rev=49527&view=rev
Log: [ACLDEDIT] Delete acledit.def Removed: branches/cmake-bringup/dll/win32/acledit/acledit.def Removed: branches/cmake-bringup/dll/win32/acledit/acledit.def URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/dll/win32/acledit…
============================================================================== --- branches/cmake-bringup/dll/win32/acledit/acledit.def [iso-8859-1] (original) +++ branches/cmake-bringup/dll/win32/acledit/acledit.def (removed) @@ -1,11 +1,0 @@ - -LIBRARY acledit.dll - -EXPORTS - EditAuditInfo@4 @1 - EditOwnerInfo@4 @2 - EditPermissionInfo@4 @3 - FMExtensionProcW@12 @4 - SedDiscretionaryAclEditor@52 @5 - SedSystemAclEditor@48 @6 - SedTakeOwnership@56 @7
14 years, 1 month
1
0
0
0
[tkreuzer] 49526: [CMAKE] Convert acledit to pdef
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Nov 8 12:58:32 2010 New Revision: 49526 URL:
http://svn.reactos.org/svn/reactos?rev=49526&view=rev
Log: [CMAKE] Convert acledit to pdef Modified: branches/cmake-bringup/dll/win32/acledit/CMakeLists.txt Modified: branches/cmake-bringup/dll/win32/acledit/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/dll/win32/acledit…
============================================================================== --- branches/cmake-bringup/dll/win32/acledit/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/dll/win32/acledit/CMakeLists.txt [iso-8859-1] Mon Nov 8 12:58:32 2010 @@ -1,22 +1,20 @@ set_unicode() - -pdef2def(acledit.pdef) list(APPEND SOURCE acledit.c stubs.c acledit.rc - ${CMAKE_CURRENT_BINARY_DIR}/acledit.def) - -if(NOT MSVC) - set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/acledit.def PROPERTIES EXTERNAL_OBJECT TRUE) -endif() + ) add_library(acledit SHARED ${SOURCE}) set_module_type(acledit win32dll) +set_pdef_file(acledit acledit.pdef) + add_importlibs(acledit ntdll) add_cab_target(acledit 1) + +add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/acledit.def)
14 years, 1 month
1
0
0
0
[sir_richard] 49525: [NTOS]: Assign a working set to the system process and correctly initialize its address space. [NTOS]: Assign the working set list address, system-wide, but per-process (in hyp...
by sir_richard@svn.reactos.org
Author: sir_richard Date: Mon Nov 8 12:35:50 2010 New Revision: 49525 URL:
http://svn.reactos.org/svn/reactos?rev=49525&view=rev
Log: [NTOS]: Assign a working set to the system process and correctly initialize its address space. [NTOS]: Assign the working set list address, system-wide, but per-process (in hyperspace). [NTOS]: Give every process its working set page, and store it. Build a bogus working set list (MMWSL). [NTOS]: Use the process working set list (MMWSL) to track page table references during faults, just as Windows does. [NTOS]: Correctly initialize the colored page list heads and assert their validity. Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c trunk/reactos/ntoskrnl/mm/ARM3/procsup.c Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] Mon Nov 8 12:35:50 2010 @@ -84,7 +84,11 @@ #define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE #define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \ MI_HYPERSPACE_PTES * PAGE_SIZE) -#define MI_ZERO_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ +#define MI_DUMMY_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \ + PAGE_SIZE) +#define MI_VAD_BITMAP (PMMPTE)(MI_DUMMY_PTE + \ + PAGE_SIZE) +#define MI_WORKING_SET_LIST (PMMPTE)(MI_VAD_BITMAP + \ PAGE_SIZE) /* On x86, these two are the same */ Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/i386/init…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] Mon Nov 8 12:35:50 2010 @@ -160,7 +160,9 @@ MMPTE TempPde, TempPte; PVOID NonPagedPoolExpansionVa; KIRQL OldIrql; - + PMMPFN Pfn1; + ULONG Flags; + /* Check for kernel stack size that's too big */ if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB)) { @@ -558,6 +560,9 @@ MmFirstReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_START); MmLastReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_END); MmFirstReservedMappingPte->u.Hard.PageFrameNumber = MI_HYPERSPACE_PTES; + + /* Set the working set address */ + MmWorkingSetList = (PVOID)MI_WORKING_SET_LIST; // // Reserve system PTEs for zeroing PTEs and clear them @@ -571,6 +576,28 @@ // MiFirstReservedZeroingPte->u.Hard.PageFrameNumber = MI_ZERO_PTES - 1; + /* Lock PFN database */ + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + + /* Reset the ref/share count so that MmInitializeProcessAddressSpace works */ + Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(MiAddressToPde(PDE_BASE))); + Pfn1->u2.ShareCount = 0; + Pfn1->u3.e2.ReferenceCount = 0; + + /* Get a page for the working set list */ + MI_SET_USAGE(MI_USAGE_PAGE_TABLE); + MI_SET_PROCESS2("Kernel WS List"); + PageFrameIndex = MiRemoveAnyPage(0); + TempPte.u.Hard.PageFrameNumber = PageFrameIndex; + + /* Map the working set list */ + PointerPte = MiAddressToPte(MmWorkingSetList); + MI_WRITE_VALID_PTE(PointerPte, TempPte); + + /* Zero it out, and save the frame index */ + RtlZeroMemory(MiPteToAddress(PointerPte), PAGE_SIZE); + PsGetCurrentProcess()->WorkingSetPage = PageFrameIndex; + /* Check for Pentium LOCK errata */ if (KiI386PentiumLockErrataPresent) { @@ -581,6 +608,43 @@ PointerPte->u.Hard.WriteThrough = 1; } + /* Release the lock */ + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + + /* Initialize the bogus address space */ + Flags = 0; + MmInitializeProcessAddressSpace(PsGetCurrentProcess(), NULL, NULL, &Flags, NULL); + + /* Make sure the color lists are valid */ + ASSERT(MmFreePagesByColor[0] < (PMMCOLOR_TABLES)PTE_BASE); + StartPde = MiAddressToPde(MmFreePagesByColor[0]); + ASSERT(StartPde->u.Hard.Valid == 1); + PointerPte = MiAddressToPte(MmFreePagesByColor[0]); + ASSERT(PointerPte->u.Hard.Valid == 1); + LastPte = MiAddressToPte((ULONG_PTR)&MmFreePagesByColor[1][MmSecondaryColors] - 1); + ASSERT(LastPte->u.Hard.Valid == 1); + + /* Loop the color list PTEs */ + while (PointerPte <= LastPte) + { + /* Get the PFN entry */ + Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(PointerPte)); + if (!Pfn1->u3.e2.ReferenceCount) + { + /* Fill it out */ + Pfn1->u4.PteFrame = PFN_FROM_PTE(StartPde); + Pfn1->PteAddress = PointerPte; + Pfn1->u2.ShareCount++; + Pfn1->u3.e2.ReferenceCount = 1; + Pfn1->u3.e1.PageLocation = ActiveAndValid; + Pfn1->u3.e1.CacheAttribute = MiCached; + } + + /* Keep going */ + PointerPte++; + } + + /* All done */ return STATUS_SUCCESS; } Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Mon Nov 8 12:35:50 2010 @@ -513,6 +513,7 @@ extern KEVENT MmZeroingPageEvent; extern ULONG MmSystemPageColor; extern ULONG MmProcessColorSeed; +extern PMMWSL MmWorkingSetList; // // Figures out the hardware bits for a PTE Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Mon Nov 8 12:35:50 2010 @@ -991,6 +991,14 @@ MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread); return Status; } + + /* Is this a user address? */ + if (Address <= MM_HIGHEST_USER_ADDRESS) + { + /* Add an additional page table reference */ + MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++; + ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT); + } /* Did we get a prototype PTE back? */ if (!ProtoPte) Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Mon Nov 8 12:35:50 2010 @@ -19,6 +19,7 @@ /* GLOBALS ********************************************************************/ ULONG MmProcessColorSeed = 0x12345678; +PMMWSL MmWorkingSetList; /* PRIVATE FUNCTIONS **********************************************************/ @@ -892,6 +893,32 @@ return Status; } +VOID +NTAPI +MiInitializeWorkingSetList(IN PEPROCESS CurrentProcess) +{ + PMMPFN Pfn1; + + /* Setup some bogus list data */ + MmWorkingSetList->LastEntry = CurrentProcess->Vm.MinimumWorkingSetSize; + MmWorkingSetList->HashTable = NULL; + MmWorkingSetList->HashTableSize = 0; + MmWorkingSetList->NumberOfImageWaiters = 0; + MmWorkingSetList->Wsle = (PVOID)0xDEADBABE; + MmWorkingSetList->VadBitMapHint = 1; + MmWorkingSetList->HashTableStart = (PVOID)0xBADAB00B; + MmWorkingSetList->HighestPermittedHashAddress = (PVOID)0xCAFEBABE; + MmWorkingSetList->FirstFree = 1; + MmWorkingSetList->FirstDynamic = 2; + MmWorkingSetList->NextSlot = 3; + MmWorkingSetList->LastInitializedWsle = 4; + + /* The rule is that the owner process is always in the FLINK of the PDE's PFN entry */ + Pfn1 = MiGetPfnEntry(MiAddressToPte(PDE_BASE)->u.Hard.PageFrameNumber); + ASSERT(Pfn1->u4.PteFrame == MiGetPfnEntryIndex(Pfn1)); + Pfn1->u1.Event = (PKEVENT)CurrentProcess; +} + NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, @@ -912,6 +939,7 @@ PWCHAR Source; PCHAR Destination; USHORT Length = 0; + MMPTE TempPte; /* We should have a PDE */ ASSERT(Process->Pcb.DirectoryTableBase[0] != 0); @@ -944,6 +972,22 @@ PointerPde = MiAddressToPde(HYPER_SPACE); PageFrameNumber = PFN_FROM_PTE(PointerPde); MiInitializePfn(PageFrameNumber, PointerPde, TRUE); + + /* Setup the PFN for the PTE for the working set */ + PointerPte = MiAddressToPte(MI_WORKING_SET_LIST); + MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, MM_READWRITE, 0); + ASSERT(PointerPte->u.Long != 0); + PageFrameNumber = PFN_FROM_PTE(PointerPte); + MI_WRITE_INVALID_PTE(PointerPte, DemandZeroPte); + MiInitializePfn(PageFrameNumber, PointerPte, TRUE); + TempPte.u.Hard.PageFrameNumber = PageFrameNumber; + MI_WRITE_VALID_PTE(PointerPte, TempPte); + + /* Now initialize the working set list */ + MiInitializeWorkingSetList(Process); + + /* Sanity check */ + ASSERT(Process->PhysicalVadRoot == NULL); /* Release PFN lock */ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); @@ -1062,12 +1106,13 @@ OUT PULONG_PTR DirectoryTableBase) { KIRQL OldIrql; - PFN_NUMBER PdeIndex, HyperIndex; + PFN_NUMBER PdeIndex, HyperIndex, WsListIndex; PMMPTE PointerPte; MMPTE TempPte, PdePte; ULONG PdeOffset; - PMMPTE SystemTable; + PMMPTE SystemTable, HyperTable; ULONG Color; + PMMPFN Pfn1; /* Choose a process color */ Process->NextPageColor = RtlRandom(&MmProcessColorSeed); @@ -1105,6 +1150,21 @@ /* Zero it outside the PFN lock */ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); MiZeroPhysicalPage(HyperIndex); + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + } + + /* Get a zero page for the woring set list, if possible */ + MI_SET_USAGE(MI_USAGE_PAGE_TABLE); + Color = MI_GET_NEXT_PROCESS_COLOR(Process); + WsListIndex = MiRemoveZeroPageSafe(Color); + if (!WsListIndex) + { + /* No zero pages, grab a free one */ + WsListIndex = MiRemoveAnyPage(Color); + + /* Zero it outside the PFN lock */ + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + MiZeroPhysicalPage(WsListIndex); } else { @@ -1117,11 +1177,42 @@ Process->AddressSpaceInitialized = 1; /* Set the base directory pointers */ + Process->WorkingSetPage = WsListIndex; DirectoryTableBase[0] = PdeIndex << PAGE_SHIFT; DirectoryTableBase[1] = HyperIndex << PAGE_SHIFT; /* Make sure we don't already have a page directory setup */ ASSERT(Process->Pcb.DirectoryTableBase[0] == 0); + + /* Get a PTE to map hyperspace */ + PointerPte = MiReserveSystemPtes(1, SystemPteSpace); + ASSERT(PointerPte != NULL); + + /* Build it */ + MI_MAKE_HARDWARE_PTE_KERNEL(&PdePte, + PointerPte, + MM_READWRITE, + HyperIndex); + + /* Set it dirty and map it */ + PdePte.u.Hard.Dirty = TRUE; + MI_WRITE_VALID_PTE(PointerPte, PdePte); + + /* Now get hyperspace's page table */ + HyperTable = MiPteToAddress(PointerPte); + + /* Now write the PTE/PDE entry for the working set list index itself */ + TempPte = ValidKernelPte; + TempPte.u.Hard.PageFrameNumber = WsListIndex; + PdeOffset = MiAddressToPteOffset(MmWorkingSetList); + HyperTable[PdeOffset] = TempPte; + + /* Let go of the system PTE */ + MiReleaseSystemPtes(PointerPte, 1, SystemPteSpace); + + /* Save the PTE address of the page directory itself */ + Pfn1 = MiGetPfnEntry(PdeIndex); + Pfn1->PteAddress = (PMMPTE)PDE_BASE; /* Insert us into the Mm process list */ InsertTailList(&MmProcessList, &Process->MmProcessLinks);
14 years, 1 month
1
0
0
0
[tkreuzer] 49524: [CMAKE] - add new macro add_linkerflag to avoid code duplication - add new macro set_pdef_file, replacing the use of pdef2def, which is neccessary to resolve issues with MSVC. cma...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Nov 8 12:24:33 2010 New Revision: 49524 URL:
http://svn.reactos.org/svn/reactos?rev=49524&view=rev
Log: [CMAKE] - add new macro add_linkerflag to avoid code duplication - add new macro set_pdef_file, replacing the use of pdef2def, which is neccessary to resolve issues with MSVC. cmake doesn't handle def files as source files very well, when they are not in the current source directory. Modified: branches/cmake-bringup/gcc.cmake branches/cmake-bringup/msc.cmake Modified: branches/cmake-bringup/gcc.cmake URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/gcc.cmake?rev=495…
============================================================================== --- branches/cmake-bringup/gcc.cmake [iso-8859-1] (original) +++ branches/cmake-bringup/gcc.cmake [iso-8859-1] Mon Nov 8 12:24:33 2010 @@ -32,12 +32,8 @@ add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls) # Macros -macro(set_entrypoint MODULE ENTRYPOINT) - if(${ENTRYPOINT} STREQUAL "0") - set(NEW_LINKER_FLAGS "-Wl,-entry,0") - else() - set(NEW_LINKER_FLAGS "-Wl,-entry,_${ENTRYPOINT}") - endif() +macro(add_linkerflag MODULE _flag) + set(NEW_LINKER_FLAGS ${_flag}) get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) if(LINKER_FLAGS) set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") @@ -45,13 +41,16 @@ set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) endmacro() +macro(set_entrypoint MODULE ENTRYPOINT) + if(${ENTRYPOINT} STREQUAL "0") + add_linkerflag(${MODULE} "-Wl,-entry,0") + else() + add_linkerflag(${MODULE} "-Wl,-entry,_${ENTRYPOINT}") + endif() +endmacro() + macro(set_subsystem MODULE SUBSYSTEM) - set(NEW_LINKER_FLAGS "-Wl,--subsystem,${SUBSYSTEM}") - get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) - if(LINKER_FLAGS) - set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") - endif() - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) + add_linkerflag(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}") endmacro() macro(set_image_base MODULE IMAGE_BASE) @@ -167,7 +166,16 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE) + add_custom_target( + ${_file}_def + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def) endmacro(pdef2def _pdef_file) + +macro(set_pdef_file _module _pdef_file) + pdef2def(${_pdef_file}) + get_filename_component(_file ${_pdef_file} NAME_WE) + target_link_libraries(${_module} "${CMAKE_CURRENT_BINARY_DIR}/${_file}.def") +endmacro() #pseh lib, needed with mingw set(PSEH_LIB "pseh") Modified: branches/cmake-bringup/msc.cmake URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/msc.cmake?rev=495…
============================================================================== --- branches/cmake-bringup/msc.cmake [iso-8859-1] (original) +++ branches/cmake-bringup/msc.cmake [iso-8859-1] Mon Nov 8 12:24:33 2010 @@ -23,13 +23,8 @@ set(CMAKE_RC_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - -macro(set_entrypoint MODULE ENTRYPOINT) - if(${ENTRYPOINT} STREQUAL "0") - set(NEW_LINKER_FLAGS "/ENTRY:0") - else() - set(NEW_LINKER_FLAGS "/ENTRY:${ENTRYPOINT}") - endif() +macro(add_linkerflag MODULE _flag) + set(NEW_LINKER_FLAGS ${_flag}) get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) if(LINKER_FLAGS) set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") @@ -37,22 +32,20 @@ set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) endmacro() +macro(set_entrypoint MODULE ENTRYPOINT) + if(${ENTRYPOINT} STREQUAL "0") + add_linkerflag(${MODULE} "/ENTRY:0") + else() + add_linkerflag(${MODULE} "/ENTRY:${ENTRYPOINT}") + endif() +endmacro() + macro(set_subsystem MODULE SUBSYSTEM) - set(NEW_LINKER_FLAGS "/subsystem:${SUBSYSTEM}") - get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) - if(LINKER_FLAGS) - set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") - endif() - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) + add_linkerflag(${MODULE} "/subsystem:${SUBSYSTEM}") endmacro() macro(set_image_base MODULE IMAGE_BASE) - set(NEW_LINKER_FLAGS "/BASE:${IMAGE_BASE}") - get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) - if(LINKER_FLAGS) - set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") - endif() - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) + add_linkerflag(${MODULE} "/BASE:${IMAGE_BASE}") endmacro() macro(set_module_type MODULE TYPE) @@ -67,6 +60,7 @@ if (${TYPE} MATCHES win32cui) set_subsystem(${MODULE} console) set_entrypoint(${MODULE} mainCRTStartup) + target_link_libraries(${MODULE} mingw_common mingw_wmain) endif () if(${TYPE} MATCHES win32dll) # Need this only because mingw library is broken @@ -77,6 +71,7 @@ message(STATUS "${MODULE} has no base address") endif() target_link_libraries(${MODULE} mingw_common mingw_dllmain) + add_importlibs(${MODULE} msvcrt kernel32) endif() endmacro() @@ -122,7 +117,21 @@ endmacro() macro(pdef2def _pdef_file) -# Dummy for now + get_filename_component(_file ${_pdef_file} NAME_WE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def + COMMAND ${CMAKE_C_COMPILER} /EP /c ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file} > ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file}) + add_custom_target( + ${_file}_def + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def) +endmacro(pdef2def _pdef_file) + +macro(set_pdef_file _module _pdef_file) + pdef2def(${_pdef_file}) + get_filename_component(_file ${_pdef_file} NAME_WE) + add_linkerflag(${_module} "/DEF:${CMAKE_CURRENT_BINARY_DIR}/${_file}.def") + add_dependencies(${_module} ${_file}_def) endmacro() file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
14 years, 1 month
1
0
0
0
[sir_richard] 49523: [NTOS]: Optimize new context switching code to avoid wasted cycles.
by sir_richard@svn.reactos.org
Author: sir_richard Date: Mon Nov 8 11:56:22 2010 New Revision: 49523 URL:
http://svn.reactos.org/svn/reactos?rev=49523&view=rev
Log: [NTOS]: Optimize new context switching code to avoid wasted cycles. Modified: trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/dpc.c trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S trunk/reactos/ntoskrnl/ke/i386/thrdini.c trunk/reactos/ntoskrnl/ke/thrdschd.c trunk/reactos/ntoskrnl/ke/wait.c Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Mon Nov 8 11:56:22 2010 @@ -298,8 +298,8 @@ BOOLEAN FASTCALL KiSwapContext( - IN PKTHREAD CurrentThread, - IN PKTHREAD NewThread + IN KIRQL WaitIrql, + IN PKTHREAD CurrentThread ); VOID Modified: trunk/reactos/ntoskrnl/ke/dpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/dpc.c?rev=4952…
============================================================================== --- trunk/reactos/ntoskrnl/ke/dpc.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/dpc.c [iso-8859-1] Mon Nov 8 11:56:22 2010 @@ -534,7 +534,7 @@ Thread->WaitIrql = APC_LEVEL; /* Swap threads */ - KiSwapContext(Thread, NextThread); + KiSwapContext(APC_LEVEL, Thread); /* Lower IRQL back to DISPATCH_LEVEL */ KeLowerIrql(DISPATCH_LEVEL); Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] Mon Nov 8 11:56:22 2010 @@ -13,70 +13,20 @@ #include <ndk/asm.h> .intel_syntax noprefix -#define Ready 1 -#define Running 2 -#define WrDispatchInt 0x1F - /* FUNCTIONS ****************************************************************/ -/*++ - * KiSwapContextInternal - * - * The KiSwapContextInternal routine switches context to another thread. - * - * Params: - * ESI - Pointer to the KTHREAD to which the caller wishes to - * switch to. - * EDI - Pointer to the KTHREAD to which the caller wishes to - * switch from. - * - * Returns: - * None. - * - * Remarks: - * Absolutely all registers except ESP can be trampled here for maximum code flexibility. - * - *--*/ .globl @KiSwapContextInternal@0 .func @KiSwapContextInternal@0, @KiSwapContextInternal@0 @KiSwapContextInternal@0: - /* Set APC Bypass Disable and old thread pointer */ - mov edx, edi - or dl, cl - /* Build switch frame */ sub esp, 2 * 4 mov ecx, esp - call @KiSwapContextEntry@8 - mov ecx, 0xB00BFACA - jmp $ + jmp @KiSwapContextEntry@8 .endfunc -/*++ - * KiSwapContext - * - * The KiSwapContext routine switches context to another thread. - * - * Params: - * TargetThread - Pointer to the KTHREAD to which the caller wishes to - * switch to. - * - * Returns: - * The WaitStatus of the Target Thread. - * - * Remarks: - * This is a wrapper around KiSwapContextInternal which will save all the - * non-volatile registers so that the Internal function can use all of - * them. It will also save the old current thread and set the new one. - * - * The calling thread does not return after KiSwapContextInternal until - * another thread switches to IT. - * - *--*/ .globl @KiSwapContext@8 .func @KiSwapContext@8, @KiSwapContext@8 @KiSwapContext@8: - /* Save 4 registers */ sub esp, 4 * 4 @@ -86,17 +36,8 @@ mov [esp+4], edi mov [esp+0], ebp - /* Get the current KPCR */ - mov ebx, fs:[KPCR_SELF] - - /* Get the Current Thread */ - mov edi, ecx - - /* Get the New Thread */ - mov esi, edx - /* Get the wait IRQL */ - movzx ecx, byte ptr [edi+KTHREAD_WAIT_IRQL] + or dl, cl /* Do the swap with the registers correctly setup */ call @KiSwapContextInternal@0 @@ -112,10 +53,21 @@ ret .endfunc +.globl @KiSwitchThreads@8 +.func @KiSwitchThreads@8, @KiSwitchThreads@8 +@KiSwitchThreads@8: + /* Load the new kernel stack and switch OS to new thread */ + mov esp, edx + call @KiSwapContextExit@8 + + /* Now we're on the new thread. Return to the caller to restore registers */ + add esp, 2 * 4 + ret +.endfunc + .globl @KiRetireDpcListInDpcStack@8 .func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8 @KiRetireDpcListInDpcStack@8: - /* Switch stacks and retire DPCs */ mov eax, esp mov esp, edx @@ -140,20 +92,6 @@ jmp $ .endfunc -.globl @KiSwitchThreads@8 -.func @KiSwitchThreads@8, @KiSwitchThreads@8 -@KiSwitchThreads@8: - - /* Load the new kernel stack and switch OS to new thread */ - mov esp, [edx+KTHREAD_KERNEL_STACK] - mov edx, esp - call @KiSwapContextExit@8 - - /* Now we're on the new thread. Return to the caller to restore registers */ - add esp, 2 * 4 - ret -.endfunc - .globl @Ki386BiosCallReturnAddress@4 @Ki386BiosCallReturnAddress@4: 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] Mon Nov 8 11:56:22 2010 @@ -309,7 +309,7 @@ NewThread->State = Running; /* Switch away from the idle thread */ - KiSwapContext(OldThread, NewThread); + KiSwapContext(APC_LEVEL, OldThread); /* We are back in the idle thread -- disable interrupts again */ _enable(); @@ -416,9 +416,6 @@ PKTHREAD OldThread, NewThread; ULONG Cr0, NewCr0; - /* Switch threads, check for APC disable */ - ASSERT(OldThreadAndApcFlag &~ 1); - /* Save APC bypass disable */ SwitchFrame->ApcBypassDisable = OldThreadAndApcFlag & 3; SwitchFrame->ExceptionList = Pcr->NtTib.ExceptionList; @@ -451,7 +448,7 @@ /* Now enable interrupts and do the switch */ _enable(); - KiSwitchThreads(OldThread, NewThread); + KiSwitchThreads(OldThread, NewThread->KernelStack); } VOID @@ -509,8 +506,8 @@ /* Make the old thread ready */ KxQueueReadyThread(OldThread, Prcb); - /* Swap to the new thread. FIXME: APC Bypass */ - KiSwapContext(OldThread, NewThread); + /* Swap to the new thread */ + KiSwapContext(APC_LEVEL, OldThread); } } Modified: trunk/reactos/ntoskrnl/ke/thrdschd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdschd.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] Mon Nov 8 11:56:22 2010 @@ -387,7 +387,7 @@ WaitIrql = CurrentThread->WaitIrql; /* Swap contexts */ - ApcState = KiSwapContext(CurrentThread, NextThread); + ApcState = KiSwapContext(WaitIrql, CurrentThread); /* Get the wait status */ WaitStatus = CurrentThread->WaitStatus; @@ -754,7 +754,7 @@ ASSERT(OldIrql <= DISPATCH_LEVEL); /* Swap to new thread */ - KiSwapContext(Thread, NextThread); + KiSwapContext(APC_LEVEL, Thread); Status = STATUS_SUCCESS; } else Modified: trunk/reactos/ntoskrnl/ke/wait.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/wait.c?rev=495…
============================================================================== --- trunk/reactos/ntoskrnl/ke/wait.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/wait.c [iso-8859-1] Mon Nov 8 11:56:22 2010 @@ -249,7 +249,7 @@ Thread->WaitIrql = OldIrql; /* Swap threads and check if APCs were pending */ - PendingApc = KiSwapContext(Thread, NextThread); + PendingApc = KiSwapContext(OldIrql, Thread); if (PendingApc) { /* Lower only to APC */
14 years, 1 month
1
0
0
0
[tkreuzer] 49522: [SHLWAPI] Explicitly add msvcrt before ntdll to use it's *sprintf functions. Fixes bug 5557
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Nov 8 10:04:43 2010 New Revision: 49522 URL:
http://svn.reactos.org/svn/reactos?rev=49522&view=rev
Log: [SHLWAPI] Explicitly add msvcrt before ntdll to use it's *sprintf functions. Fixes bug 5557 Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.rbuild Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.rbuild [iso-8859-1] Mon Nov 8 10:04:43 2010 @@ -37,6 +37,7 @@ <library>shell32</library> <library>winmm</library> <library>version</library> + <library>msvcrt</library> <library>ntdll</library> </module> </group>
14 years, 1 month
1
0
0
0
[sir_richard] 49521: [NTOS]: KiDispatchInterrupt (the DPC handler) in C, instead of ASM.
by sir_richard@svn.reactos.org
Author: sir_richard Date: Mon Nov 8 02:37:17 2010 New Revision: 49521 URL:
http://svn.reactos.org/svn/reactos?rev=49521&view=rev
Log: [NTOS]: KiDispatchInterrupt (the DPC handler) in C, instead of ASM. Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S trunk/reactos/ntoskrnl/ke/i386/thrdini.c Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] Mon Nov 8 02:37:17 2010 @@ -112,121 +112,18 @@ ret .endfunc -/* DPC INTERRUPT HANDLER ******************************************************/ +.globl @KiRetireDpcListInDpcStack@8 +.func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8 +@KiRetireDpcListInDpcStack@8: -.globl _KiDispatchInterrupt@0 -.func KiDispatchInterrupt@0 -_KiDispatchInterrupt@0: - - /* Preserve EBX */ - push ebx - - /* Get the PCR and disable interrupts */ - mov ebx, PCR[KPCR_SELF] - cli - - /* Check if we have to deliver DPCs, timers, or deferred threads */ - mov eax, [ebx+KPCR_PRCB_DPC_QUEUE_DEPTH] - or eax, [ebx+KPCR_PRCB_TIMER_REQUEST] - or eax, [ebx+KPCR_PRCB_DEFERRED_READY_LIST_HEAD] - jz CheckQuantum - - /* Save stack pointer and exception list, then clear it */ - push ebp - push dword ptr [ebx+KPCR_EXCEPTION_LIST] - mov dword ptr [ebx+KPCR_EXCEPTION_LIST], -1 - - /* Save the stack and switch to the DPC Stack */ - mov edx, esp - mov esp, [ebx+KPCR_PRCB_DPC_STACK] - push edx - - /* Deliver DPCs */ - mov ecx, [ebx+KPCR_PRCB] + /* Switch stacks and retire DPCs */ + mov eax, esp + mov esp, edx + push eax call @KiRetireDpcList@4 - /* Restore stack and exception list */ + /* Return on original stack */ pop esp - pop dword ptr [ebx+KPCR_EXCEPTION_LIST] - pop ebp - -CheckQuantum: - - /* Re-enable interrupts */ - sti - - /* Check if we have quantum end */ - cmp byte ptr [ebx+KPCR_PRCB_QUANTUM_END], 0 - jnz QuantumEnd - - /* Check if we have a thread to swap to */ - cmp byte ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0 - je Return - - /* Make space on the stack to save registers */ - sub esp, 3 * 4 - mov [esp+8], esi - mov [esp+4], edi - mov [esp+0], ebp - - /* Get the current thread */ - mov edi, [ebx+KPCR_CURRENT_THREAD] - -#ifdef CONFIG_SMP - /* Raise to synch level */ - call _KeRaiseIrqlToSynchLevel@0 - - /* Set context swap busy */ - mov byte ptr [edi+KTHREAD_SWAP_BUSY], 1 - - /* Acquire the PRCB Lock */ - lock bts dword ptr [ebx+KPCR_PRCB_PRCB_LOCK], 0 - jnb GetNext - lea ecx, [ebx+KPCR_PRCB_PRCB_LOCK] - call @KefAcquireSpinLockAtDpcLevel@4 -#endif - -GetNext: - /* Get the next thread and clear it */ - mov esi, [ebx+KPCR_PRCB_NEXT_THREAD] - and dword ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0 - - /* Set us as the current running thread */ - mov [ebx+KPCR_CURRENT_THREAD], esi - mov byte ptr [esi+KTHREAD_STATE_], Running - mov byte ptr [edi+KTHREAD_WAIT_REASON], WrDispatchInt - - /* Put thread in ECX and get the PRCB in EDX */ - mov ecx, edi - lea edx, [ebx+KPCR_PRCB_DATA] - call @KiQueueReadyThread@8 - - /* Set APC_LEVEL and do the swap */ - mov cl, APC_LEVEL - call @KiSwapContextInternal@0 - -#ifdef CONFIG_SMP - /* Lower IRQL back to dispatch */ - mov cl, DISPATCH_LEVEL - call @KfLowerIrql@4 -#endif - - /* Restore registers */ - mov ebp, [esp+0] - mov edi, [esp+4] - mov esi, [esp+8] - add esp, 3*4 - -Return: - /* All done */ - pop ebx - ret - -QuantumEnd: - /* Disable quantum end and process it */ - mov byte ptr [ebx+KPCR_PRCB_QUANTUM_END], 0 - call _KiQuantumEnd@0 - pop ebx ret .endfunc 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] Mon Nov 8 02:37:17 2010 @@ -47,6 +47,13 @@ KiSwitchThreads( IN PKTHREAD OldThread, IN PKTHREAD NewThread +); + +VOID +FASTCALL +KiRetireDpcListInDpcStack( + IN PKPRCB Prcb, + IN PVOID DpcStack ); /* FUNCTIONS *****************************************************************/ @@ -447,4 +454,65 @@ KiSwitchThreads(OldThread, NewThread); } +VOID +NTAPI +KiDispatchInterrupt(VOID) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPRCB Prcb = &Pcr->PrcbData; + PVOID OldHandler; + PKTHREAD NewThread, OldThread; + + /* Disable interrupts */ + _disable(); + + /* Check for pending timers, pending DPCs, or pending ready threads */ + if ((Prcb->DpcData[0].DpcQueueDepth) || + (Prcb->TimerRequest) || + (Prcb->DeferredReadyListHead.Next)) + { + /* Switch to safe execution context */ + OldHandler = Pcr->NtTib.ExceptionList; + Pcr->NtTib.ExceptionList = EXCEPTION_CHAIN_END; + + /* Retire DPCs while under the DPC stack */ + KiRetireDpcListInDpcStack(Prcb, Prcb->DpcStack); + + /* Restore context */ + Pcr->NtTib.ExceptionList = OldHandler; + } + + /* Re-enable interrupts */ + _enable(); + + /* Check for quantum end */ + if (Prcb->QuantumEnd) + { + /* Handle quantum end */ + Prcb->QuantumEnd = FALSE; + KiQuantumEnd(); + } + else if (Prcb->NextThread) + { + /* Capture current thread data */ + OldThread = Prcb->CurrentThread; + NewThread = Prcb->NextThread; + + /* Set new thread data */ + Prcb->NextThread = NULL; + Prcb->CurrentThread = NewThread; + + /* The thread is now running */ + NewThread->State = Running; + OldThread->WaitReason = WrDispatchInt; + + /* Make the old thread ready */ + KxQueueReadyThread(OldThread, Prcb); + + /* Swap to the new thread. FIXME: APC Bypass */ + KiSwapContext(OldThread, NewThread); + } +} + + /* EOF */
14 years, 1 month
1
0
0
0
[sir_richard] 49520: [NTOS]: Context switch in C instead of ASM. Can be made more portable, but it's a good start. Unless Timo rewrites it.
by sir_richard@svn.reactos.org
Author: sir_richard Date: Mon Nov 8 02:15:53 2010 New Revision: 49520 URL:
http://svn.reactos.org/svn/reactos?rev=49520&view=rev
Log: [NTOS]: Context switch in C instead of ASM. Can be made more portable, but it's a good start. Unless Timo rewrites it. Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S trunk/reactos/ntoskrnl/ke/i386/thrdini.c Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] Mon Nov 8 02:15:53 2010 @@ -40,284 +40,16 @@ .globl @KiSwapContextInternal@0 .func @KiSwapContextInternal@0, @KiSwapContextInternal@0 @KiSwapContextInternal@0: - - /* Save the IRQL */ - push ecx - -#ifdef CONFIG_SMP -GetSwapLock: - /* Acquire the swap lock */ - cmp byte ptr [esi+KTHREAD_SWAP_BUSY], 0 - jz NotBusy - pause - jmp GetSwapLock -NotBusy: -#endif - /* Increase context switches (use ES for lazy load) */ - inc dword ptr es:[ebx+KPCR_CONTEXT_SWITCHES] - - /* Save the Exception list */ - push [ebx+KPCR_EXCEPTION_LIST] - - /* Check for WMI */ - cmp dword ptr [ebx+KPCR_PERF_GLOBAL_GROUP_MASK], 0 - jnz WmiTrace - -AfterTrace: -#ifdef CONFIG_SMP -#if DBG - /* Assert that we're on the right CPU */ - mov cl, [esi+KTHREAD_NEXT_PROCESSOR] - cmp cl, [ebx+KPCR_PROCESSOR_NUMBER] - jnz WrongCpu -#endif -#endif - - /* Get CR0 and save it */ - mov ebp, cr0 - mov edx, ebp - -#ifdef CONFIG_SMP - /* Check NPX State */ - cmp byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_LOADED - jz NpxLoaded -SetStack: -#endif - - /* Set new stack */ - mov [edi+KTHREAD_KERNEL_STACK], esp - - /* Checking NPX, disable interrupts now */ - mov eax, [esi+KTHREAD_INITIAL_STACK] - cli - - /* Get the NPX State */ - movzx ecx, byte ptr [esi+KTHREAD_NPX_STATE] - - /* Clear the other bits, merge in CR0, merge in FPU CR0 bits and compare */ - and edx, ~(CR0_MP + CR0_EM + CR0_TS) - or ecx, edx - or ecx, [eax - (NPX_FRAME_LENGTH - FN_CR0_NPX_STATE)] - cmp ebp, ecx - jnz NewCr0 - -StackOk: - /* Enable interrupts and set the current stack */ - sti - mov esp, [esi+KTHREAD_KERNEL_STACK] - - /* Check if address space switch is needed */ - mov ebp, [esi+KTHREAD_APCSTATE_PROCESS] - mov eax, [edi+KTHREAD_APCSTATE_PROCESS] - cmp ebp, eax - jz SameProcess - -#ifdef CONFIG_SMP - /* Get the active processors and XOR with the process' */ - mov ecx, [ebx+KPCR_SET_MEMBER_COPY] - lock xor [ebp+KPROCESS_ACTIVE_PROCESSORS], ecx - lock xor [eax+KPROCESS_ACTIVE_PROCESSORS], ecx - - /* Assert change went ok */ -#if DBG - test [ebp+KPROCESS_ACTIVE_PROCESSORS], ecx - jz WrongActiveCpu - test [eax+KPROCESS_ACTIVE_PROCESSORS], ecx - jnz WrongActiveCpu -#endif -#endif - - /* Check if we need an LDT */ - mov ecx, [ebp+KPROCESS_LDT_DESCRIPTOR0] - or ecx, [eax+KPROCESS_LDT_DESCRIPTOR0] - jnz LdtReload - -UpdateCr3: - /* Switch address space */ - mov eax, [ebp+KPROCESS_DIRECTORY_TABLE_BASE] - mov cr3, eax - -SameProcess: - -#ifdef CONFIG_SMP - /* Release swap lock */ - and byte ptr [edi+KTHREAD_SWAP_BUSY], 0 -#endif - - /* Clear gs */ - xor eax, eax - mov gs, ax - - /* Set the TEB */ - mov eax, [esi+KTHREAD_TEB] - mov [ebx+KPCR_TEB], eax - mov ecx, [ebx+KPCR_GDT] - mov [ecx+0x3A], ax - shr eax, 16 - mov [ecx+0x3C], al - mov [ecx+0x3F], ah - - /* Get stack pointer */ - mov eax, [esi+KTHREAD_INITIAL_STACK] - - /* Make space for the NPX Frame */ - sub eax, NPX_FRAME_LENGTH - - /* Check if this isn't V86 Mode, so we can bias the Esp0 */ - test dword ptr [eax - KTRAP_FRAME_SIZE + KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK - jnz NoAdjust - - /* Bias esp */ - sub eax, KTRAP_FRAME_V86_GS - KTRAP_FRAME_SS - -NoAdjust: - - /* Set new ESP0 */ - mov ecx, [ebx+KPCR_TSS] - mov [ecx+KTSS_ESP0], eax - - /* Set current IOPM offset in the TSS */ - mov ax, [ebp+KPROCESS_IOPM_OFFSET] - mov [ecx+KTSS_IOMAPBASE], ax - - /* Increase context switches */ - inc dword ptr [esi+KTHREAD_CONTEXT_SWITCHES] - - /* Restore exception list */ - pop [ebx+KPCR_EXCEPTION_LIST] - - /* Restore IRQL */ - pop ecx - - /* DPC shouldn't be active */ - cmp byte ptr [ebx+KPCR_PRCB_DPC_ROUTINE_ACTIVE], 0 - jnz BugCheckDpc - - /* Check if kernel APCs are pending */ - cmp byte ptr [esi+KTHREAD_PENDING_KERNEL_APC], 0 - jnz CheckApc - - /* No APCs, return */ - xor eax, eax - ret - -CheckApc: - - /* Check if they're disabled */ - cmp word ptr [esi+KTHREAD_SPECIAL_APC_DISABLE], 0 - jnz ApcReturn - test cl, cl - jz ApcReturn - - /* Request APC Delivery */ - mov cl, APC_LEVEL - call @HalRequestSoftwareInterrupt@4 - or eax, esp - -ApcReturn: - - /* Return with APC pending */ - setz al - ret - -LdtReload: - /* Check if it's empty */ - mov eax, [ebp+KPROCESS_LDT_DESCRIPTOR0] - test eax, eax - jz LoadLdt - - /* Write the LDT Selector */ - mov ecx, [ebx+KPCR_GDT] - mov [ecx+KGDT_LDT], eax - mov eax, [ebp+KPROCESS_LDT_DESCRIPTOR1] - mov [ecx+KGDT_LDT+4], eax - - /* Write the INT21 handler */ - mov ecx, [ebx+KPCR_IDT] - mov eax, [ebp+KPROCESS_INT21_DESCRIPTOR0] - mov [ecx+0x108], eax - mov eax, [ebp+KPROCESS_INT21_DESCRIPTOR1] - mov [ecx+0x10C], eax - - /* Save LDT Selector */ - mov eax, KGDT_LDT - -LoadLdt: - lldt ax - jmp UpdateCr3 - -NewCr0: - -#if DBG - /* Assert NPX State */ - test byte ptr [esi+KTHREAD_NPX_STATE], ~(NPX_STATE_NOT_LOADED) - jnz InvalidNpx - test dword ptr [eax - (NPX_FRAME_LENGTH - FN_CR0_NPX_STATE)], ~(CR0_PE + CR0_MP + CR0_EM + CR0_TS) - jnz InvalidNpx -#endif - - /* Update CR0 */ - mov cr0, ecx - jmp StackOk - -#ifdef CONFIG_SMP -NpxLoaded: - - /* Mask out FPU flags */ - and edx, ~(CR0_MP + CR0_EM + CR0_TS) - - /* Get the NPX Frame */ - mov ecx, [edi+KTHREAD_INITIAL_STACK] - sub ecx, NPX_FRAME_LENGTH - - /* Check if we have a new CR0 */ - cmp ebp, edx - jz Cr0Equal - - /* We do, update it */ - mov cr0, edx - mov ebp, edx - -Cr0Equal: - - /* Save the NPX State */ - fxsave [ecx] - mov byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_NOT_LOADED - - /* Clear the NPX Thread */ - mov dword ptr [ebx+KPCR_NPX_THREAD], 0 - - /* Jump back */ - jmp SetStack -#endif - -WmiTrace: - - /* No WMI support yet */ - int 3 - - /* Jump back */ - jmp AfterTrace - -BugCheckDpc: - - /* Bugcheck the machine, printing out the threads being switched */ - mov eax, [edi+KTHREAD_INITIAL_STACK] - push 0 - push eax - push esi - push edi - push ATTEMPTED_SWITCH_FROM_DPC - call _KeBugCheckEx@20 - -#if DBG -InvalidNpx: - int 3 -WrongActiveCpu: - int 3 -WrongCpu: - int 3 -#endif + /* Set APC Bypass Disable and old thread pointer */ + mov edx, edi + or dl, cl + + /* Build switch frame */ + sub esp, 2 * 4 + mov ecx, esp + call @KiSwapContextEntry@8 + mov ecx, 0xB00BFACA + jmp $ .endfunc /*++ @@ -511,6 +243,20 @@ jmp $ .endfunc +.globl @KiSwitchThreads@8 +.func @KiSwitchThreads@8, @KiSwitchThreads@8 +@KiSwitchThreads@8: + + /* Load the new kernel stack and switch OS to new thread */ + mov esp, [edx+KTHREAD_KERNEL_STACK] + mov edx, esp + call @KiSwapContextExit@8 + + /* Now we're on the new thread. Return to the caller to restore registers */ + add esp, 2 * 4 + ret +.endfunc + .globl @Ki386BiosCallReturnAddress@4 @Ki386BiosCallReturnAddress@4: 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] Mon Nov 8 02:15:53 2010 @@ -41,6 +41,13 @@ KSTART_FRAME StartFrame; FX_SAVE_AREA FxSaveArea; } KKINIT_FRAME, *PKKINIT_FRAME; + +VOID +FASTCALL +KiSwitchThreads( + IN PKTHREAD OldThread, + IN PKTHREAD NewThread +); /* FUNCTIONS *****************************************************************/ @@ -311,4 +318,133 @@ } } +BOOLEAN +FASTCALL +KiSwapContextExit(IN PKTHREAD OldThread, + IN PKSWITCHFRAME SwitchFrame) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKPROCESS OldProcess, NewProcess; + PKGDTENTRY GdtEntry; + PKTHREAD NewThread; + PKUINIT_FRAME InitFrame; + + /* We are on the new thread stack now */ + NewThread = Pcr->PrcbData.CurrentThread; + + /* Now we are the new thread. Check if it's in a new process */ + OldProcess = OldThread->ApcState.Process; + NewProcess = NewThread->ApcState.Process; + if (OldProcess != NewProcess) + { + /* Check if there is a different LDT */ + if (*(PULONGLONG)&OldProcess->LdtDescriptor != *(PULONGLONG)&NewProcess->LdtDescriptor) + { + DPRINT1("LDT switch not implemented\n"); + ASSERT(FALSE); + } + + /* Switch address space and flush TLB */ + __writecr3(NewProcess->DirectoryTableBase[0]); + } + + /* Clear GS */ + Ke386SetGs(0); + + /* Set the TEB */ + Pcr->NtTib.Self = (PVOID)NewThread->Teb; + GdtEntry = &Pcr->GDT[KGDT_R3_TEB / sizeof(KGDTENTRY)]; + GdtEntry->BaseLow = (USHORT)((ULONG_PTR)NewThread->Teb & 0xFFFF); + GdtEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)NewThread->Teb >> 16); + GdtEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)NewThread->Teb >> 24); + + /* Set new TSS fields */ + InitFrame = (PKUINIT_FRAME)NewThread->InitialStack - 1; + Pcr->TSS->Esp0 = (ULONG_PTR)&InitFrame->TrapFrame; + if (!(InitFrame->TrapFrame.EFlags & EFLAGS_V86_MASK)) + { + Pcr->TSS->Esp0 -= (FIELD_OFFSET(KTRAP_FRAME, V86Gs) - FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs)); + } + Pcr->TSS->IoMapBase = NewProcess->IopmOffset; + + /* Increase thread context switches */ + NewThread->ContextSwitches++; + + /* Load data from switch frame */ + Pcr->NtTib.ExceptionList = SwitchFrame->ExceptionList; + + /* DPCs shouldn't be active */ + if (Pcr->PrcbData.DpcRoutineActive) + { + /* Crash the machine */ + KeBugCheckEx(ATTEMPTED_SWITCH_FROM_DPC, + (ULONG_PTR)OldThread, + (ULONG_PTR)NewThread, + (ULONG_PTR)OldThread->InitialStack, + 0); + } + + /* Kernel APCs may be pending */ + if (NewThread->ApcState.KernelApcPending) + { + /* Are APCs enabled? */ + if (!NewThread->SpecialApcDisable) + { + /* Request APC delivery */ + if (!SwitchFrame->ApcBypassDisable) HalRequestSoftwareInterrupt(APC_LEVEL); + return TRUE; + } + } + + /* Return */ + return FALSE; +} + +VOID +FASTCALL +KiSwapContextEntry(IN PKSWITCHFRAME SwitchFrame, + IN ULONG_PTR OldThreadAndApcFlag) +{ + PKIPCR Pcr = (PKIPCR)KeGetPcr(); + PKTHREAD OldThread, NewThread; + ULONG Cr0, NewCr0; + + /* Switch threads, check for APC disable */ + ASSERT(OldThreadAndApcFlag &~ 1); + + /* Save APC bypass disable */ + SwitchFrame->ApcBypassDisable = OldThreadAndApcFlag & 3; + SwitchFrame->ExceptionList = Pcr->NtTib.ExceptionList; + + /* Increase context switch count and check if tracing is enabled */ + Pcr->ContextSwitches++; + if (Pcr->PerfGlobalGroupMask) + { + /* We don't support this yet on x86 either */ + DPRINT1("WMI Tracing not supported\n"); + ASSERT(FALSE); + } + + /* Get thread pointers */ + OldThread = (PKTHREAD)(OldThreadAndApcFlag & ~3); + NewThread = Pcr->PrcbData.CurrentThread; + + /* Get the old thread and set its kernel stack */ + OldThread->KernelStack = SwitchFrame; + + /* ISRs can change FPU state, so disable interrupts while checking */ + _disable(); + + /* Get current and new CR0 and check if they've changed */ + Cr0 = __readcr0(); + NewCr0 = NewThread->NpxState | + (Cr0 & ~(CR0_MP | CR0_EM | CR0_TS)) | + ((PKUINIT_FRAME)NewThread->InitialStack - 1)->FxSaveArea.Cr0NpxState; + if (Cr0 != NewCr0) __writecr0(NewCr0); + + /* Now enable interrupts and do the switch */ + _enable(); + KiSwitchThreads(OldThread, NewThread); +} + /* EOF */
14 years, 1 month
1
0
0
0
[pschweitzer] 49519: [NTOSKRNL] Minor stuff. Here is your commit Timo ; )
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Nov 8 00:31:00 2010 New Revision: 49519 URL:
http://svn.reactos.org/svn/reactos?rev=49519&view=rev
Log: [NTOSKRNL] Minor stuff. Here is your commit Timo ;) Modified: trunk/reactos/ntoskrnl/fsrtl/faulttol.c Modified: trunk/reactos/ntoskrnl/fsrtl/faulttol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/faulttol.c?…
============================================================================== --- trunk/reactos/ntoskrnl/fsrtl/faulttol.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fsrtl/faulttol.c [iso-8859-1] Mon Nov 8 00:31:00 2010 @@ -17,7 +17,7 @@ /*++ * @name FsRtlBalanceReads - * @implemented NT 4.0 + * @implemented NT 5.2 * * The FsRtlBalanceReads routine sends an IRP to an FTDISK Driver * requesting the driver to balance read requests across a mirror set. @@ -65,6 +65,8 @@ KernelMode, FALSE, NULL); + ASSERT(Status == STATUS_SUCCESS); + /* Return Status */ Status = IoStatusBlock.Status; } @@ -75,7 +77,7 @@ /*++ * @name FsRtlSyncVolumes - * @implemented NT 4.0 + * @implemented NT 5.2 * * The FsRtlSyncVolumes routine is deprecated. *
14 years, 1 month
1
0
0
0
[spetreolle] 49518: [CMAKE] Add missing files to bootcd.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sun Nov 7 21:24:35 2010 New Revision: 49518 URL:
http://svn.reactos.org/svn/reactos?rev=49518&view=rev
Log: [CMAKE] Add missing files to bootcd. Added: branches/cmake-bringup/importlibs/libd3d9.a (with props) Modified: branches/cmake-bringup/base/setup/reactos/CMakeLists.txt branches/cmake-bringup/base/setup/welcome/CMakeLists.txt branches/cmake-bringup/boot/CMakeLists.txt branches/cmake-bringup/drivers/ksfilter/ks/CMakeLists.txt Modified: branches/cmake-bringup/base/setup/reactos/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/setup/reacto…
============================================================================== --- branches/cmake-bringup/base/setup/reactos/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/base/setup/reactos/CMakeLists.txt [iso-8859-1] Sun Nov 7 21:24:35 2010 @@ -14,3 +14,5 @@ msvcrt kernel32 ntdll) + +add_minicd_target(reactos reactos) Modified: branches/cmake-bringup/base/setup/welcome/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/setup/welcom…
============================================================================== --- branches/cmake-bringup/base/setup/welcome/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/base/setup/welcome/CMakeLists.txt [iso-8859-1] Sun Nov 7 21:24:35 2010 @@ -5,3 +5,5 @@ set_module_type(welcome win32gui) add_importlibs(welcome gdi32 user32 msvcrt kernel32 ntdll) + +add_minicd_target(welcome reactos) Modified: branches/cmake-bringup/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/boot/CMakeLists.t…
============================================================================== --- branches/cmake-bringup/boot/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/boot/CMakeLists.txt [iso-8859-1] Sun Nov 7 21:24:35 2010 @@ -215,7 +215,9 @@ add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/hivedef_${ARCH}.inf reactos hivedef.inf) add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/hivesft_${ARCH}.inf reactos hivesft.inf) add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/hivesys_${ARCH}.inf reactos hivesys.inf) - +add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/autorun.inf "" autorun.inf) +add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/icon.ico "" icon.ico) +add_minicd(${CMAKE_CURRENT_SOURCE_DIR}/bootdata/readme.txt "" readme.txt) # Livecd files list(APPEND LIVECD_HIVES ${CMAKE_CURRENT_SOURCE_DIR}/bootdata/livecd.inf Modified: branches/cmake-bringup/drivers/ksfilter/ks/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/ksfilter/…
============================================================================== --- branches/cmake-bringup/drivers/ksfilter/ks/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/drivers/ksfilter/ks/CMakeLists.txt [iso-8859-1] Sun Nov 7 21:24:35 2010 @@ -38,3 +38,5 @@ add_importlibs(ks ntoskrnl hal msvcrt) add_dependencies(ks psdk bugcodes) + +add_cab_target(ks 2) Added: branches/cmake-bringup/importlibs/libd3d9.a URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/importlibs/libd3d…
============================================================================== Binary file - no diff available. Propchange: branches/cmake-bringup/importlibs/libd3d9.a ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
14 years, 1 month
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
50
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
Results per page:
10
25
50
100
200