From: codeFather on 17 Jun 2010 04:14 the following code stops the interrupts on the both the processors , but nothing happens, i am able use the mouse and keyboard as usual (was expecting a reboot or bsod :S) whats going on here? #include "ntddk.h" #include <windef.h> int i; HANDLE thrHwnd; KEVENT syncEvent; BOOL processors[16]; int totalProcessors,processorsMarked; void displayCpuName() { if (processors[KeGetCurrentProcessorNumber()]==TRUE) { DbgPrint("The Processor %d, ran the code before!!",KeGetCurrentProcessorNumber()); KeSetEvent(&syncEvent,0,FALSE); PsTerminateSystemThread(0); return; } else { DbgPrint("The Processor %d, is running the code for the first time",KeGetCurrentProcessorNumber()); __asm{ cli } processors[KeGetCurrentProcessorNumber()]=TRUE; processorsMarked++; KeSetEvent(&syncEvent,0,FALSE); PsTerminateSystemThread(0); return; } } NTSTATUS onUnload (IN PDRIVER_OBJECT driverObject) { DbgPrint("Driver Unloaded Successfully"); return STATUS_SUCCESS; } NTSTATUS DriverEntry (IN PDRIVER_OBJECT driverObject, IN PUNICODE_STRING registryPath) { DbgPrint("Driver Loaded Successfully"); driverObject->DriverUnload = onUnload; processorsMarked = 0; for(i = 0; i < 16;i++) processors[i] = FALSE; totalProcessors = KeNumberProcessors; KeInitializeEvent(&syncEvent,SynchronizationEvent,FALSE); while(TRUE) { PsCreateSystemThread(&thrHwnd,(ACCESS_MASK) 0L,NULL,NULL,NULL,(PKSTART_ROUTINE) displayCpuName,NULL); KeWaitForSingleObject(&syncEvent,Executive,KernelMode,FALSE,NULL); if(processorsMarked == totalProcessors) break; } return STATUS_SUCCESS; } thanks!
From: SdB on 17 Jun 2010 11:04 You may want to run a thread on a dedicated cpu core by setting the thread affinity. KeGetCurrentProcessorNumber() might return not the correct number as your thread is running at passive level. That would be something to consider. -Stefan "codeFather" wrote: > the following code stops the interrupts on the both the processors , but > nothing happens, i am able use the mouse and keyboard as usual (was expecting > a reboot or bsod :S) whats going on here? > > #include "ntddk.h" > #include <windef.h> > > int i; > HANDLE thrHwnd; > KEVENT syncEvent; > BOOL processors[16]; > int totalProcessors,processorsMarked; > > void displayCpuName() > { > if (processors[KeGetCurrentProcessorNumber()]==TRUE) > { > DbgPrint("The Processor %d, ran the code > before!!",KeGetCurrentProcessorNumber()); > KeSetEvent(&syncEvent,0,FALSE); > PsTerminateSystemThread(0); > return; > } > else > { > DbgPrint("The Processor %d, is running the code for the first > time",KeGetCurrentProcessorNumber()); > __asm{ > cli > } > processors[KeGetCurrentProcessorNumber()]=TRUE; > processorsMarked++; > KeSetEvent(&syncEvent,0,FALSE); > PsTerminateSystemThread(0); > return; > } > } > > NTSTATUS onUnload (IN PDRIVER_OBJECT driverObject) > { > DbgPrint("Driver Unloaded Successfully"); > return STATUS_SUCCESS; > } > > NTSTATUS DriverEntry (IN PDRIVER_OBJECT driverObject, IN PUNICODE_STRING > registryPath) > { > DbgPrint("Driver Loaded Successfully"); > driverObject->DriverUnload = onUnload; > > processorsMarked = 0; > for(i = 0; i < 16;i++) > processors[i] = FALSE; > totalProcessors = KeNumberProcessors; > > KeInitializeEvent(&syncEvent,SynchronizationEvent,FALSE); > while(TRUE) > { > PsCreateSystemThread(&thrHwnd,(ACCESS_MASK) > 0L,NULL,NULL,NULL,(PKSTART_ROUTINE) displayCpuName,NULL); > KeWaitForSingleObject(&syncEvent,Executive,KernelMode,FALSE,NULL); > if(processorsMarked == totalProcessors) break; > } > return STATUS_SUCCESS; > } > > thanks!
From: Pavel A. on 17 Jun 2010 21:38 "codeFather" <codeFather(a)discussions.microsoft.com> wrote in message news:EDADDFA3-B24D-4650-B4C1-C4A3252AF2C4(a)microsoft.com... > the following code stops the interrupts on the both the processors , but > nothing happens, i am able use the mouse and keyboard as usual (was > expecting > a reboot or bsod :S) whats going on here? Whenever you call some system function, it can enable interrupts again. Cli is not a blessed way to disable local interrupts in NT. --pa
|
Pages: 1 Prev: Time between sending and receiving of Ethernet Packets Next: looking for HDAU.exe |