mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
WIN10 driver update
This commit is contained in:
committed by
Erik Bjorge
parent
525a3fe7b3
commit
3b09a59ddd
@@ -0,0 +1,86 @@
|
||||
;
|
||||
; chipsec_hlpr.inf
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature="$WINDOWS NT$"
|
||||
Class=Sample ; TODO: edit Class
|
||||
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
|
||||
Provider=%ManufacturerName%
|
||||
CatalogFile=chipsec_hlpr.cat
|
||||
DriverVer= ; TODO: set DriverVer in stampinf property pages
|
||||
|
||||
[DestinationDirs]
|
||||
DefaultDestDir = 12
|
||||
chipsec_hlpr_Device_CoInstaller_CopyFiles = 11
|
||||
|
||||
; ================= Class section =====================
|
||||
|
||||
[ClassInstall32]
|
||||
Addreg=SampleClassReg
|
||||
|
||||
[SampleClassReg]
|
||||
HKR,,,0,%ClassName%
|
||||
HKR,,Icon,,-5
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DiskName%,,,""
|
||||
|
||||
[SourceDisksFiles]
|
||||
chipsec_hlpr.sys = 1,,
|
||||
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
|
||||
|
||||
;*****************************************
|
||||
; Install Section
|
||||
;*****************************************
|
||||
|
||||
[Manufacturer]
|
||||
%ManufacturerName%=Standard,NT$ARCH$
|
||||
|
||||
[Standard.NT$ARCH$]
|
||||
%chipsec_hlpr.DeviceDesc%=chipsec_hlpr_Device, Root\chipsec_hlpr ; TODO: edit hw-id
|
||||
|
||||
[chipsec_hlpr_Device.NT]
|
||||
CopyFiles=Drivers_Dir
|
||||
|
||||
[Drivers_Dir]
|
||||
chipsec_hlpr.sys
|
||||
|
||||
;-------------- Service installation
|
||||
[chipsec_hlpr_Device.NT.Services]
|
||||
AddService = chipsec_hlpr,%SPSVCINST_ASSOCSERVICE%, chipsec_hlpr_Service_Inst
|
||||
|
||||
; -------------- chipsec_hlpr driver install sections
|
||||
[chipsec_hlpr_Service_Inst]
|
||||
DisplayName = %chipsec_hlpr.SVCDESC%
|
||||
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
|
||||
StartType = 3 ; SERVICE_DEMAND_START
|
||||
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
|
||||
ServiceBinary = %12%\chipsec_hlpr.sys
|
||||
|
||||
;
|
||||
;--- chipsec_hlpr_Device Coinstaller installation ------
|
||||
;
|
||||
|
||||
[chipsec_hlpr_Device.NT.CoInstallers]
|
||||
AddReg=chipsec_hlpr_Device_CoInstaller_AddReg
|
||||
CopyFiles=chipsec_hlpr_Device_CoInstaller_CopyFiles
|
||||
|
||||
[chipsec_hlpr_Device_CoInstaller_AddReg]
|
||||
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
|
||||
|
||||
[chipsec_hlpr_Device_CoInstaller_CopyFiles]
|
||||
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
|
||||
|
||||
[chipsec_hlpr_Device.NT.Wdf]
|
||||
KmdfService = chipsec_hlpr, chipsec_hlpr_wdfsect
|
||||
[chipsec_hlpr_wdfsect]
|
||||
KmdfLibraryVersion = $KMDFVERSION$
|
||||
|
||||
[Strings]
|
||||
SPSVCINST_ASSOCSERVICE= 0x00000002
|
||||
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
|
||||
ClassName="Samples" ; TODO: edit ClassName
|
||||
DiskName = "chipsec_hlpr Installation Disk"
|
||||
chipsec_hlpr.DeviceDesc = "chipsec_hlpr Device"
|
||||
chipsec_hlpr.SVCDESC = "chipsec_hlpr Service"
|
||||
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FDC9216F-B321-4B46-9E3B-D9DF02D78C28}</ProjectGuid>
|
||||
<TemplateGuid>{1bc93793-694f-48fe-9372-81e2b05556fd}</TemplateGuid>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform Condition="'$(Platform)' == ''">Win32</Platform>
|
||||
<RootNamespace>chipsec_hlpr</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<TargetVersion>Windows10</TargetVersion>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
|
||||
<ConfigurationType>Driver</ConfigurationType>
|
||||
<DriverType>KMDF</DriverType>
|
||||
<DriverTargetPlatform>Universal</DriverTargetPlatform>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<IncludePath>$(ProjectDir)\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<IncludePath>$(ProjectDir)\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<IncludePath>$(ProjectDir)\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(DDK_LIB_PATH)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<IncludePath>$(ProjectDir)\include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(DDK_LIB_PATH)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>mkdir ..\..\chipsec\helper\win\win7_$(DDKPlatform)
|
||||
copy $(DbgengLocalCommand) ..\..\chipsec\helper\win\win7_$(DDKPlatform)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<MASM>
|
||||
<IncludePaths>$(SDK_INC_PATH)</IncludePaths>
|
||||
</MASM>
|
||||
<ClCompile>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>mkdir ..\..\chipsec\helper\win\win7_$(DDKPlatform)
|
||||
copy $(DbgengLocalCommand) ..\..\chipsec\helper\win\win7_$(DDKPlatform)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Inf Include="chipsec_hlpr.inf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FilesToPackage Include="$(TargetPath)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="driver.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="driver.h" />
|
||||
<ClInclude Include="include\chipsec.h" />
|
||||
<ClInclude Include="include\cpu.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="amd64\cpu.asm">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
<MASM Include="i386\cpu.asm">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+23
-20
@@ -147,7 +147,9 @@ DriverEntry(
|
||||
PDEVICE_OBJECT DeviceObject = NULL;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING DosDeviceName;
|
||||
UNICODE_STRING DosDeviceName;
|
||||
|
||||
UNREFERENCED_PARAMETER(RegistryPath);
|
||||
|
||||
//
|
||||
// Initialize a unicode string for the drivers object name.
|
||||
@@ -291,7 +293,7 @@ NTSTATUS _read_phys_mem( PHYSICAL_ADDRESS pa, unsigned int len, void * pData )
|
||||
DbgPrint( "[chipsec] ERROR: no space for mapping\n" );
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
DbgPrint( "[chipsec] reading %d bytes from physical address 0x%08x_%08x (virtual = %#010x)", len, pa.HighPart, pa.LowPart, (unsigned int)va );
|
||||
DbgPrint( "[chipsec] reading %d bytes from physical address 0x%08x_%08x (virtual = %#010x)", len, pa.HighPart, pa.LowPart, (UINTN)va );
|
||||
RtlCopyMemory( pData, va, len );
|
||||
MmUnmapIoSpace( va, len );
|
||||
return STATUS_SUCCESS;
|
||||
@@ -305,7 +307,7 @@ NTSTATUS _write_phys_mem( PHYSICAL_ADDRESS pa, unsigned int len, void * pData )
|
||||
DbgPrint( "[chipsec] ERROR: no space for mapping\n" );
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
DbgPrint( "[chipsec] writing %d bytes to physical address 0x%08x_%08x (virtual = %#010x)", len, pa.HighPart, pa.LowPart, (unsigned int)va );
|
||||
DbgPrint( "[chipsec] writing %d bytes to physical address 0x%08x_%08x (virtual = %#010x)", len, pa.HighPart, pa.LowPart, (UINTN)va );
|
||||
RtlCopyMemory( va, pData, len );
|
||||
MmUnmapIoSpace( va, len );
|
||||
return STATUS_SUCCESS;
|
||||
@@ -327,7 +329,7 @@ DriverDeviceControl(
|
||||
unsigned int new_cpu_thread_id = 0;
|
||||
ULONG _num_active_cpus = 0;
|
||||
KAFFINITY _kaffinity = 0;
|
||||
UINT32 core_id = 0;
|
||||
//UINT32 core_id = 0;
|
||||
|
||||
//
|
||||
// Get the current IRP stack location of this request
|
||||
@@ -412,7 +414,7 @@ DriverDeviceControl(
|
||||
case IOCTL_READ_PHYSMEM:
|
||||
{
|
||||
UINT32 len = 0;
|
||||
PVOID virt_addr;
|
||||
//PVOID virt_addr;
|
||||
PHYSICAL_ADDRESS phys_addr = { 0x0, 0x0 };
|
||||
|
||||
DbgPrint( "[chipsec] > IOCTL_READ_PHYSMEM\n" );
|
||||
@@ -461,7 +463,7 @@ DriverDeviceControl(
|
||||
case IOCTL_WRITE_PHYSMEM:
|
||||
{
|
||||
UINT32 len = 0;
|
||||
PVOID virt_addr = 0;
|
||||
//PVOID virt_addr = 0;
|
||||
PHYSICAL_ADDRESS phys_addr = { 0x0, 0x0 };
|
||||
|
||||
DbgPrint( "[chipsec] > IOCTL_WRITE_PHYSMEM\n" );
|
||||
@@ -480,7 +482,8 @@ DriverDeviceControl(
|
||||
phys_addr.HighPart = ((UINT32*)pInBuf)[0];
|
||||
phys_addr.LowPart = ((UINT32*)pInBuf)[1];
|
||||
len = ((UINT32*)pInBuf)[2];
|
||||
((UINT32*)pInBuf) += 3;
|
||||
//((UINT32*)pInBuf) += 3;
|
||||
*pInBuf = *pInBuf + (3 * sizeof(UINT32*));
|
||||
|
||||
if( IrpSp->Parameters.DeviceIoControl.InputBufferLength < len + 3*sizeof(UINT32) )
|
||||
{
|
||||
@@ -552,20 +555,20 @@ DriverDeviceControl(
|
||||
|
||||
case IOCTL_FREE_PHYSMEM:
|
||||
{
|
||||
UINT64 va = 0x0;
|
||||
UINTN va = 0x0;
|
||||
pInBuf = Irp->AssociatedIrp.SystemBuffer;
|
||||
pOutBuf = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DbgPrint( "[chipsec] > IOCTL_FREE_PHYSMEM\n" );
|
||||
if( !Irp->AssociatedIrp.SystemBuffer ||
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(UINT64))
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(UINTN))
|
||||
{
|
||||
DbgPrint( "[chipsec] ERROR: STATUS_INVALID_PARAMETER\n" );
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
RtlCopyBytes( &va, (BYTE*)Irp->AssociatedIrp.SystemBuffer, sizeof(UINT64) );
|
||||
RtlCopyBytes( &va, (BYTE*)Irp->AssociatedIrp.SystemBuffer, sizeof(UINTN) );
|
||||
DbgPrint( "[chipsec][IOCTL_FREE_PHYSMEM] Virtual address of the memory being freed: 0x%I64X\n", va );
|
||||
MmFreeContiguousMemory( (PVOID)va );
|
||||
|
||||
@@ -577,7 +580,7 @@ DriverDeviceControl(
|
||||
|
||||
case IOCTL_GET_PHYSADDR:
|
||||
{
|
||||
UINT64 va = 0x0;
|
||||
UINTN va = 0x0;
|
||||
PHYSICAL_ADDRESS pa = { 0x0, 0x0 };
|
||||
|
||||
pInBuf = Irp->AssociatedIrp.SystemBuffer;
|
||||
@@ -585,26 +588,26 @@ DriverDeviceControl(
|
||||
|
||||
DbgPrint( "[chipsec] > IOCTL_GET_PHYSADDR\n" );
|
||||
if( !Irp->AssociatedIrp.SystemBuffer ||
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(UINT64))
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(UINTN))
|
||||
{
|
||||
DbgPrint( "[chipsec] ERROR: STATUS_INVALID_PARAMETER\n" );
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
if( IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(UINT64))
|
||||
if( IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(UINTN))
|
||||
{
|
||||
DbgPrint( "[chipsec] ERROR: STATUS_BUFFER_TOO_SMALL\n" );
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
break;
|
||||
}
|
||||
|
||||
RtlCopyBytes( &va, (BYTE*)Irp->AssociatedIrp.SystemBuffer, sizeof(UINT64) );
|
||||
RtlCopyBytes( &va, (BYTE*)Irp->AssociatedIrp.SystemBuffer, sizeof(UINTN) );
|
||||
pa = MmGetPhysicalAddress( (PVOID)va );
|
||||
|
||||
DbgPrint( "[chipsec][IOCTL_GET_PHYSADDR] Traslated virtual address 0x%I64X to physical: 0x%I64X\n", va, pa.QuadPart, pa.LowPart);
|
||||
RtlCopyBytes( Irp->AssociatedIrp.SystemBuffer, (void*)&pa, sizeof(UINT64) );
|
||||
IrpSp->Parameters.Read.Length = sizeof(UINT64);
|
||||
RtlCopyBytes( Irp->AssociatedIrp.SystemBuffer, (void*)&pa, sizeof(UINTN) );
|
||||
IrpSp->Parameters.Read.Length = sizeof(UINTN);
|
||||
dwBytesWritten = IrpSp->Parameters.Read.Length;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
@@ -992,9 +995,9 @@ DriverDeviceControl(
|
||||
}
|
||||
case IOCTL_CPUID:
|
||||
{
|
||||
DWORD CPUInfo[4] = {-1};
|
||||
DWORD gprs[2] = {0};
|
||||
DWORD _rax = 0, _rcx = 0;
|
||||
int CPUInfo[4] = {-1};
|
||||
int gprs[2] = {0};
|
||||
int _rax = 0, _rcx = 0;
|
||||
//CPU_REG_TYPE gprs[6];
|
||||
//CPU_REG_TYPE _rax = 0, _rbx = 0, _rcx = 0, _rdx = 0, _rsi = 0, _rdi = 0;
|
||||
|
||||
@@ -1198,7 +1201,7 @@ DriverDeviceControl(
|
||||
|
||||
__try
|
||||
{
|
||||
result = hypercall(regs[0], regs[1], regs[2], regs[3], regs[4], regs[5], regs[6], regs[7], regs[8], regs[9], regs[10], &hypercall_page);
|
||||
result = hypercall(regs[0], regs[1], regs[2], regs[3], regs[4], regs[5], regs[6], regs[7], regs[8], regs[9], regs[10], (void*)&hypercall_page);
|
||||
}
|
||||
__except( EXCEPTION_EXECUTE_HANDLER )
|
||||
{
|
||||
|
||||
@@ -483,7 +483,7 @@ cPublicProc _hypercall, 12
|
||||
pop esi
|
||||
pop ebx
|
||||
stdRET _hypercall
|
||||
stdENDP _hypercall ENDP
|
||||
stdENDP _hypercall
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; UINT64 hypercall_page ( )
|
||||
|
||||
@@ -35,8 +35,10 @@ chipsec@intel.com
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
typedef UINT64 CPU_REG_TYPE;
|
||||
typedef UINT64 UINTN;
|
||||
#elif defined(_M_IX86)
|
||||
typedef UINT32 CPU_REG_TYPE;
|
||||
typedef unsigned long CPU_REG_TYPE;
|
||||
typedef UINT32 UINTN;
|
||||
#else
|
||||
#error "Architecture not supported"
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! WARNING
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!
|
||||
!! Chipsec should only be run on test systems! It should not be installed/deployed on end-user systems!
|
||||
!!
|
||||
!! There are multiple reasons for that:
|
||||
!!
|
||||
!! 1. Chipsec kernel drivers provide raw access to HW resources to user-mode applications
|
||||
!! (like access to physical memory). This would allow malware to compromise the OS kernel.
|
||||
!!
|
||||
!! 2. The driver is distributed as a source code. In order to load it on OS which requires signed drivers
|
||||
!! (e.g. x64 Microsoft Windows 7 and higher), you'll need to enable TestSigning mode and self-sign the
|
||||
!! driver binary. Enabling TestSigning (or equivalent) mode also turns off important protection of OS kernel.
|
||||
!!
|
||||
!! 3. Due to the nature of access to HW resources, if any chipsec module issues incorrect access
|
||||
!! to these HW resources, OS can crash/hang.
|
||||
!!
|
||||
!! If, for any reason, you want to production sign chipsec driver and deploy chipsec on end-user systems,
|
||||
!! DON'T!
|
||||
!!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
1. Build CHIPSEC kernel driver
|
||||
----------------------------------------------------
|
||||
|
||||
- Install Visual Studio 2017 and WDK for Windows 10
|
||||
You can find instructions to install Visual Studio and WDK from https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
|
||||
- Open the Visual Studio project file (drivers/win7/chipsec_hlpr.vcxproj)
|
||||
- Select the Build TYPE (DEBUG or RELEASE) and ARCHITECTURE for the driver (x64 or x86)
|
||||
- Select Build->Build Solution from the menu
|
||||
- Enable loading of test-signed kernel mode drivers (see chipsec-manual.pdf for details)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user