[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Don't use a stack based DPC structure in the System per-CPU code
Whilst this is believed to be safe, there is no documentation to say that Windows does not make use of the DPC structure after the DPC routine has completed. Instead, make the DPC structure part of the per-CPU structure. Also fix an ASSERT on the per-CPU array pointer not being NULLed. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xen/system.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/xen/system.c b/src/xen/system.c index a602d8b..f7be963 100644 --- a/src/xen/system.c +++ b/src/xen/system.c @@ -49,6 +49,7 @@ #define XEN_SYSTEM_TAG 'TSYS' typedef struct _SYSTEM_PROCESSOR { + KDPC Dpc; CHAR Manufacturer[13]; UCHAR ApicID; UCHAR ProcessorID; @@ -343,7 +344,7 @@ SystemProcessorInformation( ) { PSYSTEM_CONTEXT Context = &SystemContext; - PKEVENT Event = _Context; + PKEVENT Event = Argument1; ULONG Index; PROCESSOR_NUMBER ProcNumber; PSYSTEM_PROCESSOR Processor; @@ -352,7 +353,7 @@ SystemProcessorInformation( ULONG EDX; UNREFERENCED_PARAMETER(Dpc); - UNREFERENCED_PARAMETER(Argument1); + UNREFERENCED_PARAMETER(_Context); UNREFERENCED_PARAMETER(Argument2); Index = KeGetCurrentProcessorNumberEx(&ProcNumber); @@ -438,18 +439,20 @@ SystemProcessorChangeCallback( break; } case KeProcessorAddCompleteNotify: { + PSYSTEM_PROCESSOR Processor; KEVENT Event; - KDPC Dpc; ASSERT3U(Index, <, Context->ProcessorCount); + Processor = &Context->Processor[Index]; + KeInitializeEvent(&Event, NotificationEvent, FALSE); - KeInitializeDpc(&Dpc, SystemProcessorInformation, &Event); - KeSetImportanceDpc(&Dpc, HighImportance); - KeSetTargetProcessorDpcEx(&Dpc, &ProcNumber); + KeInitializeDpc(&Processor->Dpc, SystemProcessorInformation, NULL); + KeSetImportanceDpc(&Processor->Dpc, HighImportance); + KeSetTargetProcessorDpcEx(&Processor->Dpc, &ProcNumber); - KeInsertQueueDpc(&Dpc, NULL, NULL); + KeInsertQueueDpc(&Processor->Dpc, &Event, NULL); (VOID) KeWaitForSingleObject(&Event, Executive, @@ -507,6 +510,7 @@ SystemDeregisterProcessorChangeCallback( Context->ProcessorChangeHandle = NULL; __SystemFree(Context->Processor); + Context->Processor = NULL; Context->ProcessorCount = 0; } -- 2.1.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |