Skip to content

Commit

Permalink
added original source code version 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Hillenbrand committed Jan 8, 2016
1 parent 71dd043 commit 2973b24
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 205 deletions.
Binary file modified KSysGuard HOWTO.docx
Binary file not shown.
Binary file modified KSysGuard HOWTO.pdf
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2009-2014 Intel Corporation
# Copyright (c) 2009-2015 Intel Corporation
# written by Roman Dementiev and Jim Harris
#

Expand All @@ -11,7 +11,7 @@ klocwork: $(EXE)

CXXFLAGS += -Wall -g -O3 -Wno-unknown-pragmas -Werror

# uncomment if you want to rely on Linux perf support (user needs CAP_SYS_ADMIN privileges)
# rely on Linux perf support (user needs CAP_SYS_ADMIN privileges), comment out to disable
ifneq ($(wildcard /usr/include/linux/perf_event.h),)
CXXFLAGS += -DPCM_USE_PERF
endif
Expand Down
10 changes: 5 additions & 5 deletions PCM_Win/pcm.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -26,24 +26,24 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down
22 changes: 8 additions & 14 deletions WinMSRDriver/Win7/msrmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ NTSTATUS deviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
input_msr_req = (struct MSR_Request *)Irp->AssociatedIrp.SystemBuffer;
input_pcicfg_req = (struct PCICFG_Request *)Irp->AssociatedIrp.SystemBuffer;
output = (ULONG64 *)Irp->AssociatedIrp.SystemBuffer;
PROCESSOR_NUMBER ProcNumber;
memset(&ProcNumber, 0, sizeof(PROCESSOR_NUMBER));

switch (IrpStackLocation->Parameters.DeviceIoControl.IoControlCode)
{
Expand All @@ -168,13 +170,9 @@ NTSTATUS deviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
}
memset(&new_affinity, 0, sizeof(GROUP_AFFINITY));
memset(&old_affinity, 0, sizeof(GROUP_AFFINITY));
new_affinity.Group = 0;
while ((ULONG)input_msr_req->core_id >= (currentGroupSize = KeQueryMaximumProcessorCountEx(new_affinity.Group)))
{
input_msr_req->core_id -= currentGroupSize;
++new_affinity.Group;
}
new_affinity.Mask = 1ULL << (input_msr_req->core_id);
KeGetProcessorNumberFromIndex(input_msr_req->core_id, &ProcNumber);
new_affinity.Group = ProcNumber.Group;
new_affinity.Mask = 1ULL << (ProcNumber.Number);
KeSetSystemGroupAffinityThread(&new_affinity, &old_affinity);
__writemsr(input_msr_req->msr_address, input_msr_req->write_value);
KeRevertToUserGroupAffinityThread(&old_affinity);
Expand All @@ -188,13 +186,9 @@ NTSTATUS deviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
}
memset(&new_affinity, 0, sizeof(GROUP_AFFINITY));
memset(&old_affinity, 0, sizeof(GROUP_AFFINITY));
new_affinity.Group = 0;
while ((ULONG)input_msr_req->core_id >= (currentGroupSize = KeQueryMaximumProcessorCountEx(new_affinity.Group)))
{
input_msr_req->core_id -= currentGroupSize;
++new_affinity.Group;
}
new_affinity.Mask = 1ULL << (input_msr_req->core_id);
KeGetProcessorNumberFromIndex(input_msr_req->core_id, &ProcNumber);
new_affinity.Group = ProcNumber.Group;
new_affinity.Mask = 1ULL << (ProcNumber.Number);
KeSetSystemGroupAffinityThread(&new_affinity, &old_affinity);
*output = __readmsr(input_msr_req->msr_address);
KeRevertToUserGroupAffinityThread(&old_affinity);
Expand Down
Loading

0 comments on commit 2973b24

Please sign in to comment.