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
January 2005
----- 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
28 participants
703 discussions
Start a n
N
ew thread
[hbirr] 12834: - Replaced MP with CONFIG_SMP.
by hbirr@svn.reactos.com
- Replaced MP with CONFIG_SMP. - Used interlocked function for accessing the page directories/tables. Modified: trunk/reactos/ntoskrnl/mm/i386/page.c _____ Modified: trunk/reactos/ntoskrnl/mm/i386/page.c --- trunk/reactos/ntoskrnl/mm/i386/page.c 2005-01-05 19:26:51 UTC (rev 12833) +++ trunk/reactos/ntoskrnl/mm/i386/page.c 2005-01-05 19:27:58 UTC (rev 12834) @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: page.c,v 1.80 2004/12/30 08:05:11 hyperion Exp $ +/* $Id$ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/i386/page.c @@ -106,7 +106,7 @@ VOID MiFlushTlb(PULONG Pt, PVOID Address) { -#ifdef MP +#ifdef CONFIG_SMP if (Pt) { MmUnmapPageTable(Pt); @@ -635,7 +635,7 @@ { KEBUGCHECK(0); } - if (PageDir[PdeOffset] == 0) + if (0 == InterlockedCompareExchangeUL(&PageDir[PdeOffset], 0, 0)) { if (Create == FALSE) { @@ -667,11 +667,11 @@ return Pt + ADDR_TO_PTE_OFFSET(Address); } PageDir = ADDR_TO_PDE(Address); - if (*PageDir == 0) + if (0 == InterlockedCompareExchangeUL(PageDir, 0, 0)) { if (Address >= (PVOID)KERNEL_BASE) { - if (MmGlobalKernelPageDirectory[PdeOffset] == 0) + if (0 == InterlockedCompareExchangeUL(&MmGlobalKernelPageDirectory[PdeOffset], 0, 0)) { if (Create == FALSE) { @@ -692,7 +692,7 @@ MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); } } - *PageDir =MmGlobalKernelPageDirectory[PdeOffset]; + InterlockedExchangeUL(PageDir, MmGlobalKernelPageDirectory[PdeOffset]); } else { @@ -907,7 +907,7 @@ /* * Set the entry to zero */ - *Pt = 0; + InterlockedExchangeUL(Pt, 0); MiFlushTlb(Pt, Address); } } @@ -1596,7 +1596,7 @@ { KEBUGCHECK(0); } - *Pt = PFN_TO_PTE(Pages[i]) | Attributes; + InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); } } @@ -1665,7 +1665,7 @@ { MmMarkPageUnmapped(PTE_TO_PFN((Pte))); } - *Pt = SwapEntry << 1; + InterlockedExchangeUL(Pt, SwapEntry << 1); if (Pte != 0) { MiFlushTlb(Pt, Address); @@ -1866,7 +1866,7 @@ { MmMarkPageUnmapped(PTE_TO_PFN((Pte))); } - *Pt = PFN_TO_PTE(Pages[i]) | Attributes; + InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); if (Address < (PVOID)KERNEL_BASE && Process->AddressSpace.PageTableRefCountTable != NULL && Attributes & PA_PRESENT) @@ -2027,7 +2027,7 @@ { KEBUGCHECK(0); } - *Pt = PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY)); + InterlockedExchange(Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY))); MiFlushTlb(Pt, Address); } } @@ -2174,6 +2174,7 @@ if (Ke386GlobalPagesEnabled) { MmGlobalKernelPageDirectoryForPAE[i] |= PA_GLOBAL; + CurrentPageDirectory[i] |= PA_GLOBAL; } } } @@ -2190,6 +2191,7 @@ if (Ke386GlobalPagesEnabled) { MmGlobalKernelPageDirectory[i] |= PA_GLOBAL; + CurrentPageDirectory[i] |= PA_GLOBAL; } } }
19 years, 11 months
1
0
0
0
[hbirr] 12833: - Replaced MP with CONFIG_SMP.
by hbirr@svn.reactos.com
- Replaced MP with CONFIG_SMP. - Implemented an idle processor map. - Fixed the initialisation of the first kernel stack for the application processors. Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/ps/thread.c _____ Modified: trunk/reactos/ntoskrnl/ke/main.c --- trunk/reactos/ntoskrnl/ke/main.c 2005-01-05 19:25:49 UTC (rev 12832) +++ trunk/reactos/ntoskrnl/ke/main.c 2005-01-05 19:26:51 UTC (rev 12833) @@ -518,11 +518,7 @@ PsPrepareForApplicationProcessorInit(KeNumberProcessors); /* Allocate a stack for use when booting the processor */ - /* FIXME: The nonpaged memory for the stack is not released after use */ - ProcessorStack = - (char*)ExAllocatePool(NonPagedPool, MM_STACK_SIZE) + MM_STACK_SIZE; - Ki386InitialStackArray[((int)KeNumberProcessors)] = - (PVOID)((char*)ProcessorStack - MM_STACK_SIZE); + ProcessorStack = Ki386InitialStackArray[((int)KeNumberProcessors)] + MM_STACK_SIZE; HalStartNextProcessor(0, (ULONG)ProcessorStack - 2*sizeof(FX_SAVE_AREA)); KeNumberProcessors++; _____ Modified: trunk/reactos/ntoskrnl/ps/thread.c --- trunk/reactos/ntoskrnl/ps/thread.c 2005-01-05 19:25:49 UTC (rev 12832) +++ trunk/reactos/ntoskrnl/ps/thread.c 2005-01-05 19:26:51 UTC (rev 12833) @@ -34,11 +34,14 @@ LONG PiNrThreadsAwaitingReaping = 0; +extern PVOID Ki386InitialStackArray[MAXIMUM_PROCESSORS]; + /* * PURPOSE: List of threads associated with each priority level */ static LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY]; static ULONG PriorityListMask = 0; +static ULONG IdleProcessorMask = 0; static BOOLEAN DoneInitYet = FALSE; static KEVENT PiReaperThreadEvent; static BOOLEAN PiReaperThreadShouldTerminate = FALSE; @@ -56,7 +59,7 @@ */ PKTHREAD STDCALL KeGetCurrentThread(VOID) { -#ifdef MP +#ifdef CONFIG_SMP ULONG Flags; PKTHREAD Thread; Ke386SaveFlags(Flags); @@ -299,8 +302,10 @@ Thread = CONTAINING_RECORD(AThread, ETHREAD, ThreadListEntry); nThreads++; - DbgPrint("Thread->Tcb.State %d PID.TID %d.%d Name %.8s Stack: \n", + DbgPrint("Thread->Tcb.State %d Affinity %08x Priority %d PID.TID %d.%d Name %.8s Stack: \n", Thread->Tcb.State, + Thread->Tcb.Affinity, + Thread->Tcb.Priority, Thread->ThreadsProcess->UniqueProcessId, Thread->Cid.UniqueThread, Thread->ThreadsProcess->ImageFileName); @@ -425,6 +430,7 @@ if (Candidate != NULL) { PETHREAD OldThread; + PKTHREAD IdleThread; DPRINT("Scheduling %x(%d)\n",Candidate, CurrentPriority); @@ -432,7 +438,17 @@ OldThread = CurrentThread; CurrentThread = Candidate; + IdleThread = KeGetCurrentKPCR()->PrcbData.IdleThread; + if (&OldThread->Tcb == IdleThread) + { + IdleProcessorMask &= ~Affinity; + } + else if (&CurrentThread->Tcb == IdleThread) + { + IdleProcessorMask |= Affinity; + } + MmUpdatePageDir(PsGetCurrentProcess(),(PVOID)CurrentThread->ThreadsProce ss, sizeof(EPROCESS)); KiArchContextSwitch(&CurrentThread->Tcb, &OldThread->Tcb); @@ -475,12 +491,41 @@ } else { + ULONG Processor; + KAFFINITY Affinity; if (WaitStatus != NULL) { Thread->Tcb.WaitStatus = *WaitStatus; } Thread->Tcb.State = THREAD_STATE_READY; PsInsertIntoThreadList(Thread->Tcb.Priority, Thread); + Processor = KeGetCurrentProcessorNumber(); + Affinity = Thread->Tcb.Affinity; + if (!(IdleProcessorMask & (1 << Processor) & Affinity) && + (IdleProcessorMask & ~(1 << Processor) & Affinity)) + { + ULONG i; + for (i = 0; i < KeNumberProcessors - 1; i++) + { + Processor++; + if (Processor >= KeNumberProcessors) + { + Processor = 0; + } + if (IdleProcessorMask & (1 << Processor) & Affinity) + { +#if 0 + /* FIXME: + * Reschedule the threads on an other processor + */ + KeReleaseDispatcherDatabaseLockFromDpcLevel(); + KiRequestReschedule(Processor); + KeAcquireDispatcherDatabaseLockAtDpcLevel(); +#endif + break; + } + } + } } } @@ -634,6 +679,10 @@ VOID PsApplicationProcessorInit(VOID) { + KIRQL oldIrql; + oldIrql = KeAcquireDispatcherDatabaseLock(); + IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber()); + KeReleaseDispatcherDatabaseLock(oldIrql); } VOID INIT_FUNCTION @@ -648,7 +697,7 @@ &IdleThreadHandle, THREAD_ALL_ACCESS, NULL, - TRUE); + FALSE); IdleThread->Tcb.State = THREAD_STATE_RUNNING; IdleThread->Tcb.FreezeCount = 0; IdleThread->Tcb.Affinity = 1 << Id; @@ -657,6 +706,9 @@ IdleThread->Tcb.BasePriority = LOW_PRIORITY; Pcr->PrcbData.IdleThread = &IdleThread->Tcb; Pcr->PrcbData.CurrentThread = &IdleThread->Tcb; + + Ki386InitialStackArray[Id] = (PVOID)IdleThread->Tcb.StackLimit; + NtClose(IdleThreadHandle); DPRINT("IdleThread for Processor %d has PID %d\n", Id, IdleThread->Cid.UniqueThread);
19 years, 11 months
1
0
0
0
[hbirr] 12832: - Replaced MP with CONFIG_SMP.
by hbirr@svn.reactos.com
- Replaced MP with CONFIG_SMP. Modified: trunk/reactos/config Modified: trunk/reactos/hal/halx86/include/halirq.h Modified: trunk/reactos/hal/halx86/mp/Makefile Modified: trunk/reactos/hal/halx86/up/Makefile Modified: trunk/reactos/ntoskrnl/ex/i386/interlck.c Modified: trunk/reactos/ntoskrnl/include/internal/debug.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h Modified: trunk/reactos/ntoskrnl/ke/dpc.c Modified: trunk/reactos/ntoskrnl/ke/i386/fpu.c Modified: trunk/reactos/ntoskrnl/ke/i386/irq.c Modified: trunk/reactos/ntoskrnl/ke/i386/multiboot.S Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ke/spinlock.c Modified: trunk/reactos/ntoskrnl/mm/mminit.c Modified: trunk/reactos/tools/config.mk Modified: trunk/reactos/tools/mkconfig.c _____ Modified: trunk/reactos/config --- trunk/reactos/config 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/config 2005-01-05 19:25:49 UTC (rev 12832) @@ -35,7 +35,7 @@ # # Whether to compile a multiprocessor or single processor version # -MP := 0 +CONFIG_SMP := 0 # # Whether to compile for ACPI compliant systems _____ Modified: trunk/reactos/hal/halx86/include/halirq.h --- trunk/reactos/hal/halx86/include/halirq.h 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/hal/halx86/include/halirq.h 2005-01-05 19:25:49 UTC (rev 12832) @@ -1,11 +1,11 @@ /* - * $Id: halirq.h,v 1.1 2004/11/01 14:37:18 hbirr Exp $ + * $Id$ */ #ifndef __INCLUDE_HAL_HALIRQ #define __INCLUDE_HAL_HALIRQ -#ifdef MP +#ifdef CONFIG_SMP #define FIRST_DEVICE_VECTOR (0x30) #define FIRST_SYSTEM_VECTOR (0xef) _____ Modified: trunk/reactos/hal/halx86/mp/Makefile --- trunk/reactos/hal/halx86/mp/Makefile 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/hal/halx86/mp/Makefile 2005-01-05 19:25:49 UTC (rev 12832) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.4 2004/12/13 02:20:09 blight Exp $ +# $Id$ PATH_TO_TOP = ../../.. @@ -22,14 +22,14 @@ TARGET_DEFNAME = ../../hal/hal -TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ -DMP +TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ -DCONFIG_SMP -TARGET_CFLAGS = -I../include -I$(PATH_TO_TOP)/ntoskrnl/include -Wall -Werror -DMP +TARGET_CFLAGS = -I../include -I$(PATH_TO_TOP)/ntoskrnl/include -Wall -Werror -DCONFIG_SMP # require os code to explicitly request A/W version of structs/functions TARGET_CFLAGS += -D_DISABLE_TIDENTS -ifneq ($(MP), 1) +ifneq ($(CONFIG_SMP), 1) TARGET_INSTALL = no else TARGET_BOOTSTRAP = yes _____ Modified: trunk/reactos/hal/halx86/up/Makefile --- trunk/reactos/hal/halx86/up/Makefile 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/hal/halx86/up/Makefile 2005-01-05 19:25:49 UTC (rev 12832) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.4 2004/12/13 02:20:09 blight Exp $ +# $Id$ PATH_TO_TOP = ../../.. @@ -24,14 +24,14 @@ TARGET_DEFNAME = ../../hal/hal -TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ -DUP +TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ -TARGET_CFLAGS = -I../include -I$(PATH_TO_TOP)/ntoskrnl/include -Wall -Werror -DUP +TARGET_CFLAGS = -I../include -I$(PATH_TO_TOP)/ntoskrnl/include -Wall -Werror # require os code to explicitly request A/W version of structs/functions TARGET_CFLAGS += -D_DISABLE_TIDENTS -ifeq ($(MP), 1) +ifeq ($(CONFIG_SMP), 1) TARGET_INSTALL = no else TARGET_BOOTSTRAP = yes _____ Modified: trunk/reactos/ntoskrnl/ex/i386/interlck.c --- trunk/reactos/ntoskrnl/ex/i386/interlck.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ex/i386/interlck.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -11,7 +11,7 @@ #if defined(__GNUC__) -#ifdef MP +#ifdef CONFIG_SMP #define LOCK "lock ; " #else #define LOCK "" @@ -19,7 +19,7 @@ #elif defined(_MSC_VER) -#ifdef MP +#ifdef CONFIG_SMP #define LOCK lock #else #define LOCK _____ Modified: trunk/reactos/ntoskrnl/include/internal/debug.h --- trunk/reactos/ntoskrnl/include/internal/debug.h 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/include/internal/debug.h 2005-01-05 19:25:49 UTC (rev 12832) @@ -20,8 +20,8 @@ #include <internal/ntoskrnl.h> #include <internal/dbg.h> -#include <roscfg.h> + #if defined(_MSC_VER) && (_MSC_VER < 1300) /* TODO: Verify which version the MS compiler learned the __FUNCTION__ macro */ #define __FUNCTION__ "<unknown>" @@ -37,8 +37,13 @@ /* Assert only on "checked" version */ #ifndef NASSERT +#ifdef CONFIG_SMP +#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d for CPU%d\n", __FILE__,__LINE__, KeGetCurrentKPCR()->ProcessorNumber), KeBugCheck(0); } +#define ASSERT(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d for CPU%d\n", __FILE__,__LINE__, KeGetCurrentKPCR()->ProcessorNumber), KeBugCheck(0); } +#else #define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); } #define ASSERT(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); } +#endif #define assertmsg(_c_, _m_) \ if (!(_c_)) { \ _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h --- trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-01-05 19:25:49 UTC (rev 12832) @@ -192,7 +192,7 @@ VOID NtEarlyInitVdm(VOID); -#ifdef MP +#ifdef CONFIG_SMP #define LOCK "lock ; " #else #define LOCK "" _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h --- trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-01-05 19:25:49 UTC (rev 12832) @@ -248,7 +248,7 @@ #ifndef __USE_W32API -#ifdef MP +#ifdef CONFIG_SMP static inline PKPCR KeGetCurrentKPCR(VOID) { _____ Modified: trunk/reactos/ntoskrnl/ke/dpc.c --- trunk/reactos/ntoskrnl/ke/dpc.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/dpc.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -193,7 +193,7 @@ // KeLowerIrql(OldIrql); //} -#ifdef MP +#ifdef CONFIG_SMP /* Get the right PCR for this CPU */ if (Dpc->Number >= MAXIMUM_PROCESSORS) { ASSERT (Dpc->Number - MAXIMUM_PROCESSORS < KeNumberProcessors); @@ -211,7 +211,7 @@ /* Get the DPC Data */ if (InterlockedCompareExchangeUL(&Dpc->DpcData, &Pcr->PrcbData.DpcData[0].DpcLock, 0)) { DPRINT("DPC Already Inserted"); -#ifdef MP +#ifdef CONFIG_SMP KiReleaseSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); #endif KeLowerIrql(OldIrql); @@ -242,7 +242,7 @@ /* Make sure a DPC isn't executing already and respect rules outlined above. */ if ((!Pcr->PrcbData.DpcRoutineActive) && (!Pcr->PrcbData.DpcInterruptRequested)) { -#ifdef MP +#ifdef CONFIG_SMP /* Check if this is the same CPU */ if (Pcr != KeGetCurrentKPCR()) { /* Send IPI if High Importance */ @@ -280,7 +280,7 @@ } #endif } -#ifdef MP +#ifdef CONFIG_SMP KiReleaseSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); #endif /* Lower IRQL */ @@ -309,7 +309,7 @@ /* Raise IRQL */ DPRINT("Removing DPC: %x\n", Dpc); KeRaiseIrql(HIGH_LEVEL, &OldIrql); -#ifdef MP +#ifdef CONFIG_SMP KiAcquireSpinLock(&((PKDPC_DATA)Dpc->DpcData)->DpcLock); #endif @@ -322,7 +322,7 @@ RemoveEntryList(&Dpc->DpcListEntry); } -#ifdef MP +#ifdef CONFIG_SMP KiReleaseSpinLock(&((PKDPC_DATA)Dpc->DpcData)->DpcLock); #endif @@ -494,7 +494,7 @@ if (Pcr->PrcbData.DpcData[0].DpcQueueDepth > 0) { /* Raise IRQL */ KeRaiseIrql(HIGH_LEVEL, &OldIrql); -#ifdef MP +#ifdef CONFIG_SMP KiAcquireSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); #endif Pcr->PrcbData.DpcRoutineActive = TRUE; @@ -511,7 +511,7 @@ DPRINT("Dpc->DpcListEntry.Flink %x\n", Dpc->DpcListEntry.Flink); Dpc->DpcData = NULL; Pcr->PrcbData.DpcData[0].DpcQueueDepth--; -#ifdef MP +#ifdef CONFIG_SMP KiReleaseSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); #endif /* Disable/Enabled Interrupts and Call the DPC */ @@ -523,7 +523,7 @@ Dpc->SystemArgument2); KeRaiseIrql(HIGH_LEVEL, &OldIrql); -#ifdef MP +#ifdef CONFIG_SMP KiAcquireSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); /* * If the dpc routine drops the irql below DISPATCH_LEVEL, @@ -542,7 +542,7 @@ /* Clear DPC Flags */ Pcr->PrcbData.DpcRoutineActive = FALSE; Pcr->PrcbData.DpcInterruptRequested = FALSE; -#ifdef MP +#ifdef CONFIG_SMP KiReleaseSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); #endif _____ Modified: trunk/reactos/ntoskrnl/ke/i386/fpu.c --- trunk/reactos/ntoskrnl/ke/i386/fpu.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/i386/fpu.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -1,4 +1,4 @@ -/* $Id: fpu.c,v 1.19 2004/11/27 23:50:26 hbirr Exp $ +/* $Id$ * * ReactOS kernel * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team @@ -69,7 +69,7 @@ ULONG HardwareMathSupport = 0; static ULONG MxcsrFeatureMask = 0, XmmSupport = 0; -ULONG FxsrSupport = 0; /* used by Ki386ContextSwitch for MP */ +ULONG FxsrSupport = 0; /* used by Ki386ContextSwitch for SMP */ /* FUNCTIONS *****************************************************************/ @@ -413,7 +413,7 @@ PKTHREAD CurrentThread; PFX_SAVE_AREA FxSaveArea; KIRQL oldIrql; -#ifndef MP +#ifndef CONFIG_SMP PKTHREAD NpxThread; #endif @@ -428,14 +428,14 @@ asm volatile("clts"); CurrentThread = KeGetCurrentThread(); -#ifndef MP +#ifndef CONFIG_SMP NpxThread = KeGetCurrentKPCR()->PrcbData.NpxThread; #endif ASSERT(CurrentThread != NULL); DPRINT("Device not present exception happened! (Cr0 = 0x%x, NpxState = 0x%x)\n", cr0, CurrentThread->NpxState); -#ifndef MP +#ifndef CONFIG_SMP /* check if the current thread already owns the FPU */ if (NpxThread != CurrentThread) /* FIXME: maybe this could be an assertation */ { @@ -456,7 +456,7 @@ } NpxThread->NpxState = NPX_STATE_VALID; } -#endif /* !MP */ +#endif /* !CONFIG_SMP */ /* restore the state of the current thread */ ASSERT((CurrentThread->NpxState & NPX_STATE_DIRTY) == 0); @@ -492,7 +492,7 @@ } } KeGetCurrentKPCR()->PrcbData.NpxThread = CurrentThread; -#ifndef MP +#ifndef CONFIG_SMP } #endif _____ Modified: trunk/reactos/ntoskrnl/ke/i386/irq.c --- trunk/reactos/ntoskrnl/ke/i386/irq.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/i386/irq.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -47,7 +47,7 @@ /* GLOBALS *****************************************************************/ -#ifdef MP +#ifdef CONFIG_SMP #define __STR(x) #x #define STR(x) __STR(x) @@ -135,7 +135,7 @@ #undef L #undef L16 -#else /* MP */ +#else /* CONFIG_SMP */ void irq_handler_0(void); void irq_handler_1(void); @@ -174,7 +174,7 @@ (int)&irq_handler_15, }; -#endif /* MP */ +#endif /* CONFIG_SMP */ /* * PURPOSE: Object describing each isr @@ -190,7 +190,7 @@ } ISR_TABLE, *PISR_TABLE; -#ifdef MP +#ifdef CONFIG_SMP static ISR_TABLE IsrTable[NR_IRQS][MAXIMUM_PROCESSORS]; #else static ISR_TABLE IsrTable[NR_IRQS][1]; @@ -217,7 +217,7 @@ KiIdt[IRQ_BASE+i].a=(irq_handler[i]&0xffff)+(KERNEL_CS<<16); KiIdt[IRQ_BASE+i].b=(irq_handler[i]&0xffff0000)+PRESENT+ I486_INTERRUPT_GATE; -#ifdef MP +#ifdef CONFIG_SMP for (j = 0; j < MAXIMUM_PROCESSORS; j++) #else j = 0; @@ -352,7 +352,7 @@ */ Ke386EnableInterrupts(); -#ifndef MP +#ifndef CONFIG_SMP if (VECTOR2IRQ(vector) == 0) { KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame); _____ Modified: trunk/reactos/ntoskrnl/ke/i386/multiboot.S --- trunk/reactos/ntoskrnl/ke/i386/multiboot.S 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/i386/multiboot.S 2005-01-05 19:25:49 UTC (rev 12832) @@ -12,11 +12,11 @@ #define V2P(x) (x - KERNEL_BASE + 0x200000) -#ifdef MP +#ifdef CONFIG_SMP #define AP_MAGIC (0x12481020) -#endif /* MP */ +#endif /* CONFIG_SMP */ .globl _NtProcessStartup .globl _start @@ -79,7 +79,7 @@ */ cld -#ifdef MP +#ifdef CONFIG_SMP /* * Save the multiboot or application processor magic @@ -89,7 +89,7 @@ cmpl $AP_MAGIC, %edx je .m1 -#endif /* MP */ +#endif /* CONFIG_SMP */ /* * Zero the BSS @@ -115,9 +115,9 @@ movl $(V2P(startup_pagedirectory) + 0x3), 0xF00(%esi) movl $(V2P(kernelmap_pagetable) + 0x3), 0xF0C(%esi) -#ifdef MP +#ifdef CONFIG_SMP movl $(V2P(apic_pagetable) + 0x3), 0xFEC(%esi) -#endif /* MP */ +#endif /* CONFIG_SMP */ movl $(V2P(kpcr_pagetable) + 0x3), 0xFF0(%esi) /* @@ -146,7 +146,7 @@ cmpl $6144, %edi jl .l4 -#ifdef MP +#ifdef CONFIG_SMP /* * Initialize the page table that maps the APIC register address space @@ -164,7 +164,7 @@ movl $0xFEE0001B, %eax movl %eax, (%esi, %edi) -#endif /* MP */ +#endif /* CONFIG_SMP */ /* * Initialize the page table that maps the initial KPCR (at FF000000) @@ -175,7 +175,7 @@ movl %eax, (%esi, %edi) -#ifdef MP +#ifdef CONFIG_SMP .m1: /* @@ -203,7 +203,7 @@ .m3: -#endif /* MP */ +#endif /* CONFIG_SMP */ /* * Set up the PDBR @@ -211,7 +211,7 @@ movl $(V2P(startup_pagedirectory)), %eax movl %eax, %cr3 -#ifdef MP +#ifdef CONFIG_SMP .m4: #endif @@ -249,7 +249,7 @@ movl $0, %eax movl %eax, %fs -#ifdef MP +#ifdef CONFIG_SMP cmpl $AP_MAGIC, %edx jne .m2 @@ -292,7 +292,7 @@ .m2: -#endif /* MP */ +#endif /* CONFIG_SMP */ /* * Load the PCR selector @@ -355,10 +355,10 @@ .fill 4096, 1, 0 _pae_pagedirtable: .fill 4096, 1, 0 -#ifdef MP +#ifdef CONFIG_SMP apic_pagetable: .fill 4096, 1, 0 -#endif /* MP */ +#endif /* CONFIG_SMP */ kpcr_pagetable: .fill 4096, 1, 0 _____ Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S --- trunk/reactos/ntoskrnl/ke/i386/tskswitch.S 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/i386/tskswitch.S 2005-01-05 19:25:49 UTC (rev 12832) @@ -60,7 +60,7 @@ */ cli -#ifdef MP +#ifdef CONFIG_SMP /* * Get the pointer to the old thread. */ @@ -81,7 +81,7 @@ 2: movb $NPX_STATE_VALID, KTHREAD_NPX_STATE(%ebx) 3: -#endif /* MP */ +#endif /* CONFIG_SMP */ /* @@ -182,10 +182,10 @@ * Set TS in cr0 to catch FPU code and load the FPU state when needed * For uni-processor we do this only if NewThread != KPCR->NpxThread */ -#ifndef MP +#ifndef CONFIG_SMP cmpl %ebx, %fs:KPCR_NPX_THREAD je 4f -#endif /* !MP */ +#endif /* !CONFIG_SMP */ movl %cr0, %eax orl $X86_CR0_TS, %eax movl %eax, %cr0 _____ Modified: trunk/reactos/ntoskrnl/ke/kthread.c --- trunk/reactos/ntoskrnl/ke/kthread.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -309,7 +309,7 @@ STDCALL KeRevertToUserAffinityThread(VOID) { -#ifdef MP +#ifdef CONFIG_SMP PKTHREAD CurrentThread; KIRQL oldIrql; @@ -366,7 +366,7 @@ STDCALL KeSetSystemAffinityThread(IN KAFFINITY Affinity) { -#ifdef MP +#ifdef CONFIG_SMP PKTHREAD CurrentThread; KIRQL oldIrql; _____ Modified: trunk/reactos/ntoskrnl/ke/spinlock.c --- trunk/reactos/ntoskrnl/ke/spinlock.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/ke/spinlock.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -187,12 +187,23 @@ while ((i = InterlockedExchangeUL(SpinLock, 1)) == 1) { -#ifndef MP +#ifdef CONFIG_SMP + /* Avoid reading the value again too fast */ +#if 1 + __asm__ __volatile__ ("1:\n\t" + "cmpl $0,(%0)\n\t" + "jne 1b\n\t" + : + : "r" (SpinLock)); +#else + while (0 != *(volatile PKSPIN_LOCK)SpinLock) + { + } +#endif +#else DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i); KEBUGCHECK(0); -#else /* not MP */ - /* Avoid reading the value again too fast */ -#endif /* MP */ +#endif /* CONFIG_SMP */ } } _____ Modified: trunk/reactos/ntoskrnl/mm/mminit.c --- trunk/reactos/ntoskrnl/mm/mminit.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/ntoskrnl/mm/mminit.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -289,7 +289,7 @@ { ULONG i; ULONG kernel_len; -#ifndef MP +#ifndef CONFIG_SMP extern unsigned int unmap_me, unmap_me2, unmap_me3; #endif @@ -394,7 +394,7 @@ /* * Unmap low memory */ -#ifndef MP +#ifndef CONFIG_SMP /* In SMP mode we unmap the low memory in MmInit3. The APIC needs the mapping of the first pages while the processors are starting up. */ @@ -417,7 +417,7 @@ } DPRINT("Almost done MmInit()\n"); -#ifndef MP +#ifndef CONFIG_SMP /* FIXME: This is broken in SMP mode */ MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, TRUE, NULL, NULL); MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, TRUE, NULL, NULL); @@ -446,7 +446,7 @@ /* * Unmap low memory */ -#ifdef MP +#ifdef CONFIG_SMP /* In SMP mode we can unmap the low memory if all processors are started. */ MmDeletePageTable(NULL, 0); _____ Modified: trunk/reactos/tools/config.mk --- trunk/reactos/tools/config.mk 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/tools/config.mk 2005-01-05 19:25:49 UTC (rev 12832) @@ -15,10 +15,8 @@ CONFIG += KDBG endif -ifeq ($(MP), 1) -CONFIG += MP -else -CONFIG += UP +ifeq ($(CONFIG_SMP), 1) +CONFIG += CONFIG_SMP endif ifeq ($(ACPI), 1) _____ Modified: trunk/reactos/tools/mkconfig.c --- trunk/reactos/tools/mkconfig.c 2005-01-05 19:09:38 UTC (rev 12831) +++ trunk/reactos/tools/mkconfig.c 2005-01-05 19:25:49 UTC (rev 12832) @@ -106,12 +106,6 @@ { include_tests = 1; } - if (strcmp(argv[i], "MP") == 0 || strcmp(argv[i], "UP") == 0) - { - s = s + sprintf(s, "#if ! defined(MP) && ! defined(UP)\n"); - s = s + sprintf(s, "#define %s\n", argv[i]); - s = s + sprintf(s, "#endif /* ! defined(MP) && ! defined(UP) */\n"); - } else { s = s + sprintf(s, "#define %s\n", argv[i]);
19 years, 11 months
1
0
0
0
[hyperion] 12831: - makefile: use the native headers, don't bother with our hopelessly broken ones
by hyperion@svn.reactos.com
- makefile: use the native headers, don't bother with our hopelessly broken ones - tickcount.c: also accept arbitrary tick counts as arguments or from standard input (initially conceived to convert the result of subtracting two Date objects in Javascript - which conveniently happens to be a count of milliseconds - into a human-readable format. Useful to write a batch file that calculates the exact difference between two dates). Also use typedef aliases for __int64 that won't conflict with standard C typedefs (I had a craving for C code, too much Java for school was melting my brain. Thanks god for good ol' tickcount) Modified: trunk/reactos/apps/utils/tickcount/makefile Modified: trunk/reactos/apps/utils/tickcount/tickcount.c _____ Modified: trunk/reactos/apps/utils/tickcount/makefile --- trunk/reactos/apps/utils/tickcount/makefile 2005-01-05 19:06:05 UTC (rev 12830) +++ trunk/reactos/apps/utils/tickcount/makefile 2005-01-05 19:09:38 UTC (rev 12831) @@ -12,7 +12,7 @@ TARGET_OBJECTS = tickcount.o -TARGET_CFLAGS = -Wall -Werror +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API include $(PATH_TO_TOP)/rules.mak _____ Modified: trunk/reactos/apps/utils/tickcount/tickcount.c --- trunk/reactos/apps/utils/tickcount/tickcount.c 2005-01-05 19:06:05 UTC (rev 12830) +++ trunk/reactos/apps/utils/tickcount/tickcount.c 2005-01-05 19:09:38 UTC (rev 12831) @@ -1,30 +1,32 @@ -/* $Id: tickcount.c,v 1.2 2003/07/06 23:04:18 hyperion Exp $ +/* $Id$ */ /* - tickcount -- Display the kernel tick count in human-readable format + tickcount -- Display the kernel tick count (or any tick count passed as an + argument or as input) in human-readable format This is public domain software */ #include <assert.h> #include <stdio.h> +#include <stdlib.h> #include <tchar.h> #include <windows.h> -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; +typedef __int64 int64_; +typedef unsigned __int64 uint64_; -#define TICKS_YEAR (TICKS_DAY * ((uint64_t)365)) -#define TICKS_MONTH (TICKS_DAY * ((uint64_t)30)) -#define TICKS_WEEK (TICKS_DAY * ((uint64_t)7)) -#define TICKS_DAY (TICKS_HOUR * ((uint64_t)24)) -#define TICKS_HOUR (TICKS_MINUTE * ((uint64_t)60)) -#define TICKS_MINUTE (TICKS_SECOND * ((uint64_t)60)) -#define TICKS_SECOND ((uint64_t)1000) +#define TICKS_YEAR (TICKS_DAY * ((uint64_)365)) +#define TICKS_MONTH (TICKS_DAY * ((uint64_)30)) +#define TICKS_WEEK (TICKS_DAY * ((uint64_)7)) +#define TICKS_DAY (TICKS_HOUR * ((uint64_)24)) +#define TICKS_HOUR (TICKS_MINUTE * ((uint64_)60)) +#define TICKS_MINUTE (TICKS_SECOND * ((uint64_)60)) +#define TICKS_SECOND ((uint64_)1000) #define SLICES_COUNT (sizeof(ticks_per_slice) / sizeof(ticks_per_slice[0])) -uint64_t ticks_per_slice[] = +uint64_ ticks_per_slice[] = { TICKS_YEAR, TICKS_MONTH, @@ -36,7 +38,7 @@ 1 }; -_TCHAR * slice_names_singular[] = +_TCHAR * slice_names_singular[SLICES_COUNT] = { _T("year"), _T("month"), @@ -48,7 +50,7 @@ _T("millisecond") }; -_TCHAR * slice_names_plural[] = +_TCHAR * slice_names_plural[SLICES_COUNT] = { _T("years"), _T("months"), @@ -62,16 +64,16 @@ void print_uptime ( - uint64_t tickcount, - uint64_t prevsliceval, + uint64_ tickcount, + uint64_ prevsliceval, _TCHAR * prevsliceunit, int curslice ) { - uint64_t tick_cur = tickcount / ticks_per_slice[curslice]; - uint64_t tick_residual = tickcount % ticks_per_slice[curslice]; + uint64_ tick_cur = tickcount / ticks_per_slice[curslice]; + uint64_ tick_residual = tickcount % ticks_per_slice[curslice]; - assert(tick_cur <= (~((uint64_t)0))); + assert(tick_cur <= (~((uint64_)0))); if(tick_residual == 0) { @@ -134,9 +136,56 @@ } } -int _tmain() +int parse_print(const _TCHAR * str) { - print_uptime((uint64_t)GetTickCount(), 0, NULL, 0); + int64_ tickcount; + + tickcount = _ttoi64(str); + + if(tickcount < 0) + tickcount = - tickcount; + else if(tickcount == 0) + return 1; + + print_uptime(tickcount, 0, NULL, 0); _puttc(_T('\n'), stdout); + return 0; } + +int _tmain(int argc, _TCHAR * argv[]) +{ + int r; + + if(argc <= 1) + { + print_uptime((uint64_)GetTickCount(), 0, NULL, 0); + _puttc(_T('\n'), stdout); + } + else if(argc == 2 && argv[1][0] == _T('-') && argv[1][1] == 0) + { + while(!feof(stdin)) + { + _TCHAR buf[23]; + _TCHAR * str; + + str = _fgetts(buf, 22, stdin); + + if(str == NULL) + return 0; + + if((r = parse_print(str)) != 0) + return r; + } + } + else + { + int i; + + for(i = 1; i < argc; ++ i) + if((r = parse_print(argv[i])) != 0) + return r; + } + + return 0; +}
19 years, 11 months
1
0
0
0
[hbirr] 12830: - Initialize the symbols for boot load driver before the driver entry routine is called.
by hbirr@svn.reactos.com
- Initialize the symbols for boot load driver before the driver entry routine is called. - Store the symbols for boot load driver within the non paged pool. Modified: trunk/reactos/ntoskrnl/dbg/kdb_symbols.c Modified: trunk/reactos/ntoskrnl/include/internal/kd.h Modified: trunk/reactos/ntoskrnl/io/driver.c _____ Modified: trunk/reactos/ntoskrnl/dbg/kdb_symbols.c --- trunk/reactos/ntoskrnl/dbg/kdb_symbols.c 2005-01-05 19:04:25 UTC (rev 12829) +++ trunk/reactos/ntoskrnl/dbg/kdb_symbols.c 2005-01-05 19:06:05 UTC (rev 12830) @@ -548,6 +548,7 @@ DPRINT("Current->FileName %wZ FileName %wZ\n", &Current->FileName, FileName); if (RtlEqualUnicodeString(&Current->FileName, FileName, TRUE)) { + Current->RefCount++; KeReleaseSpinLock(&SymbolFileListLock, Irql); DPRINT("Found cached file!\n"); return Current; @@ -690,7 +691,6 @@ if (CachedSymbolFile != NULL) { DPRINT("Found cached symbol file %wZ\n", &SymFileName); - CachedSymbolFile->RefCount++; SymbolInfo->FileBuffer = CachedSymbolFile->FileBuffer; SymbolInfo->SymbolsBase = CachedSymbolFile->SymbolsBase; SymbolInfo->SymbolsLength = CachedSymbolFile->SymbolsLength; @@ -897,76 +897,84 @@ * module. * Used to load ntoskrnl and hal symbols before the SystemRoot is available to us. * - * \param ModuleLoadBase Base address of the loaded symbol file. - * \param FileName Filename of the symbol file. - * \param Length Length of the loaded symbol file/module. + * \param FileName Filename for which the symbols are loaded. */ VOID -KdbSymProcessSymbolFile(IN PVOID ModuleLoadBase, - IN PCHAR FileName, - IN ULONG Length) +KdbSymProcessBootSymbols(IN PCHAR FileName) { PMODULE_OBJECT ModuleObject; - UNICODE_STRING ModuleName; - CHAR TmpBaseName[MAX_PATH]; - CHAR TmpFileName[MAX_PATH]; + UNICODE_STRING UnicodeString; + PLOADER_MODULE KeLoaderModules = (PLOADER_MODULE)KeLoaderBlock.ModsAddr; + CHAR SymbolName[MAX_PATH]; PSYMBOLFILE_HEADER SymbolFileHeader; PIMAGE_SYMBOL_INFO SymbolInfo; ANSI_STRING AnsiString; PCHAR Extension; ULONG i; - const char *KnownExtension[] = {".exe", ".sys", ".dll"}; - DPRINT("Module %s is a symbol file\n", FileName); + DPRINT("KdbSymProcessBootSymbols(%s)\n", FileName); - strncpy(TmpBaseName, FileName, MAX_PATH-1); - TmpBaseName[MAX_PATH-1] = '\0'; - /* remove the extension '.sym' */ - Extension = strrchr(TmpBaseName, '.'); - if (Extension && 0 == _stricmp(Extension, ".sym")) - { - *Extension = 0; - } + RtlInitAnsiString(&AnsiString, FileName); + RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, TRUE); + ModuleObject = LdrGetModuleObject(&UnicodeString); + RtlFreeUnicodeString(&UnicodeString); - DPRINT("base: %s (Length %d)\n", TmpBaseName, Length); - - for (i = 0; i < sizeof(KnownExtension) / sizeof(*KnownExtension); i++) - { - strcpy(TmpFileName, TmpBaseName); - strcat(TmpFileName, KnownExtension[i]); - RtlInitAnsiString(&AnsiString, TmpFileName); - - RtlAnsiStringToUnicodeString(&ModuleName, &AnsiString, TRUE); - ModuleObject = LdrGetModuleObject(&ModuleName); - RtlFreeUnicodeString(&ModuleName); - if (ModuleObject) - { - break; + if (ModuleObject != NULL) + { + strcpy(SymbolName, FileName); + Extension = strrchr(SymbolName, '.'); + if (Extension == NULL) + { + Extension = SymbolName + strlen(SymbolName); + } + strcpy(Extension, ".sym"); + for (i = 0; i < KeLoaderBlock.ModsCount; i++) + { + if (KeLoaderModules[i].Reserved == 0 && !_stricmp(SymbolName, (PCHAR)KeLoaderModules[i].String)) + { + break; } - } - - if (ModuleObject != NULL) - { - SymbolInfo = (PIMAGE_SYMBOL_INFO) &ModuleObject->TextSection->SymbolInfo; - if (SymbolInfo->FileBuffer != NULL) + } + if (i < KeLoaderBlock.ModsCount) + { + KeLoaderModules[i].Reserved = 1; + SymbolInfo = (PIMAGE_SYMBOL_INFO) &ModuleObject->TextSection->SymbolInfo; + if (SymbolInfo->FileBuffer != NULL) { - KdbpSymRemoveCachedFile(SymbolInfo); + KdbpSymRemoveCachedFile(SymbolInfo); } - SymbolFileHeader = (PSYMBOLFILE_HEADER) ModuleLoadBase; - SymbolInfo->FileBuffer = ModuleLoadBase; - SymbolInfo->SymbolsBase = ModuleLoadBase + SymbolFileHeader->StabsOffset; - SymbolInfo->SymbolsLength = SymbolFileHeader->StabsLength; - SymbolInfo->SymbolStringsBase = ModuleLoadBase + SymbolFileHeader->StabstrOffset; - SymbolInfo->SymbolStringsLength = SymbolFileHeader->StabstrLength; - DPRINT("Installed stabs: %s@%08x-%08x (%08x-%08x,%08x)\n", + SymbolFileHeader = ExAllocatePool(NonPagedPool, KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart); + if (SymbolFileHeader == NULL) + { + DPRINT("Could not allocate memory for symbol file\n"); + return; + } + memcpy(SymbolFileHeader, + (PVOID)KeLoaderModules[i].ModStart, + KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart); + + SymbolInfo->FileBuffer = SymbolFileHeader; + SymbolInfo->SymbolsBase = (PVOID)SymbolFileHeader + SymbolFileHeader->StabsOffset; + SymbolInfo->SymbolsLength = SymbolFileHeader->StabsLength; + SymbolInfo->SymbolStringsBase = (PVOID)SymbolFileHeader + SymbolFileHeader->StabstrOffset; + SymbolInfo->SymbolStringsLength = SymbolFileHeader->StabstrLength; + + /* add file to cache */ + RtlInitAnsiString(&AnsiString, SymbolName); + RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, TRUE); + KdbpSymAddCachedFile(&UnicodeString, SymbolInfo); + RtlFreeUnicodeString(&UnicodeString); + + DPRINT("Installed stabs: %s@%08x-%08x (%08x-%08x,%08x)\n", FileName, ModuleObject->Base, ModuleObject->Length + ModuleObject->Base, SymbolInfo->SymbolsBase, SymbolInfo->SymbolsLength + SymbolInfo->SymbolsBase, SymbolInfo->SymbolStringsBase); - } + } + } } /*! \brief Initializes the KDB symbols implementation. _____ Modified: trunk/reactos/ntoskrnl/include/internal/kd.h --- trunk/reactos/ntoskrnl/include/internal/kd.h 2005-01-05 19:04:25 UTC (rev 12829) +++ trunk/reactos/ntoskrnl/include/internal/kd.h 2005-01-05 19:06:05 UTC (rev 12830) @@ -1,4 +1,4 @@ -/* $Id: kd.h,v 1.29 2004/12/09 14:20:06 royce Exp $ +/* $Id$ * * kernel debugger prototypes */ @@ -109,21 +109,20 @@ VOID KdPrintMda(PCH pch); #if !defined(KDBG) && !defined(DBG) -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) -# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) -# define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) -# define KDB_SYMBOLFILE_HOOK(LOADBASE, FILENAME, LENGTH) do { } while (0) -# define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) +# define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) +# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) +# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) +# define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0) +# define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) +# define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0) +# define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) #else -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) -# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbSymFreeProcessSymbols(PROCESS) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) -# define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) -# define KDB_SYMBOLFILE_HOOK(LOADBASE, FILENAME, LENGTH) \ - KdbSymProcessSymbolFile(LOADBASE, FILENAME, LENGTH) +# define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) +# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbSymFreeProcessSymbols(PROCESS) +# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) +# define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) +# define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) +# define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME) /*#define KDB_CREATE_THREAD_HOOK(CONTEXT) \ KdbCreateThreadHook(CONTEXT) */ @@ -141,9 +140,7 @@ KdbSymUnloadDriverSymbols(IN PMODULE_OBJECT ModuleObject); VOID -KdbSymProcessSymbolFile(IN PVOID ModuleLoadBase, - IN PCHAR FileName, - IN ULONG Length); +KdbSymProcessBootSymbols(IN PCHAR FileName); VOID KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection, _____ Modified: trunk/reactos/ntoskrnl/io/driver.c --- trunk/reactos/ntoskrnl/io/driver.c 2005-01-05 19:04:25 UTC (rev 12829) +++ trunk/reactos/ntoskrnl/io/driver.c 2005-01-05 19:06:05 UTC (rev 12830) @@ -448,6 +448,8 @@ &ServiceImagePath, ModuleObject); + KDB_SYMBOLFILE_HOOK(SearchName); + break; } } @@ -1135,6 +1137,9 @@ return Status; } + /* Load symbols */ + KDB_SYMBOLFILE_HOOK(FileName); + /* * Strip the file extension from ServiceName */ @@ -1205,13 +1210,11 @@ if (Extension == NULL) Extension = ""; - if (!_stricmp(Extension, ".sym")) + if (!_stricmp(Extension, ".exe") || !_stricmp(Extension, ".dll")) { - /* Pass symbol files to kernel debugger */ - KDB_SYMBOLFILE_HOOK((PVOID)ModuleStart, ModuleName, ModuleSize); - } - else if (!_stricmp(Extension, ".exe") || !_stricmp(Extension, ".dll")) - { + /* Process symbols for *.exe and *.dll */ + KDB_SYMBOLFILE_HOOK(ModuleName); + /* Log *.exe and *.dll files */ RtlCreateUnicodeStringFromAsciiz(&DriverName, ModuleName); IopBootLog(&DriverName, TRUE); @@ -1232,20 +1235,16 @@ } BootDriverCount++; } + } - /* - * Free memory for all boot files, except ntoskrnl.exe - * and symbol files, if the kernel debugger is active - */ - if (i != 0 /* ntoskrnl.exe is always the first module */ -#if defined(DBG) || defined(KDBG) - && _stricmp(Extension, ".sym") -#endif - ) - { - MiFreeBootDriverMemory((PVOID)KeLoaderModules[i].ModStart, - KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart); - } + /* + * Free memory for all boot files, except ntoskrnl.exe. + */ + for (i = 1; i < KeLoaderBlock.ModsCount; i++) + { + + MiFreeBootDriverMemory((PVOID)KeLoaderModules[i].ModStart, + KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart); } if (BootDriverCount == 0)
19 years, 11 months
1
0
0
0
[hbirr] 12829: - Prevent from calling PsTerminateCurrentThread from within an apc if PsTerminateThread was already called.
by hbirr@svn.reactos.com
- Prevent from calling PsTerminateCurrentThread from within an apc if PsTerminateThread was already called. Modified: trunk/reactos/ntoskrnl/ps/kill.c _____ Modified: trunk/reactos/ntoskrnl/ps/kill.c --- trunk/reactos/ntoskrnl/ps/kill.c 2005-01-05 19:03:21 UTC (rev 12828) +++ trunk/reactos/ntoskrnl/ps/kill.c 2005-01-05 19:04:25 UTC (rev 12829) @@ -239,6 +239,12 @@ PVOID SystemArgument1, PVOID SystemArgument2) { + PETHREAD EThread = PsGetCurrentThread(); + if (EThread->HasTerminated) + { + /* Someone else has already called PsTerminateCurrentThread */ + return; + } PsTerminateCurrentThread(PsGetCurrentThread()->ExitStatus); }
19 years, 11 months
1
0
0
0
[hbirr] 12828: - Removed an unused variable.
by hbirr@svn.reactos.com
- Removed an unused variable. Modified: trunk/reactos/ntoskrnl/ps/process.c _____ Modified: trunk/reactos/ntoskrnl/ps/process.c --- trunk/reactos/ntoskrnl/ps/process.c 2005-01-05 19:02:23 UTC (rev 12827) +++ trunk/reactos/ntoskrnl/ps/process.c 2005-01-05 19:03:21 UTC (rev 12828) @@ -18,7 +18,6 @@ /* GLOBALS ******************************************************************/ PEPROCESS EXPORTED PsInitialSystemProcess = NULL; -PEPROCESS PsIdleProcess = NULL; POBJECT_TYPE EXPORTED PsProcessType = NULL;
19 years, 11 months
1
0
0
0
[hbirr] 12827: - Set the number of processors before initialize the critical sections.
by hbirr@svn.reactos.com
- Set the number of processors before initialize the critical sections. Modified: trunk/reactos/lib/ntdll/ldr/startup.c _____ Modified: trunk/reactos/lib/ntdll/ldr/startup.c --- trunk/reactos/lib/ntdll/ldr/startup.c 2005-01-05 19:02:00 UTC (rev 12826) +++ trunk/reactos/lib/ntdll/ldr/startup.c 2005-01-05 19:02:23 UTC (rev 12827) @@ -279,10 +279,6 @@ NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + PEDosHeader->e_lfanew); - /* Initialize Critical Section Data */ - RtlpInitDeferedCriticalSection(); - - /* Get number of processors */ Status = ZwQuerySystemInformation(SystemBasicInformation, &SystemInformation, @@ -294,6 +290,10 @@ } Peb->NumberOfProcessors = SystemInformation.NumberProcessors; + + /* Initialize Critical Section Data */ + RtlpInitDeferedCriticalSection(); + /* create process heap */ RtlInitializeHeapManager(); Peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE,
19 years, 11 months
1
0
0
0
[royce] 12826: beginnings of makefile output
by royce@svn.reactos.com
beginnings of makefile output Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 19:01:27 UTC (rev 12825) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 19:02:00 UTC (rev 12826) @@ -6,6 +6,36 @@ using std::string; using std::vector; +#ifdef WIN32 +#define EXEPOSTFIX ".exe" +#define SEP "\\" +string FixSep ( const string& s ) +{ + string s2(s); + char* p = strchr ( &s2[0], '/' ); + while ( p ) + { + *p++ = '\\'; + p = strchr ( p, '/' ); + } + return s2; +} +#else +#define EXEPOSTFIX +#define SEP "/" +string FixSep ( const string& s ) +{ + string s2(s); + char* p = strchr ( &s2[0], '\\' ); + while ( p ) + { + *p++ = '/'; + p = strchr ( p, '\\' ); + } + return s2; +} +#endif + Project::Project() { } @@ -21,28 +51,24 @@ { for ( size_t i = 0; i < modules.size(); i++ ) delete modules[i]; + delete head; } void Project::ReadXml() { Path path; - bool projectFound = false; - do + + head = XMLParse ( xmlfile, path ); + if ( !head ) + throw InvalidBuildFileException ( "Document contains no 'project' tag." ); + + if ( head->name != "project" ) { - XMLElement* head = XMLParse ( xmlfile, path ); - if ( !head ) - throw InvalidBuildFileException ( "Document contains no 'project' tag." ); + throw InvalidBuildFileException ( "Expected 'project', got '%s'.", + head->name.c_str()); + } - if ( head->name != "project" ) - { - throw InvalidBuildFileException ( "Expected 'project', got '%s'.", - head->name.c_str()); - } - - this->ProcessXML ( *head, "." ); - delete head; - projectFound = true; - } while (!projectFound); + this->ProcessXML ( *head, "." ); } void @@ -79,3 +105,32 @@ for ( size_t i = 0; i < e.subElements.size(); i++ ) ProcessXML ( *e.subElements[i], subpath ); } + +bool +Project::GenerateOutput() +{ + const XMLAttribute* att; + size_t i; + + att = head->GetAttribute ( "makefile", true ); + if ( !att ) + return false; + FILE* f = fopen ( att->value.c_str(), "w" ); + if ( !f ) + { + throw Exception ( "Unable to open '%s' for output", att->value.c_str() ); + return false; + } + fprintf ( f, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); + + // generate module list: + fprintf ( f, "all: " ); + for ( i = 0; i < modules.size(); i++ ) + { + Module& m = *modules[i]; + fprintf ( f, " %s" SEP "%s" EXEPOSTFIX, FixSep(m.path).c_str(), m.name.c_str() ); + } + fprintf ( f, "\n\n" ); + + return true; +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 19:01:27 UTC (rev 12825) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 19:02:00 UTC (rev 12826) @@ -1,6 +1,7 @@ // rbuild.cpp #include "pch.h" +#include <typeinfo> #include <stdio.h> #include <io.h> @@ -17,14 +18,15 @@ try { string projectFilename ( "ReactOS.xml" ); - Project* project = new Project( projectFilename ); + Project project ( projectFilename ); + project.GenerateOutput(); - Path path; // REM TODO FIXME actually do something with Project object... - printf ( "Found %d modules:\n", project->modules.size() ); - for ( size_t i = 0; i < project->modules.size(); i++ ) +#if 0 + printf ( "Found %d modules:\n", project.modules.size() ); + for ( size_t i = 0; i < project.modules.size(); i++ ) { - Module& m = *project->modules[i]; + Module& m = *project.modules[i]; printf ( "\t%s in folder: %s\n", m.name.c_str(), m.path.c_str() ); @@ -49,15 +51,14 @@ printf ( "\t\t%s\n", m.files[j]->name.c_str() ); } } - - delete project; +#endif return 0; } catch (Exception& ex) { - printf ( "%s\n", - ex.Message.c_str() ); + printf ( "%s: %s\n", + typeid(ex).name(), ex.Message.c_str() ); return 1; } } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 19:01:27 UTC (rev 12825) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 19:02:00 UTC (rev 12826) @@ -21,9 +21,11 @@ Project ( const std::string& filename ); ~Project (); void ProcessXML ( const XMLElement& e, const std::string& path ); + bool GenerateOutput(); private: void ReadXml (); XMLFile xmlfile; + XMLElement* head; }; class Module
19 years, 11 months
1
0
0
0
[hbirr] 12825: - Silence a debug message.
by hbirr@svn.reactos.com
- Silence a debug message. Modified: trunk/reactos/hal/halx86/mp/apic.c _____ Modified: trunk/reactos/hal/halx86/mp/apic.c --- trunk/reactos/hal/halx86/mp/apic.c 2005-01-05 18:48:45 UTC (rev 12824) +++ trunk/reactos/hal/halx86/mp/apic.c 2005-01-05 19:01:27 UTC (rev 12825) @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: apic.c,v 1.2 2004/12/25 11:21:48 navaraf Exp $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -755,7 +755,7 @@ { ULONG tmp; - DPRINT1("Spurious interrupt on CPU(%d)\n", ThisCPU()); + DPRINT("Spurious interrupt on CPU(%d)\n", ThisCPU()); tmp = APICRead(APIC_ISR + ((SPURIOUS_VECTOR & ~0x1f) >> 1)); if (tmp & (1 << (SPURIOUS_VECTOR & 0x1f)))
19 years, 11 months
1
0
0
0
← Newer
1
...
52
53
54
55
56
57
58
...
71
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
Results per page:
10
25
50
100
200