From 57b5254095a8f8e2e006aa2598604a2abf565018 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Sat, 20 Oct 2018 02:03:57 +0200 Subject: [PATCH 1/5] Reorganized Visual Studio solution/projects - Updated solution filters/folders to match the layout of the future layout of the repository {core. platforms, tests}. - Disabled JustMyCode from Debug configurations of driver-related projects to address an issue existing in Visual Studio 15.8: https://developercommunity.visualstudio.com/content/problem/302014/dirver-build-debugmode-checkfordebuggerjustmycode.html Signed-off-by: Alexandro Sanchez Bach --- HaxmDriver.sln | 15 ++++++++------- core/haxlib.vcxproj | 2 ++ windows/IntelHaxm.vcxproj | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/HaxmDriver.sln b/HaxmDriver.sln index be91c553..0c99fe7e 100644 --- a/HaxmDriver.sln +++ b/HaxmDriver.sln @@ -3,11 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27428.2037 MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dirs-Package", "Dirs-Package", "{D81DC995-DB74-4766-906A-BCE6F0D5C4CB}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{64E1CC85-832B-4062-9134-2F3852769FB2}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windows", "Windows", "{64E1CC85-832B-4062-9134-2F3852769FB2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{247C0037-7F0A-4694-B918-1160A913DDFF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{247C0037-7F0A-4694-B918-1160A913DDFF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dirs-Package", "dirs-Package\dirs-Package.vcxproj", "{A5FB804B-F439-4A01-A53B-489094D35A27}" EndProject @@ -15,10 +13,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntelHaxm", "windows\IntelH EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haxlib", "core\haxlib.vcxproj", "{BC80D1E0-5738-4048-A742-8A20949A6587}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\tests.vcxproj", "{0458723C-5C3F-4509-BDAE-35FAE2A90C19}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{8541C607-6D29-438B-9EC3-A49FDA0C82C4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -76,10 +76,11 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {A5FB804B-F439-4A01-A53B-489094D35A27} = {D81DC995-DB74-4766-906A-BCE6F0D5C4CB} - {BA777056-A57E-492D-A821-68D08A2DACE6} = {64E1CC85-832B-4062-9134-2F3852769FB2} + {A5FB804B-F439-4A01-A53B-489094D35A27} = {8541C607-6D29-438B-9EC3-A49FDA0C82C4} + {BA777056-A57E-492D-A821-68D08A2DACE6} = {8541C607-6D29-438B-9EC3-A49FDA0C82C4} {BC80D1E0-5738-4048-A742-8A20949A6587} = {247C0037-7F0A-4694-B918-1160A913DDFF} {0458723C-5C3F-4509-BDAE-35FAE2A90C19} = {4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E} + {8541C607-6D29-438B-9EC3-A49FDA0C82C4} = {64E1CC85-832B-4062-9134-2F3852769FB2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6858D286-AAC4-4D68-B5E1-C3320ABEE28C} diff --git a/core/haxlib.vcxproj b/core/haxlib.vcxproj index 774451ca..a4e48086 100644 --- a/core/haxlib.vcxproj +++ b/core/haxlib.vcxproj @@ -88,6 +88,7 @@ true + false --prefix _ %(AdditionalOptions) @@ -104,6 +105,7 @@ true + false diff --git a/windows/IntelHaxm.vcxproj b/windows/IntelHaxm.vcxproj index f1e2b273..a164a872 100644 --- a/windows/IntelHaxm.vcxproj +++ b/windows/IntelHaxm.vcxproj @@ -105,11 +105,13 @@ true + false true + false From 31fef8a622cfccb0f84adf56253cbc718dbff969 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Mon, 22 Oct 2018 23:22:21 +0200 Subject: [PATCH 2/5] Removed legacy build system files - Removed makefiles related to the legacy WDK 7.1 build system used in earlier HAXM releases. This has been replaced with WDK 10, whose Nmake2MsBuild tool generated the .props files. Since these files are no longer consumed by the current build system, they have been removed. - Removed `darwin\hax_driver\com_intel_hax\readme` file, since its description of the codebase no longer matches the actual state of the codebase. Signed-off-by: Alexandro Sanchez Bach --- core/sources | 31 -------------------------- darwin/hax_driver/com_intel_hax/readme | 6 ----- dirs | 3 --- windows/Makefile.inc | 4 ---- windows/sources | 23 ------------------- 5 files changed, 67 deletions(-) delete mode 100644 core/sources delete mode 100644 darwin/hax_driver/com_intel_hax/readme delete mode 100644 dirs delete mode 100644 windows/Makefile.inc delete mode 100644 windows/sources diff --git a/core/sources b/core/sources deleted file mode 100644 index a801dd7f..00000000 --- a/core/sources +++ /dev/null @@ -1,31 +0,0 @@ -TARGETNAME=haxlib -TARGETTYPE=DRIVER_LIBRARY -TARGETPATH=..\obj\core\ - -INCLUDES = .\include;..\include - -MSC_WARNING_LEVEL=/W1 - -C_DEFINES = $(C_DEFINES) /D__WINNT__ - -SOURCES= ept.c \ - vm.c \ - vcpu.c \ - cpu.c \ - cpuid.c \ - vmx.c \ - vtlb.c \ - dump_vmcs.c \ - hax.c \ - intr_exc.c \ - vmcs_names.c \ - memory.c \ - page_walker.c \ - ramblock.c \ - gpa_space.c \ - chunk.c \ - memslot.c \ - ept_tree.c \ - ept2.c \ - emulate.c - diff --git a/darwin/hax_driver/com_intel_hax/readme b/darwin/hax_driver/com_intel_hax/readme deleted file mode 100644 index e46ac542..00000000 --- a/darwin/hax_driver/com_intel_hax/readme +++ /dev/null @@ -1,6 +0,0 @@ -The directory layout: -source/: the implemenation of the driver -source/core/: the interface exported from hax core module -source/include/: darwin driver's include file to be shared with hax core module -source/darwin_utility/: darwin's utility to be exported by hax core -source/hax_core: hax core implementation \ No newline at end of file diff --git a/dirs b/dirs deleted file mode 100644 index 407c8efb..00000000 --- a/dirs +++ /dev/null @@ -1,3 +0,0 @@ -DIRS= \ - core \ - windows diff --git a/windows/Makefile.inc b/windows/Makefile.inc deleted file mode 100644 index 317e925c..00000000 --- a/windows/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -version.rc: hax_event_win.rc - -hax_event_win.h hax_event_win.rc MSG00001.bin: hax_event_win.mc - mc.exe hax_event_win.mc diff --git a/windows/sources b/windows/sources deleted file mode 100644 index 60dab210..00000000 --- a/windows/sources +++ /dev/null @@ -1,23 +0,0 @@ -TARGETNAME=IntelHaxm -TARGETTYPE=DRIVER -TARGETPATH=..\obj\out\$(DDK_TARGET_OS)\ - -INCLUDES = ..\include;..\include\windows\;..\core\include -TARGETLIBS=..\obj\core\*\haxlib.lib $(DDK_LIB_PATH)\wdmsec.lib - -C_DEFINES = $(C_DEFINES) /D__WINNT__ - -MSC_WARNING_LEVEL=/W2 - -SOURCES= hax_entry.c \ - components.c \ - hax_wrapper.c \ - hax_mm.c \ - hax_mem_alloc.c \ - hax_event.c \ - hax_winlog.c \ - version.rc \ - hax_host_mem.c - -NTTARGETFILE0 = hax_event_win.h - From 592f97a417ddc06030244851e257de1443974520 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Tue, 23 Oct 2018 19:16:21 +0200 Subject: [PATCH 3/5] Combined platform-specific folders - Moved `{darwin,windows}/` to `platforms/{darwin,windows}/`. This is meant to reduce root-folder pollution, specially if support for more platforms (e.g. Linux) is added. - Removed WDK 10 makefiles: There is no need of having one extra layer of indirection in our build systems: both VS and EWDK consume only .sln/.vcxproj files which are already checked in the repository. The additions to .vcxproj's are not significantly more verbose. - Reorganized .gitignore files: One root-level .gitignore file with general rules that affect the entire source tree (e.g.: .DS_Store for macOS), and platform/compiler-specific rules at platforms/*/.gitignore to deal with build-related files (e.g.: *.vcxproj.user for Visual Studio, build/ for Xcode). - Renamed `darwin/hax_driver/com_intel_hax` to `darwin` (to maintain consistent folder depth). - Renamed Windows build directory from `obj` to `build` (to maintain consistent naming with macOS). Signed-off-by: Alexandro Sanchez Bach --- .gitignore | 18 ---- core/sources.props | 12 --- dirs-Package/dirs-Package.vcxproj | 93 ------------------- include/hax_types.h | 2 +- platforms/darwin/.gitignore | 2 + .../darwin}/English.lproj/InfoPlist.strings | 0 .../darwin}/Info.plist | 0 .../darwin}/com_intel_hax.c | 0 .../darwin}/com_intel_hax.h | 4 +- .../darwin}/com_intel_hax_component.c | 0 .../darwin}/com_intel_hax_component.h | 0 .../darwin}/com_intel_hax_mem.cpp | 0 .../darwin}/com_intel_hax_mem.h | 0 .../darwin}/com_intel_hax_ui.c | 0 .../darwin}/com_intel_hax_ui.h | 0 .../darwin}/hax_host.h | 0 .../darwin}/hax_host_mem.cpp | 6 +- .../darwin}/hax_mem_alloc.cpp | 0 .../darwin}/hax_wrapper.cpp | 4 +- .../intelhaxm.xcodeproj/project.pbxproj | 56 ++++++----- platforms/windows/.gitignore | 10 ++ {windows => platforms/windows}/components.c | 0 {windows => platforms/windows}/hax_entry.c | 0 {windows => platforms/windows}/hax_entry.h | 0 {windows => platforms/windows}/hax_event.c | 0 .../windows}/hax_event_win.mc | 0 {windows => platforms/windows}/hax_host_mem.c | 0 .../windows}/hax_mem_alloc.c | 0 {windows => platforms/windows}/hax_mm.c | 0 {windows => platforms/windows}/hax_win.h | 0 {windows => platforms/windows}/hax_winlog.c | 0 {windows => platforms/windows}/hax_wrapper.c | 0 .../windows/haxm-core.vcxproj | 59 ++++++++---- .../windows/haxm-tests.vcxproj | 20 ++-- .../windows/haxm-windows.vcxproj | 57 +++++------- HaxmDriver.sln => platforms/windows/haxm.sln | 53 ++++------- .../windows/packages.haxm-core.config | 0 .../windows/packages.haxm-tests.config | 0 {windows => platforms/windows}/version.rc | 2 +- windows/makefile.inc.props | 70 -------------- windows/sources.props | 63 ------------- 41 files changed, 142 insertions(+), 389 deletions(-) delete mode 100644 core/sources.props delete mode 100644 dirs-Package/dirs-Package.vcxproj create mode 100644 platforms/darwin/.gitignore rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/English.lproj/InfoPlist.strings (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/Info.plist (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax.c (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax.h (96%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_component.c (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_component.h (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_mem.cpp (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_mem.h (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_ui.c (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/com_intel_hax_ui.h (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/hax_host.h (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/hax_host_mem.cpp (98%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/hax_mem_alloc.cpp (100%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/hax_wrapper.cpp (98%) rename {darwin/hax_driver/com_intel_hax => platforms/darwin}/intelhaxm.xcodeproj/project.pbxproj (94%) create mode 100644 platforms/windows/.gitignore rename {windows => platforms/windows}/components.c (100%) rename {windows => platforms/windows}/hax_entry.c (100%) rename {windows => platforms/windows}/hax_entry.h (100%) rename {windows => platforms/windows}/hax_event.c (100%) rename {windows => platforms/windows}/hax_event_win.mc (100%) rename {windows => platforms/windows}/hax_host_mem.c (100%) rename {windows => platforms/windows}/hax_mem_alloc.c (100%) rename {windows => platforms/windows}/hax_mm.c (100%) rename {windows => platforms/windows}/hax_win.h (100%) rename {windows => platforms/windows}/hax_winlog.c (100%) rename {windows => platforms/windows}/hax_wrapper.c (100%) rename core/haxlib.vcxproj => platforms/windows/haxm-core.vcxproj (73%) rename tests/tests.vcxproj => platforms/windows/haxm-tests.vcxproj (77%) rename windows/IntelHaxm.vcxproj => platforms/windows/haxm-windows.vcxproj (82%) rename HaxmDriver.sln => platforms/windows/haxm.sln (71%) rename core/packages.config => platforms/windows/packages.haxm-core.config (100%) rename tests/packages.config => platforms/windows/packages.haxm-tests.config (100%) rename {windows => platforms/windows}/version.rc (96%) delete mode 100644 windows/makefile.inc.props delete mode 100644 windows/sources.props diff --git a/.gitignore b/.gitignore index a74bd167..29fdffae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,2 @@ -# Visual Studio -.vs/ -packages/ -*.suo -*.vcxproj.user - -# Windows -/obj/ -Debug/ -Release/ -Win7Debug/ -Win7Release/ -Win8Debug/ -Win8Release/ -Win8.1Debug/ -Win8.1Release/ - # macOS -/darwin/hax_driver/com_intel_hax/build/ .DS_Store diff --git a/core/sources.props b/core/sources.props deleted file mode 100644 index 44b33909..00000000 --- a/core/sources.props +++ /dev/null @@ -1,12 +0,0 @@ - - - - haxlib - DRIVER_LIBRARY - $(SolutionDir)\obj\core - $(ProjectDir)\include;$(SolutionDir)\include - /W1 - $(C_DEFINES) /D__WINNT__ - ept.c vm.c vcpu.c cpu.c cpuid.c vmx.c vtlb.c dump_vmcs.c hax.c intr_exc.c vmcs_names.c memory.c page_walker.c ramblock.c gpa_space.c chunk.c memslot.c ept_tree.c ept2.c emulate.c - - diff --git a/dirs-Package/dirs-Package.vcxproj b/dirs-Package/dirs-Package.vcxproj deleted file mode 100644 index 0eb3abdc..00000000 --- a/dirs-Package/dirs-Package.vcxproj +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - Utility - Package - true - Debug - - - - {A5FB804B-F439-4A01-A53B-489094D35A27} - $(MSBuildProjectName) - - - Windows7 - true - WindowsKernelModeDriver10.0 - - - Windows7 - false - WindowsKernelModeDriver10.0 - Off - - - Windows7 - true - WindowsKernelModeDriver10.0 - - - Windows7 - false - WindowsKernelModeDriver10.0 - Off - - - - - - - - - - - DbgengKernelDebugger - False - False - None - - - - - - %PathToInf% - False - False - True - - 133563 - - - - - - - - - - {BA777056-A57E-492D-A821-68D08A2DACE6} - - - - - - \ No newline at end of file diff --git a/include/hax_types.h b/include/hax_types.h index ed330d5a..2fa74285 100644 --- a/include/hax_types.h +++ b/include/hax_types.h @@ -67,7 +67,7 @@ #define HAX_PLATFORM_DARWIN #include "darwin/hax_types_mac.h" // Windows -#elif defined(__WINNT__) +#elif defined(_WIN32) #define HAX_PLATFORM_WINDOWS #include "windows/hax_types_windows.h" #else diff --git a/platforms/darwin/.gitignore b/platforms/darwin/.gitignore new file mode 100644 index 00000000..81b0e796 --- /dev/null +++ b/platforms/darwin/.gitignore @@ -0,0 +1,2 @@ +# Objects +build/ diff --git a/darwin/hax_driver/com_intel_hax/English.lproj/InfoPlist.strings b/platforms/darwin/English.lproj/InfoPlist.strings similarity index 100% rename from darwin/hax_driver/com_intel_hax/English.lproj/InfoPlist.strings rename to platforms/darwin/English.lproj/InfoPlist.strings diff --git a/darwin/hax_driver/com_intel_hax/Info.plist b/platforms/darwin/Info.plist similarity index 100% rename from darwin/hax_driver/com_intel_hax/Info.plist rename to platforms/darwin/Info.plist diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax.c b/platforms/darwin/com_intel_hax.c similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax.c rename to platforms/darwin/com_intel_hax.c diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax.h b/platforms/darwin/com_intel_hax.h similarity index 96% rename from darwin/hax_driver/com_intel_hax/com_intel_hax.h rename to platforms/darwin/com_intel_hax.h index ddf6a59d..ee2ec1ce 100644 --- a/darwin/hax_driver/com_intel_hax/com_intel_hax.h +++ b/platforms/darwin/com_intel_hax.h @@ -40,8 +40,8 @@ #include #include -#include "../../../include/hax.h" -#include "../../../core/include/hax_core_interface.h" +#include "../../include/hax.h" +#include "../../core/include/hax_core_interface.h" #include "com_intel_hax_component.h" #include "com_intel_hax_ui.h" diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_component.c b/platforms/darwin/com_intel_hax_component.c similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_component.c rename to platforms/darwin/com_intel_hax_component.c diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_component.h b/platforms/darwin/com_intel_hax_component.h similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_component.h rename to platforms/darwin/com_intel_hax_component.h diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_mem.cpp b/platforms/darwin/com_intel_hax_mem.cpp similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_mem.cpp rename to platforms/darwin/com_intel_hax_mem.cpp diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_mem.h b/platforms/darwin/com_intel_hax_mem.h similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_mem.h rename to platforms/darwin/com_intel_hax_mem.h diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_ui.c b/platforms/darwin/com_intel_hax_ui.c similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_ui.c rename to platforms/darwin/com_intel_hax_ui.c diff --git a/darwin/hax_driver/com_intel_hax/com_intel_hax_ui.h b/platforms/darwin/com_intel_hax_ui.h similarity index 100% rename from darwin/hax_driver/com_intel_hax/com_intel_hax_ui.h rename to platforms/darwin/com_intel_hax_ui.h diff --git a/darwin/hax_driver/com_intel_hax/hax_host.h b/platforms/darwin/hax_host.h similarity index 100% rename from darwin/hax_driver/com_intel_hax/hax_host.h rename to platforms/darwin/hax_host.h diff --git a/darwin/hax_driver/com_intel_hax/hax_host_mem.cpp b/platforms/darwin/hax_host_mem.cpp similarity index 98% rename from darwin/hax_driver/com_intel_hax/hax_host_mem.cpp rename to platforms/darwin/hax_host_mem.cpp index b92e610d..41dec6e2 100644 --- a/darwin/hax_driver/com_intel_hax/hax_host_mem.cpp +++ b/platforms/darwin/hax_host_mem.cpp @@ -28,13 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../../include/hax_host_mem.h" +#include "../../include/hax_host_mem.h" #include #include -#include "../../../include/hax.h" -#include "../../../core/include/paging.h" +#include "../../include/hax.h" +#include "../../core/include/paging.h" extern "C" int hax_pin_user_pages(uint64_t start_uva, uint64_t size, hax_memdesc_user *memdesc) diff --git a/darwin/hax_driver/com_intel_hax/hax_mem_alloc.cpp b/platforms/darwin/hax_mem_alloc.cpp similarity index 100% rename from darwin/hax_driver/com_intel_hax/hax_mem_alloc.cpp rename to platforms/darwin/hax_mem_alloc.cpp diff --git a/darwin/hax_driver/com_intel_hax/hax_wrapper.cpp b/platforms/darwin/hax_wrapper.cpp similarity index 98% rename from darwin/hax_driver/com_intel_hax/hax_wrapper.cpp rename to platforms/darwin/hax_wrapper.cpp index 49bda6ce..4edcc78a 100644 --- a/darwin/hax_driver/com_intel_hax/hax_wrapper.cpp +++ b/platforms/darwin/hax_wrapper.cpp @@ -36,8 +36,8 @@ #include #include #include -#include "../../../include/hax.h" -#include "../../../core/include/ia32_defs.h" +#include "../../include/hax.h" +#include "../../core/include/ia32_defs.h" extern "C" int vcpu_event_pending(struct vcpu_t *vcpu); diff --git a/darwin/hax_driver/com_intel_hax/intelhaxm.xcodeproj/project.pbxproj b/platforms/darwin/intelhaxm.xcodeproj/project.pbxproj similarity index 94% rename from darwin/hax_driver/com_intel_hax/intelhaxm.xcodeproj/project.pbxproj rename to platforms/darwin/intelhaxm.xcodeproj/project.pbxproj index 41117f7c..3f20f6d5 100644 --- a/darwin/hax_driver/com_intel_hax/intelhaxm.xcodeproj/project.pbxproj +++ b/platforms/darwin/intelhaxm.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ 438B7295138CA774009DF91B /* com_intel_hax_ui.h in Headers */ = {isa = PBXBuildFile; fileRef = 438B7293138CA774009DF91B /* com_intel_hax_ui.h */; settings = {ATTRIBUTES = (Private, ); }; }; 438B7296138CA774009DF91B /* com_intel_hax_ui.c in Sources */ = {isa = PBXBuildFile; fileRef = 438B7294138CA774009DF91B /* com_intel_hax_ui.c */; }; 438B72DB138CE46F009DF91B /* com_intel_hax.h in Headers */ = {isa = PBXBuildFile; fileRef = 438B72DA138CE46F009DF91B /* com_intel_hax.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 4397BF02138F3CDF001A6A33 /* readme in Resources */ = {isa = PBXBuildFile; fileRef = 4397BF01138F3CDF001A6A33 /* readme */; }; 4397BF1E138F4530001A6A33 /* hax.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397BF1A138F4530001A6A33 /* hax.h */; }; 4397BF20138F4530001A6A33 /* hax_list.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397BF1C138F4530001A6A33 /* hax_list.h */; }; 4397BF21138F4530001A6A33 /* hax_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397BF1D138F4530001A6A33 /* hax_types.h */; }; @@ -97,15 +96,15 @@ /* Begin PBXFileReference section */ 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1A224C3CFF42312311CA2CB7 /* com_intel_hax.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = com_intel_hax.c; sourceTree = ""; }; - 22BFCFCD13A59A4300AD9F0F /* ept.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept.c; path = ../../../core/ept.c; sourceTree = SOURCE_ROOT; }; - 22BFCFD113A59A6500AD9F0F /* intr_exc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = intr_exc.c; path = ../../../core/intr_exc.c; sourceTree = SOURCE_ROOT; }; - 22BFCFD513A59A8200AD9F0F /* vtlb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vtlb.c; path = ../../../core/vtlb.c; sourceTree = SOURCE_ROOT; }; + 22BFCFCD13A59A4300AD9F0F /* ept.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept.c; path = ../../core/ept.c; sourceTree = SOURCE_ROOT; }; + 22BFCFD113A59A6500AD9F0F /* intr_exc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = intr_exc.c; path = ../../core/intr_exc.c; sourceTree = SOURCE_ROOT; }; + 22BFCFD513A59A8200AD9F0F /* vtlb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vtlb.c; path = ../../core/vtlb.c; sourceTree = SOURCE_ROOT; }; 22BFCFD713A59A9100AD9F0F /* ept.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ept.h; sourceTree = ""; }; 22BFCFDB13A59AA000AD9F0F /* intr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intr.h; sourceTree = ""; }; 22BFCFDD13A59AB100AD9F0F /* vtlb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vtlb.h; sourceTree = ""; }; 32A4FEC30562C75700D090E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32A4FEC40562C75800D090E7 /* intelhaxm.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = intelhaxm.kext; sourceTree = BUILT_PRODUCTS_DIR; }; - 43038AD9145F94190014BEE6 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../../core/memory.c; sourceTree = SOURCE_ROOT; }; + 43038AD9145F94190014BEE6 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../core/memory.c; sourceTree = SOURCE_ROOT; }; 4324E35513A3781500FA7CFB /* hax_core_interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hax_core_interface.h; sourceTree = ""; }; 43440D1D13A3834B002E1442 /* hax_interface_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hax_interface_mac.h; path = darwin/hax_interface_mac.h; sourceTree = ""; }; 43440D1E13A3834B002E1442 /* hax_types_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hax_types_mac.h; path = darwin/hax_types_mac.h; sourceTree = ""; }; @@ -117,7 +116,6 @@ 438B7293138CA774009DF91B /* com_intel_hax_ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = com_intel_hax_ui.h; sourceTree = ""; }; 438B7294138CA774009DF91B /* com_intel_hax_ui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = com_intel_hax_ui.c; sourceTree = ""; }; 438B72DA138CE46F009DF91B /* com_intel_hax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = com_intel_hax.h; sourceTree = ""; }; - 4397BF01138F3CDF001A6A33 /* readme */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = readme; sourceTree = ""; }; 4397BF1A138F4530001A6A33 /* hax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hax.h; sourceTree = ""; }; 4397BF1C138F4530001A6A33 /* hax_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hax_list.h; sourceTree = ""; }; 4397BF1D138F4530001A6A33 /* hax_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hax_types.h; sourceTree = ""; }; @@ -130,19 +128,19 @@ 642FD41D20D9F79100C197FF /* emulate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emulate.h; sourceTree = ""; }; 6448A2201EDFCDAB000B4B32 /* hax_host_mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hax_host_mem.h; sourceTree = ""; }; 6456261E1EEFF705005280EF /* ept2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ept2.h; sourceTree = ""; }; - 645626201EEFF720005280EF /* ept_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept_tree.c; path = ../../../core/ept_tree.c; sourceTree = ""; }; - 6496936E20D8AE0000C9BBAF /* cpuid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpuid.c; path = ../../../core/cpuid.c; sourceTree = ""; }; + 645626201EEFF720005280EF /* ept_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept_tree.c; path = ../../core/ept_tree.c; sourceTree = ""; }; + 6496936E20D8AE0000C9BBAF /* cpuid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpuid.c; path = ../../core/cpuid.c; sourceTree = ""; }; 64B72B841EDFFF7E00A8C202 /* hax_host_mem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hax_host_mem.cpp; sourceTree = ""; }; - 64B85BE81EF4D34D00223ABD /* ept2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept2.c; path = ../../../core/ept2.c; sourceTree = ""; }; - 64BB0CD020F36C470064593A /* vmx_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = vmx_ops.asm; path = ../../../core/vmx_ops.asm; sourceTree = ""; }; - 64BB0CD120F36C470064593A /* ia32_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = ia32_ops.asm; path = ../../../core/ia32_ops.asm; sourceTree = ""; }; + 64B85BE81EF4D34D00223ABD /* ept2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ept2.c; path = ../../core/ept2.c; sourceTree = ""; }; + 64BB0CD020F36C470064593A /* vmx_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = vmx_ops.asm; path = ../../core/vmx_ops.asm; sourceTree = ""; }; + 64BB0CD120F36C470064593A /* ia32_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; name = ia32_ops.asm; path = ../../core/ia32_ops.asm; sourceTree = ""; }; 64CD0F572101B51100099B53 /* ia32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ia32.h; sourceTree = ""; }; - 6E2DBBCB18EB6125003B66C9 /* page_walker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = page_walker.c; path = ../../../core/page_walker.c; sourceTree = ""; }; + 6E2DBBCB18EB6125003B66C9 /* page_walker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = page_walker.c; path = ../../core/page_walker.c; sourceTree = ""; }; 6E2DBBCD18EB6155003B66C9 /* page_walker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = page_walker.h; sourceTree = ""; }; - A669096A20F9985300739075 /* ia32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ia32.c; path = ../../../core/ia32.c; sourceTree = ""; }; - B98ECF9C13A059BB00485DDB /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../../../core/cpu.c; sourceTree = SOURCE_ROOT; }; - B98ECF9D13A059BB00485DDB /* dump_vmcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dump_vmcs.c; path = ../../../core/dump_vmcs.c; sourceTree = SOURCE_ROOT; }; - B98ECF9E13A059BB00485DDB /* hax.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hax.c; path = ../../../core/hax.c; sourceTree = SOURCE_ROOT; }; + A669096A20F9985300739075 /* ia32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ia32.c; path = ../../core/ia32.c; sourceTree = ""; }; + B98ECF9C13A059BB00485DDB /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../../core/cpu.c; sourceTree = SOURCE_ROOT; }; + B98ECF9D13A059BB00485DDB /* dump_vmcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dump_vmcs.c; path = ../../core/dump_vmcs.c; sourceTree = SOURCE_ROOT; }; + B98ECF9E13A059BB00485DDB /* hax.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hax.c; path = ../../core/hax.c; sourceTree = SOURCE_ROOT; }; B98ECFA013A059BB00485DDB /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiler.h; sourceTree = ""; }; B98ECFA113A059BB00485DDB /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; B98ECFA213A059BB00485DDB /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; @@ -157,19 +155,19 @@ B98ECFAD13A059BB00485DDB /* vcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vcpu.h; sourceTree = ""; }; B98ECFAF13A059BB00485DDB /* vm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vm.h; sourceTree = ""; }; B98ECFB013A059BB00485DDB /* vmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vmx.h; sourceTree = ""; }; - B98ECFB213A059BB00485DDB /* vcpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vcpu.c; path = ../../../core/vcpu.c; sourceTree = SOURCE_ROOT; }; - B98ECFB313A059BB00485DDB /* vm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vm.c; path = ../../../core/vm.c; sourceTree = SOURCE_ROOT; }; - B98ECFB413A059BB00485DDB /* vmcs_names.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vmcs_names.c; path = ../../../core/vmcs_names.c; sourceTree = SOURCE_ROOT; }; - B98ECFB513A059BB00485DDB /* vmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vmx.c; path = ../../../core/vmx.c; sourceTree = SOURCE_ROOT; }; - CF0539AC1EE536CB00FAD569 /* chunk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = chunk.c; path = ../../../core/chunk.c; sourceTree = ""; }; - CF148D5F1EE6BAEB0097A058 /* memslot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memslot.c; path = ../../../core/memslot.c; sourceTree = ""; }; + B98ECFB213A059BB00485DDB /* vcpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vcpu.c; path = ../../core/vcpu.c; sourceTree = SOURCE_ROOT; }; + B98ECFB313A059BB00485DDB /* vm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vm.c; path = ../../core/vm.c; sourceTree = SOURCE_ROOT; }; + B98ECFB413A059BB00485DDB /* vmcs_names.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vmcs_names.c; path = ../../core/vmcs_names.c; sourceTree = SOURCE_ROOT; }; + B98ECFB513A059BB00485DDB /* vmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vmx.c; path = ../../core/vmx.c; sourceTree = SOURCE_ROOT; }; + CF0539AC1EE536CB00FAD569 /* chunk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = chunk.c; path = ../../core/chunk.c; sourceTree = ""; }; + CF148D5F1EE6BAEB0097A058 /* memslot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memslot.c; path = ../../core/memslot.c; sourceTree = ""; }; CF6A32281EDEB86E00468E62 /* pmu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pmu.h; sourceTree = ""; }; - CFB6FDDA1ED43C540048A750 /* ramblock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ramblock.c; path = ../../../core/ramblock.c; sourceTree = ""; }; - CFD697461ED2DC9700F10631 /* gpa_space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gpa_space.c; path = ../../../core/gpa_space.c; sourceTree = ""; }; + CFB6FDDA1ED43C540048A750 /* ramblock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ramblock.c; path = ../../core/ramblock.c; sourceTree = ""; }; + CFD697461ED2DC9700F10631 /* gpa_space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gpa_space.c; path = ../../core/gpa_space.c; sourceTree = ""; }; CFD697481ED2DCB700F10631 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; D27513B306A6225300ADB3A4 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; }; - FA8F651D208BAD9A00C8E91F /* emulate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = emulate.c; path = ../../../core/emulate.c; sourceTree = ""; }; - FA8F651F208BC1BA00C8E91F /* emulate_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; fileEncoding = 4; name = emulate_ops.asm; path = ../../../core/emulate_ops.asm; sourceTree = ""; }; + FA8F651D208BAD9A00C8E91F /* emulate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = emulate.c; path = ../../core/emulate.c; sourceTree = ""; }; + FA8F651F208BC1BA00C8E91F /* emulate_ops.asm */ = {isa = PBXFileReference; explicitFileType = sourcecode.nasm; fileEncoding = 4; name = emulate_ops.asm; path = ../../core/emulate_ops.asm; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -249,7 +247,6 @@ 438B7293138CA774009DF91B /* com_intel_hax_ui.h */, 438B7294138CA774009DF91B /* com_intel_hax_ui.c */, 438B72DA138CE46F009DF91B /* com_intel_hax.h */, - 4397BF01138F3CDF001A6A33 /* readme */, 43F857DE13931E75008A93D6 /* com_intel_hax_mem.h */, 43F857DF13931E75008A93D6 /* com_intel_hax_mem.cpp */, ); @@ -270,7 +267,7 @@ 6448A2201EDFCDAB000B4B32 /* hax_host_mem.h */, ); name = include; - path = ../../../include; + path = ../../include; sourceTree = SOURCE_ROOT; }; B98ECF9F13A059BB00485DDB /* include */ = { @@ -304,7 +301,7 @@ B98ECFB013A059BB00485DDB /* vmx.h */, ); name = include; - path = ../../../core/include; + path = ../../core/include; sourceTree = SOURCE_ROOT; }; /* End PBXGroup section */ @@ -413,7 +410,6 @@ buildActionMask = 2147483647; files = ( 32A4FEBC0562C75700D090E7 /* InfoPlist.strings in Resources */, - 4397BF02138F3CDF001A6A33 /* readme in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platforms/windows/.gitignore b/platforms/windows/.gitignore new file mode 100644 index 00000000..03df13a5 --- /dev/null +++ b/platforms/windows/.gitignore @@ -0,0 +1,10 @@ +# Objects +build/ + +# Dependencies +packages/ + +# Visual Studio +.vs/ +*.suo +*.vcxproj.user diff --git a/windows/components.c b/platforms/windows/components.c similarity index 100% rename from windows/components.c rename to platforms/windows/components.c diff --git a/windows/hax_entry.c b/platforms/windows/hax_entry.c similarity index 100% rename from windows/hax_entry.c rename to platforms/windows/hax_entry.c diff --git a/windows/hax_entry.h b/platforms/windows/hax_entry.h similarity index 100% rename from windows/hax_entry.h rename to platforms/windows/hax_entry.h diff --git a/windows/hax_event.c b/platforms/windows/hax_event.c similarity index 100% rename from windows/hax_event.c rename to platforms/windows/hax_event.c diff --git a/windows/hax_event_win.mc b/platforms/windows/hax_event_win.mc similarity index 100% rename from windows/hax_event_win.mc rename to platforms/windows/hax_event_win.mc diff --git a/windows/hax_host_mem.c b/platforms/windows/hax_host_mem.c similarity index 100% rename from windows/hax_host_mem.c rename to platforms/windows/hax_host_mem.c diff --git a/windows/hax_mem_alloc.c b/platforms/windows/hax_mem_alloc.c similarity index 100% rename from windows/hax_mem_alloc.c rename to platforms/windows/hax_mem_alloc.c diff --git a/windows/hax_mm.c b/platforms/windows/hax_mm.c similarity index 100% rename from windows/hax_mm.c rename to platforms/windows/hax_mm.c diff --git a/windows/hax_win.h b/platforms/windows/hax_win.h similarity index 100% rename from windows/hax_win.h rename to platforms/windows/hax_win.h diff --git a/windows/hax_winlog.c b/platforms/windows/hax_winlog.c similarity index 100% rename from windows/hax_winlog.c rename to platforms/windows/hax_winlog.c diff --git a/windows/hax_wrapper.c b/platforms/windows/hax_wrapper.c similarity index 100% rename from windows/hax_wrapper.c rename to platforms/windows/hax_wrapper.c diff --git a/core/haxlib.vcxproj b/platforms/windows/haxm-core.vcxproj similarity index 73% rename from core/haxlib.vcxproj rename to platforms/windows/haxm-core.vcxproj index a4e48086..d504da89 100644 --- a/core/haxlib.vcxproj +++ b/platforms/windows/haxm-core.vcxproj @@ -26,19 +26,10 @@ x64 - - 1.0 - $(Configuration.Replace(' ','')) - $(BUILD_ALT_DIR)\$(Platform)\ - $(BUILD_ALT_DIR)\x86\ - $(IntDir) - - - - {BC80D1E0-5738-4048-A742-8A20949A6587} $(MSBuildProjectName) + $(LatestTargetPlatformVersion) Windows7 @@ -63,7 +54,7 @@ - + @@ -78,17 +69,22 @@ + + $(SolutionDir)build\core\$(Platform)\$(ConfigurationName)\ + $(SolutionDir)build\intermediates\$(ProjectName)\$(Platform)\$(ConfigurationName)\ + - - - - + + + + true false + Level1 --prefix _ %(AdditionalOptions) @@ -97,6 +93,7 @@ true + Level1 --prefix _ %(AdditionalOptions) @@ -106,17 +103,39 @@ true false + Level1 true + Level1 - + + + + + + + + + + + + + + + + + + + + + @@ -140,7 +159,7 @@ - + @@ -148,13 +167,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/tests/tests.vcxproj b/platforms/windows/haxm-tests.vcxproj similarity index 77% rename from tests/tests.vcxproj rename to platforms/windows/haxm-tests.vcxproj index f0b399a0..d5626d03 100644 --- a/tests/tests.vcxproj +++ b/platforms/windows/haxm-tests.vcxproj @@ -35,22 +35,26 @@ + + $(SolutionDir)build\tests\$(Platform)\$(ConfigurationName)\ + $(SolutionDir)build\intermediates\$(ProjectName)\$(Platform)\$(ConfigurationName)\ + - + - + - + {bc80d1e0-5738-4048-a742-8a20949a6587} - - + + @@ -116,7 +120,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/windows/IntelHaxm.vcxproj b/platforms/windows/haxm-windows.vcxproj similarity index 82% rename from windows/IntelHaxm.vcxproj rename to platforms/windows/haxm-windows.vcxproj index a164a872..7a476561 100644 --- a/windows/IntelHaxm.vcxproj +++ b/platforms/windows/haxm-windows.vcxproj @@ -27,19 +27,10 @@ True - - 1.0 - $(Configuration.Replace(' ','')) - $(BUILD_ALT_DIR)\$(Platform)\ - $(BUILD_ALT_DIR)\x86\ - $(IntDir) - - - - {BA777056-A57E-492D-A821-68D08A2DACE6} $(MSBuildProjectName) + $(LatestTargetPlatformVersion) Windows7 @@ -80,52 +71,57 @@ - - - - - + + $(SolutionDir)build\out\$(Platform)\$(ConfigurationName)\ + $(SolutionDir)build\intermediates\$(ProjectName)\$(Platform)\$(ConfigurationName)\ + + - true + $(SolutionDir)build\core\$(Platform)\$(ConfigurationName)\haxlib.lib;$(DDK_LIB_PATH)wdmsec.lib;%(AdditionalDependencies) - - true - true + Level2 + $(SolutionDir)..\..\include;$(SolutionDir)..\..\include\windows\;$(SolutionDir)..\..\core\include;$(IntDir);%(AdditionalIncludeDirectories) + + + true + + true - - true - - true false - true false - - true - + + + + + + + + + + @@ -146,12 +142,9 @@ - - - - + {BC80D1E0-5738-4048-A742-8A20949A6587} diff --git a/HaxmDriver.sln b/platforms/windows/haxm.sln similarity index 71% rename from HaxmDriver.sln rename to platforms/windows/haxm.sln index 0c99fe7e..86bdfd32 100644 --- a/HaxmDriver.sln +++ b/platforms/windows/haxm.sln @@ -7,17 +7,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{247C0037-7F0A-4694-B918-1160A913DDFF}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dirs-Package", "dirs-Package\dirs-Package.vcxproj", "{A5FB804B-F439-4A01-A53B-489094D35A27}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntelHaxm", "windows\IntelHaxm.vcxproj", "{BA777056-A57E-492D-A821-68D08A2DACE6}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{8541C607-6D29-438B-9EC3-A49FDA0C82C4}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haxlib", "core\haxlib.vcxproj", "{BC80D1E0-5738-4048-A742-8A20949A6587}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haxm-core", "haxm-core.vcxproj", "{BC80D1E0-5738-4048-A742-8A20949A6587}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haxm-windows", "haxm-windows.vcxproj", "{BA777056-A57E-492D-A821-68D08A2DACE6}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\tests.vcxproj", "{0458723C-5C3F-4509-BDAE-35FAE2A90C19}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{8541C607-6D29-438B-9EC3-A49FDA0C82C4}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "haxm-tests", "haxm-tests.vcxproj", "{0458723C-5C3F-4509-BDAE-35FAE2A90C19}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,30 +25,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|Win32.ActiveCfg = Debug|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|Win32.Build.0 = Debug|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|Win32.Deploy.0 = Debug|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|x64.ActiveCfg = Debug|x64 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|x64.Build.0 = Debug|x64 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Debug|x64.Deploy.0 = Debug|x64 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|Win32.ActiveCfg = Release|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|Win32.Build.0 = Release|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|Win32.Deploy.0 = Release|Win32 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|x64.ActiveCfg = Release|x64 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|x64.Build.0 = Release|x64 - {A5FB804B-F439-4A01-A53B-489094D35A27}.Release|x64.Deploy.0 = Release|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.Build.0 = Debug|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.Deploy.0 = Debug|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.ActiveCfg = Debug|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.Build.0 = Debug|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.Deploy.0 = Debug|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.ActiveCfg = Release|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.Build.0 = Release|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.Deploy.0 = Release|Win32 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.ActiveCfg = Release|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.Build.0 = Release|x64 - {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.Deploy.0 = Release|x64 {BC80D1E0-5738-4048-A742-8A20949A6587}.Debug|Win32.ActiveCfg = Debug|Win32 {BC80D1E0-5738-4048-A742-8A20949A6587}.Debug|Win32.Build.0 = Debug|Win32 {BC80D1E0-5738-4048-A742-8A20949A6587}.Debug|Win32.Deploy.0 = Debug|Win32 @@ -63,6 +37,18 @@ Global {BC80D1E0-5738-4048-A742-8A20949A6587}.Release|x64.ActiveCfg = Release|x64 {BC80D1E0-5738-4048-A742-8A20949A6587}.Release|x64.Build.0 = Release|x64 {BC80D1E0-5738-4048-A742-8A20949A6587}.Release|x64.Deploy.0 = Release|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.Build.0 = Debug|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|Win32.Deploy.0 = Debug|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.ActiveCfg = Debug|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.Build.0 = Debug|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Debug|x64.Deploy.0 = Debug|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.ActiveCfg = Release|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.Build.0 = Release|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|Win32.Deploy.0 = Release|Win32 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.ActiveCfg = Release|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.Build.0 = Release|x64 + {BA777056-A57E-492D-A821-68D08A2DACE6}.Release|x64.Deploy.0 = Release|x64 {0458723C-5C3F-4509-BDAE-35FAE2A90C19}.Debug|Win32.ActiveCfg = Debug|Win32 {0458723C-5C3F-4509-BDAE-35FAE2A90C19}.Debug|Win32.Build.0 = Debug|Win32 {0458723C-5C3F-4509-BDAE-35FAE2A90C19}.Debug|x64.ActiveCfg = Debug|x64 @@ -76,11 +62,10 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {A5FB804B-F439-4A01-A53B-489094D35A27} = {8541C607-6D29-438B-9EC3-A49FDA0C82C4} - {BA777056-A57E-492D-A821-68D08A2DACE6} = {8541C607-6D29-438B-9EC3-A49FDA0C82C4} + {8541C607-6D29-438B-9EC3-A49FDA0C82C4} = {64E1CC85-832B-4062-9134-2F3852769FB2} {BC80D1E0-5738-4048-A742-8A20949A6587} = {247C0037-7F0A-4694-B918-1160A913DDFF} + {BA777056-A57E-492D-A821-68D08A2DACE6} = {8541C607-6D29-438B-9EC3-A49FDA0C82C4} {0458723C-5C3F-4509-BDAE-35FAE2A90C19} = {4FF4BA9A-1A63-4CBF-A6C0-1D2D83B2146E} - {8541C607-6D29-438B-9EC3-A49FDA0C82C4} = {64E1CC85-832B-4062-9134-2F3852769FB2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6858D286-AAC4-4D68-B5E1-C3320ABEE28C} diff --git a/core/packages.config b/platforms/windows/packages.haxm-core.config similarity index 100% rename from core/packages.config rename to platforms/windows/packages.haxm-core.config diff --git a/tests/packages.config b/platforms/windows/packages.haxm-tests.config similarity index 100% rename from tests/packages.config rename to platforms/windows/packages.haxm-tests.config diff --git a/windows/version.rc b/platforms/windows/version.rc similarity index 96% rename from windows/version.rc rename to platforms/windows/version.rc index b5ebf0f1..a25e0388 100644 --- a/windows/version.rc +++ b/platforms/windows/version.rc @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../include/hax_release_ver.h" +#include "../../include/hax_release_ver.h" #include #define VER_DEBUG 2 diff --git a/windows/makefile.inc.props b/windows/makefile.inc.props deleted file mode 100644 index 375b86ab..00000000 --- a/windows/makefile.inc.props +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - ConvertedTarget1_Disabled - Converted Target 1 - hax_event_win.h hax_event_win.rc MSG00001.bin - - - mc.exe hax_event_win.mc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/windows/sources.props b/windows/sources.props deleted file mode 100644 index a9f06d4c..00000000 --- a/windows/sources.props +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - IntelHaxm - DRIVER - $(SolutionDir)\obj\out\$(DDK_TARGET_OS) - $(SolutionDir)\include;$(SolutionDir)\include\windows\;$(SolutionDir)\core\include - $(SolutionDir)\obj\core\$(TARGET_DIRECTORY)\haxlib.lib $(DDK_LIB_PATH)\wdmsec.lib - $(C_DEFINES) /D__WINNT__ - /W2 - - components.c - hax_entry.c - hax_event.c - hax_host_mem.c - hax_mem_alloc.c - hax_mm.c - hax_winlog.c - hax_wrapper.c - version.rc - - - hax_event_win.h - - - - - 0 - - - - - From 89857deb90473126cc6b31e65c02d6aa22125bd1 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Wed, 24 Oct 2018 15:15:26 +0200 Subject: [PATCH 4/5] Combined documentation Moved API.md to docs/api.md, and added platform-specific usage instructions in docs/manual-{darwin,windows}.md to avoid polluting README.md, specially if support for more platforms (e.g. Linux) is added. Signed-off-by: Alexandro Sanchez Bach --- README.md | 215 +---------------------------------------- API.md => docs/api.md | 0 docs/manual-macos.md | 78 +++++++++++++++ docs/manual-windows.md | 137 ++++++++++++++++++++++++++ 4 files changed, 219 insertions(+), 211 deletions(-) rename API.md => docs/api.md (100%) create mode 100644 docs/manual-macos.md create mode 100644 docs/manual-windows.md diff --git a/README.md b/README.md index eb1f3eef..c8c8fd85 100644 --- a/README.md +++ b/README.md @@ -10,206 +10,11 @@ extension (_kext_) for macOS. If you are interested in building HAXM from the source code, please read on. If you are just looking for the latest HAXM release, you can get it [here][github-haxm-latest-release]. -## Building for Windows -### Prerequisites +## Usage -**Option A (Visual Studio)** -* [Visual Studio 2017][visualstudio] - * Install at least the following components: -_Universal Windows Platform development_, _Desktop development with C++_. -* [Windows SDK for Windows 10][sdk10] -* [Windows Driver Kit (WDK) for Windows 10][wdk10] - -Note that the version/build number of Windows SDK must match that of WDK. -In particular, the Windows 10 SDK installed by Visual Studio 2017 (version 1709, -build 10.0.16299 as of this writing) may not be the latest version. If you want -to use the latest WDK (version 1803 as of this writing), you may need to -download and install the latest Windows 10 SDK (version 1803, build 10.0.17134 -as of this writing). - -**Option B (EWDK)** -* [Enterprise WDK (EWDK) 10][ewdk10] with Visual Studio Build Tools 15.6 - * Install the downloaded ISO image by mounting it or extracting it to an empty -folder. -* [NuGet CLI tool][nuget] (`nuget.exe`) version 4.x or later - -### Build steps -**Option A (Visual Studio)** -1. Open `HaxmDriver.sln` in Visual Studio 2017. -1. Select either `Debug` or `Release` configuration. - * The `Debug` configuration also signs the driver with a test certificate. -The `Release` configuration does not do that. -1. Select either `x64` or `Win32` platform. -1. Build solution. - -**Option B (EWDK)** -1. `cd X:\path\to\EWDK\` -1. `LaunchBuildEnv.cmd` -1. `cd X:\path\to\haxm\` -1. `X:\path\to\nuget.exe restore` -1. `msbuild HaxmDriver.sln /p:Configuration="Debug" /p:Platform="x64"` - * Use `Release` instead of `Debug` to build an optimized driver that is -suitable for release. Note that the `Release` configuration does not sign the -driver with a test certificate. - * Use `Win32` instead of `x64` to build a 32-bit driver that works on 32-bit -Windows. - * Add `/t:rebuild` for a clean rebuild instead of an incremental build. - -If successful, the driver binary (`IntelHaxm.sys`) will be generated in -`X:\path\to\haxm\obj\out\Win7\x64\` (or `X:\path\to\haxm\obj\out\Win7\x86\` if -`Platform="Win32"`), and will be able to run on Windows 7 and later. - -## Testing on Windows -### System requirements -Note that these are requirements for the _test_ environment, which does not -have to be the same as the _build_ environment. - -1. An Intel CPU that supports Intel VT-x with _Extended Page Tables_ (EPT). - * [Here][intel-ept-cpus] is a list of CPUs that meet this requirement. As a -rule of thumb, if you have an Intel Core i3, i5, i7 or i9 (any generation), you -are good to go. - * EPT is an advanced feature of Intel VT-x. CPUs that support EPT also -support _Unrestricted Guest_ (UG), which is another advanced feature of VT-x. -It may still be possible to run HAXM on very old (pre-2010) CPUs, e.g. -Intel Core 2 Duo, which implement an earlier version of VT-x that does not -include either EPT or UG. However, the legacy code that enables HAXM to work in -non-EPT and non-UG modes may be removed soon. -1. Windows 7 or later; both 32-bit and 64-bit Windows are supported. - * Running HAXM in a nested virtualization setup, where Windows itself runs as -a guest OS on another hypervisor, may be possible, but this use case is not well -tested. - -### One-time setup -The following steps prepare the test environment for installing a test-signed -`IntelHaxm.sys`, i.e. one that is built using the `Debug` configuration. For -more details, please read [this article][windows-test-driver-install]. - -1. Disable Hyper-V and enable _Test Mode_: - 1. Open an **elevated** (i.e. _Run as administrator_) Command Prompt. - 1. `bcdedit /set hypervisorlaunchtype off` - 1. `bcdedit /set testsigning on` - 1. Reboot. -1. Install the test certificate: - 1. Copy `IntelHaxm.cer` from the build environment to the test environment -(if the two are not the same). This file is generated alongside `IntelHaxm.sys` -by the `Debug` build configuration. - 1. In the test environment, open an **elevated** Command Prompt and run -`certmgr /add X:\path\to\IntelHaxm.cer /s /r localMachine root` -1. Optionally, install [DebugView][debugview] to capture HAXM debug output. - -### Loading and unloading the test driver -`HaxmLoader` is a small tool that can load and unload a test-signed driver -without using an INF file. You can download it from the -[Releases][github-haxm-releases] page, or building `HaxmLoader/HaxmLoader.sln` -yourself using Visual Studio or EWDK. - -Basically, kernel-mode drivers like HAXM are managed by Windows Service Control -Manager as services. Each such service has a unique name, a corresponding driver -file, and a state. For example, when the HAXM installer installs the -release-signed driver to `C:\Windows\System32\drivers\IntelHaxm.sys`, it also -creates a service for it. This service is named `intelhaxm` and is started at -boot time. `HaxmLoader` works in a similar manner: when loading a test driver, -it creates a temporary service and starts it; when unloading the test driver, it -stops and then deletes the service. - -To load the test driver: -1. Open an **elevated** Command Prompt. -1. Make sure no other HAXM driver is loaded. - 1. If `sc query intelhaxm` shows the `intelhaxm` service as `RUNNING`, you -must stop it first: `sc stop intelhaxm` - 1. Otherwise, unload the previously loaded test driver, if any: -`HaxmLoader.exe -u` -1. Load the test driver: `HaxmLoader.exe -i X:\path\to\IntelHaxm.sys` - * Note that `HaxmLoader` can load a driver from any folder, so there is no -need to copy the test driver to `C:\Windows\System32\drivers\` first. - -To unload the test driver: -1. Open an **elevated** Command Prompt. -1. `HaxmLoader.exe -u` -1. Optionally, you may want to restore the original, release-signed driver -(i.e. `C:\Windows\System32\drivers\IntelHaxm.sys`): `sc start intelhaxm` - -### Capturing driver logs -1. Launch DebugView (`Dbgview.exe`) as administrator. -1. In the _Capture_ menu, select everything except _Log Boot_. DebugView will -now start capturing debug output from all kernel-mode drivers. -1. In order to filter out non-HAXM logs, go to _Edit_ > _Filter/Highlight..._, -enter `hax*` for _Include_, and click on _OK_. - -## Building for macOS -### Prerequisites -* Xcode 7.2.1 or later -* OS X 10.10 SDK (archived [here][osx-sdks]) - * Use `xcodebuild -showsdks` to list installed SDKs. - * It is also possible to build HAXM using a newer version of macOS SDK. -However, using an older SDK ensures that the generated kext is compatible with -older versions of macOS. -* NASM 2.11 or later - * Install to `/usr/local/bin/` using Homebrew: `brew install nasm` - * Note that Apple NASM (`/usr/bin/nasm`) cannot be used. - -### Build steps -1. `cd /path/to/haxm/` -1. `cd darwin/hax_driver/com_intel_hax/` -1. `xcodebuild -configuration Debug` - * Use `-sdk` to override the default macOS SDK version (10.10), e.g. -`-sdk macosx10.12` (to select SDK 10.12) or even `-sdk macosx` (to select the -latest SDK installed). - * Use `Release` instead of `Debug` to build an optimized kext that is -suitable for release. - -If successful, the kext (`intelhaxm.kext/`) will be generated in -`/path/to/haxm/darwin/hax_driver/com_intel_hax/build/Debug/`. - -## Testing on macOS -### System requirements -Note that these are requirements for the _test_ environment, which does not -have to be the same as the _build_ environment. - -1. Hardware requirements are the same as those for Windows. -1. OS X 10.10 or later. - -### Loading and unloading the test kext -The `intelhaxm.kext` generated by the `Debug` and `Release` build configurations -is not signed. Unless you can sign it using a special kind of Apple Developer ID -Certificate, you must configure your test Mac to allow unsigned kexts to load: -* For OS X 10.10, the solution is to add the `kext-dev-mode=1` _boot-arg_. More -details can be found [here][macos-kext-dev-mode]. -* For macOS 10.11 and later, the solution is to turn off System Integrity -Protection (SIP). More details can be found [here][macos-sip-disable]. - -To load the test kext: -1. Make sure no other HAXM kext is loaded. If the output of -`kextstat | grep intelhaxm` is not empty, you must unload the existing HAXM kext -first: `sudo kextunload -b com.intel.kext.intelhaxm` -1. `sudo chown -R root:wheel /path/to/intelhaxm.kext` -1. `sudo chmod -R 755 /path/to/intelhaxm.kext` -1. `sudo kextload /path/to/intelhaxm.kext` - * Note that `kextload` can load a kext from any folder, so there is no need -to copy the test kext to `/Library/Extensions/` first. - -To unload the test kext: -1. `sudo kextunload /path/to/intelhaxm.kext` -1. Optionally, you may want to restore the original HAXM kext, which is usually -the signed one installed to `/Library/Extensions/`: -`sudo kextload /Library/Extensions/intelhaxm.kext` - -### Viewing kext logs -On macOS, HAXM debug output goes to the system log database, and can be -retrieved at almost any time. - -* On OS X 10.10, HAXM log messages are written immediately to -`/var/log/system.log`. You can monitor this file for real-time updates using -_Console.app_ or the `syslog -w` command. -* On macOS 10.11 or later, HAXM log messages are no longer written to -`/var/log/system.log`, and there is no good way to capture them in real time. -However, you can still retrieve them at a later time using one of the following -methods: - 1. `log show --predicate 'sender == "intelhaxm"' --style syslog --last 1h`, -which is complex but very flexible. In this example, `--last 1h` indicates the -past hour, and can be replaced with other queries. - 1. `sudo dmesg | grep hax`, which is simple, but does not show the timestamp -of each message. +Detailed instructions for building and testing HAXM can be found at: +* [Manual for macOS](docs/manual-macos.md) +* [Manual for Windows](docs/manual-windows.md) ## Reporting an Issue You are welcome to file a GitHub issue if you discover a general HAXM bug or @@ -226,16 +31,4 @@ sensitive information. [android-studio]: https://developer.android.com/studio/index.html [qemu]: https://www.qemu.org/ [github-haxm-latest-release]: https://github.com/intel/haxm/releases/latest -[visualstudio]: https://www.visualstudio.com/downloads/ -[ewdk10]: https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/using-the-enterprise-wdk -[sdk10]: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk -[wdk10]: https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk -[nuget]: https://www.nuget.org/downloads -[intel-ept-cpus]: https://ark.intel.com/Search/FeatureFilter?productType=processors&ExtendedPageTables=true -[windows-test-driver-install]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/installing-test-signed-driver-packages -[debugview]: https://docs.microsoft.com/en-us/sysinternals/downloads/debugview -[github-haxm-releases]: https://github.com/intel/haxm/releases -[osx-sdks]: https://github.com/phracker/MacOSX-SDKs -[macos-kext-dev-mode]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html -[macos-sip-disable]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html [intel-security-email]: mailto:secure@intel.com diff --git a/API.md b/docs/api.md similarity index 100% rename from API.md rename to docs/api.md diff --git a/docs/manual-macos.md b/docs/manual-macos.md new file mode 100644 index 00000000..f210adc2 --- /dev/null +++ b/docs/manual-macos.md @@ -0,0 +1,78 @@ +## Building for macOS +### Prerequisites +* Xcode 7.2.1 or later +* OS X 10.10 SDK (archived [here][osx-sdks]) + * Use `xcodebuild -showsdks` to list installed SDKs. + * It is also possible to build HAXM using a newer version of macOS SDK. +However, using an older SDK ensures that the generated kext is compatible with +older versions of macOS. +* NASM 2.11 or later + * Install to `/usr/local/bin/` using Homebrew: `brew install nasm` + * Note that Apple NASM (`/usr/bin/nasm`) cannot be used. + +### Build steps +1. `cd /path/to/haxm/` +1. `cd platforms/darwin/` +1. `xcodebuild -configuration Debug` + * Use `-sdk` to override the default macOS SDK version (10.10), e.g. +`-sdk macosx10.12` (to select SDK 10.12) or even `-sdk macosx` (to select the +latest SDK installed). + * Use `Release` instead of `Debug` to build an optimized kext that is +suitable for release. + +If successful, the kext (`intelhaxm.kext/`) will be generated in +`/path/to/haxm/platforms/darwin/build/Debug/`. + +## Testing on macOS +### System requirements +Note that these are requirements for the _test_ environment, which does not +have to be the same as the _build_ environment. + +1. Hardware requirements are the same as those for Windows. +1. OS X 10.10 or later. + +### Loading and unloading the test kext +The `intelhaxm.kext` generated by the `Debug` and `Release` build configurations +is not signed. Unless you can sign it using a special kind of Apple Developer ID +Certificate, you must configure your test Mac to allow unsigned kexts to load: +* For OS X 10.10, the solution is to add the `kext-dev-mode=1` _boot-arg_. More +details can be found [here][macos-kext-dev-mode]. +* For macOS 10.11 and later, the solution is to turn off System Integrity +Protection (SIP). More details can be found [here][macos-sip-disable]. + +To load the test kext: +1. Make sure no other HAXM kext is loaded. If the output of +`kextstat | grep intelhaxm` is not empty, you must unload the existing HAXM kext +first: `sudo kextunload -b com.intel.kext.intelhaxm` +1. `sudo chown -R root:wheel /path/to/intelhaxm.kext` +1. `sudo chmod -R 755 /path/to/intelhaxm.kext` +1. `sudo kextload /path/to/intelhaxm.kext` + * Note that `kextload` can load a kext from any folder, so there is no need +to copy the test kext to `/Library/Extensions/` first. + +To unload the test kext: +1. `sudo kextunload /path/to/intelhaxm.kext` +1. Optionally, you may want to restore the original HAXM kext, which is usually +the signed one installed to `/Library/Extensions/`: +`sudo kextload /Library/Extensions/intelhaxm.kext` + +### Viewing kext logs +On macOS, HAXM debug output goes to the system log database, and can be +retrieved at almost any time. + +* On OS X 10.10, HAXM log messages are written immediately to +`/var/log/system.log`. You can monitor this file for real-time updates using +_Console.app_ or the `syslog -w` command. +* On macOS 10.11 or later, HAXM log messages are no longer written to +`/var/log/system.log`, and there is no good way to capture them in real time. +However, you can still retrieve them at a later time using one of the following +methods: + 1. `log show --predicate 'sender == "intelhaxm"' --style syslog --last 1h`, +which is complex but very flexible. In this example, `--last 1h` indicates the +past hour, and can be replaced with other queries. + 1. `sudo dmesg | grep hax`, which is simple, but does not show the timestamp +of each message. + +[osx-sdks]: https://github.com/phracker/MacOSX-SDKs +[macos-kext-dev-mode]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html +[macos-sip-disable]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html diff --git a/docs/manual-windows.md b/docs/manual-windows.md new file mode 100644 index 00000000..f605ad48 --- /dev/null +++ b/docs/manual-windows.md @@ -0,0 +1,137 @@ +## Building for Windows +### Prerequisites + +**Option A (Visual Studio)** +* [Visual Studio 2017][visualstudio] + * Install at least the following components: +_Universal Windows Platform development_, _Desktop development with C++_. +* [Windows SDK for Windows 10][sdk10] +* [Windows Driver Kit (WDK) for Windows 10][wdk10] + +Note that the version/build number of Windows SDK must match that of WDK. +In particular, the Windows 10 SDK installed by Visual Studio 2017 (version 1709, +build 10.0.16299 as of this writing) may not be the latest version. If you want +to use the latest WDK (version 1803 as of this writing), you may need to +download and install the latest Windows 10 SDK (version 1803, build 10.0.17134 +as of this writing). + +**Option B (EWDK)** +* [Enterprise WDK (EWDK) 10][ewdk10] with Visual Studio Build Tools 15.6 + * Install the downloaded ISO image by mounting it or extracting it to an empty +folder. +* [NuGet CLI tool][nuget] (`nuget.exe`) version 4.x or later + +### Build steps +**Option A (Visual Studio)** +1. Open `platforms\windows\haxm.sln` in Visual Studio 2017. +1. Select either `Debug` or `Release` configuration. + * The `Debug` configuration also signs the driver with a test certificate. +The `Release` configuration does not do that. +1. Select either `x64` or `Win32` platform. +1. Build solution. + +**Option B (EWDK)** +1. `cd X:\path\to\EWDK\` +1. `LaunchBuildEnv.cmd` +1. `cd X:\path\to\haxm\` +1. `cd platforms\windows` +1. `X:\path\to\nuget.exe restore` +1. `msbuild haxm.sln /p:Configuration="Debug" /p:Platform="x64"` + * Use `Release` instead of `Debug` to build an optimized driver that is +suitable for release. Note that the `Release` configuration does not sign the +driver with a test certificate. + * Use `Win32` instead of `x64` to build a 32-bit driver that works on 32-bit +Windows. + * Add `/t:rebuild` for a clean rebuild instead of an incremental build. + +If successful, the driver binary (`IntelHaxm.sys`) will be generated in +`X:\path\to\haxm\platforms\windows\build\out\x64\{Debug,Release}\` (or +`X:\path\to\haxm\platforms\windows\build\out\Win32\{Debug,Release}\` if +`Platform="Win32"`), and will be able to run on Windows 7 and later. + +## Testing on Windows +### System requirements +Note that these are requirements for the _test_ environment, which does not +have to be the same as the _build_ environment. + +1. An Intel CPU that supports Intel VT-x with _Extended Page Tables_ (EPT). + * [Here][intel-ept-cpus] is a list of CPUs that meet this requirement. As a +rule of thumb, if you have an Intel Core i3, i5, i7 or i9 (any generation), you +are good to go. + * EPT is an advanced feature of Intel VT-x. CPUs that support EPT also +support _Unrestricted Guest_ (UG), which is another advanced feature of VT-x. +It may still be possible to run HAXM on very old (pre-2010) CPUs, e.g. +Intel Core 2 Duo, which implement an earlier version of VT-x that does not +include either EPT or UG. However, the legacy code that enables HAXM to work in +non-EPT and non-UG modes may be removed soon. +1. Windows 7 or later; both 32-bit and 64-bit Windows are supported. + * Running HAXM in a nested virtualization setup, where Windows itself runs as +a guest OS on another hypervisor, may be possible, but this use case is not well +tested. + +### One-time setup +The following steps prepare the test environment for installing a test-signed +`IntelHaxm.sys`, i.e. one that is built using the `Debug` configuration. For +more details, please read [this article][windows-test-driver-install]. + +1. Disable Hyper-V and enable _Test Mode_: + 1. Open an **elevated** (i.e. _Run as administrator_) Command Prompt. + 1. `bcdedit /set hypervisorlaunchtype off` + 1. `bcdedit /set testsigning on` + 1. Reboot. +1. Install the test certificate: + 1. Copy `IntelHaxm.cer` from the build environment to the test environment +(if the two are not the same). This file is generated alongside `IntelHaxm.sys` +by the `Debug` build configuration. + 1. In the test environment, open an **elevated** Command Prompt and run +`certmgr /add X:\path\to\IntelHaxm.cer /s /r localMachine root` +1. Optionally, install [DebugView][debugview] to capture HAXM debug output. + +### Loading and unloading the test driver +`HaxmLoader` is a small tool that can load and unload a test-signed driver +without using an INF file. You can download it from the +[Releases][github-haxm-releases] page, or building `HaxmLoader/HaxmLoader.sln` +yourself using Visual Studio or EWDK. + +Basically, kernel-mode drivers like HAXM are managed by Windows Service Control +Manager as services. Each such service has a unique name, a corresponding driver +file, and a state. For example, when the HAXM installer installs the +release-signed driver to `C:\Windows\System32\drivers\IntelHaxm.sys`, it also +creates a service for it. This service is named `intelhaxm` and is started at +boot time. `HaxmLoader` works in a similar manner: when loading a test driver, +it creates a temporary service and starts it; when unloading the test driver, it +stops and then deletes the service. + +To load the test driver: +1. Open an **elevated** Command Prompt. +1. Make sure no other HAXM driver is loaded. + 1. If `sc query intelhaxm` shows the `intelhaxm` service as `RUNNING`, you +must stop it first: `sc stop intelhaxm` + 1. Otherwise, unload the previously loaded test driver, if any: +`HaxmLoader.exe -u` +1. Load the test driver: `HaxmLoader.exe -i X:\path\to\IntelHaxm.sys` + * Note that `HaxmLoader` can load a driver from any folder, so there is no +need to copy the test driver to `C:\Windows\System32\drivers\` first. + +To unload the test driver: +1. Open an **elevated** Command Prompt. +1. `HaxmLoader.exe -u` +1. Optionally, you may want to restore the original, release-signed driver +(i.e. `C:\Windows\System32\drivers\IntelHaxm.sys`): `sc start intelhaxm` + +### Capturing driver logs +1. Launch DebugView (`Dbgview.exe`) as administrator. +1. In the _Capture_ menu, select everything except _Log Boot_. DebugView will +now start capturing debug output from all kernel-mode drivers. +1. In order to filter out non-HAXM logs, go to _Edit_ > _Filter/Highlight..._, +enter `hax*` for _Include_, and click on _OK_. + +[visualstudio]: https://www.visualstudio.com/downloads/ +[ewdk10]: https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/using-the-enterprise-wdk +[sdk10]: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk +[wdk10]: https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk +[nuget]: https://www.nuget.org/downloads +[intel-ept-cpus]: https://ark.intel.com/Search/FeatureFilter?productType=processors&ExtendedPageTables=true +[windows-test-driver-install]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/installing-test-signed-driver-packages +[debugview]: https://docs.microsoft.com/en-us/sysinternals/downloads/debugview +[github-haxm-releases]: https://github.com/intel/haxm/releases From 3e21ff4f3099f3d30c729eb04a54f110941d4374 Mon Sep 17 00:00:00 2001 From: Alexandro Sanchez Bach Date: Thu, 25 Oct 2018 10:17:26 +0200 Subject: [PATCH 5/5] Fixed tests and include paths in Windows sources Signed-off-by: Alexandro Sanchez Bach --- core/include/emulate.h | 4 ---- include/hax_types.h | 4 ++++ platforms/windows/hax_host_mem.c | 6 +++--- platforms/windows/hax_win.h | 2 +- platforms/windows/hax_wrapper.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/include/emulate.h b/core/include/emulate.h index 2711c443..b3e396de 100644 --- a/core/include/emulate.h +++ b/core/include/emulate.h @@ -31,11 +31,7 @@ #ifndef HAX_CORE_EMULATE_H_ #define HAX_CORE_EMULATE_H_ -#ifdef HAX_TESTS -#include -#else #include "../../include/hax_types.h" -#endif #include "emulate_ops.h" diff --git a/include/hax_types.h b/include/hax_types.h index 2fa74285..e3b44471 100644 --- a/include/hax_types.h +++ b/include/hax_types.h @@ -62,6 +62,7 @@ #endif /* Detect platform */ +#ifndef HAX_TESTS // Prevent kernel-only exports from reaching userland code // MacOS #if defined(__MACH__) #define HAX_PLATFORM_DARWIN @@ -73,6 +74,9 @@ #else #error "Unsupported platform" #endif +#else // !HAX_TESTS +#include +#endif // HAX_TESTS #define HAX_PAGE_SIZE 4096 #define HAX_PAGE_SHIFT 12 diff --git a/platforms/windows/hax_host_mem.c b/platforms/windows/hax_host_mem.c index 51d8ae07..769fa676 100644 --- a/platforms/windows/hax_host_mem.c +++ b/platforms/windows/hax_host_mem.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../include/hax_host_mem.h" -#include "../include/hax.h" -#include "../core/include/paging.h" +#include "../../include/hax_host_mem.h" +#include "../../include/hax.h" +#include "../../core/include/paging.h" int hax_pin_user_pages(uint64_t start_uva, uint64_t size, hax_memdesc_user *memdesc) { diff --git a/platforms/windows/hax_win.h b/platforms/windows/hax_win.h index ce5cc282..8625dd85 100644 --- a/platforms/windows/hax_win.h +++ b/platforms/windows/hax_win.h @@ -35,7 +35,7 @@ #include #include #include "hax_core_interface.h" -#include "..\hax_interface.h" +#include "../../include/hax_interface.h" #include "hax_types_windows.h" #include "hax_entry.h" #include "hax_event_win.h" diff --git a/platforms/windows/hax_wrapper.c b/platforms/windows/hax_wrapper.c index a912c849..c62ffd93 100644 --- a/platforms/windows/hax_wrapper.c +++ b/platforms/windows/hax_wrapper.c @@ -29,7 +29,7 @@ */ #include "hax_win.h" -#include "../core/include/ia32.h" +#include "../../core/include/ia32.h" int default_hax_log_level = 3; int max_cpus;