Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 104674)
+++ /trunk/Config.kmk	(revision 104675)
@@ -559,5 +559,5 @@
 VBOX_WITH_DBGF_FLOW_TRACING = 1
 # Enables ARMv8 virtualization, see @bugref{10383}
-if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64)
+if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64 win.arm64)
  VBOX_WITH_VIRT_ARMV8 = 1
 endif
@@ -781,5 +781,5 @@
 # On Linux we build this as a test case instead.
 # On darwin we don't use a support driver.
-if "$(KBUILD_TARGET)" != "linux" && "$(KBUILD_TARGET)" != "darwin"
+if "$(KBUILD_TARGET)" != "linux" && "$(KBUILD_TARGET)" != "darwin" && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" != "win.arm64"
  VBOX_WITH_VBOXDRV = 1
 endif
@@ -1949,6 +1949,8 @@
    VBOX_GCC_TOOL := MINGW32
    TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
-  else
+  else ifeq ($(KBUILD_TARGET_ARCH),amd64)
    VBOX_GCC_TOOL := MINGWW64
+  else_ifeq ($(KBUILD_TARGET_ARCH),arm64)
+   VBOX_GCC_TOOL := CLANGVCC143ARM64
   endif
  else ifeq ($(KBUILD_TARGET),os2)
@@ -1998,10 +2000,14 @@
 ifndef VBOX_VCC_TOOL_STEM
  ifdef VBOX_WITH_NEW_VCC
-  VBOX_VCC_TOOL_STEM := VCC142
+  ifeq ($(KBUILD_TARGET_ARCH),arm64)
+   VBOX_VCC_TOOL_STEM := VCC143
+  else
+   VBOX_VCC_TOOL_STEM := VCC142
+  endif
  else
   VBOX_VCC_TOOL_STEM := VCC100
  endif
-else ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120 VCC140 VCC141 VCC142)
- $(error VBox: VBOX_VCC_TOOL_STEM='$(VBOX_VCC_TOOL_STEM)' is not supported, only VCC100, VCC110, VCC120, VCC140, VCC141, VCC142 are)
+else ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120 VCC140 VCC141 VCC142 VCC143)
+ $(error VBox: VBOX_VCC_TOOL_STEM='$(VBOX_VCC_TOOL_STEM)' is not supported, only VCC100, VCC110, VCC120, VCC140, VCC141, VCC142, VCC143 are)
 endif
 ifndef VBOX_VCC_TOOL
@@ -2018,5 +2024,5 @@
   VBOX_NEWER_VCC_TOOL_STEM := VCC120
  endif
-else ifn1of ($(VBOX_NEWER_VCC_TOOL_STEM), VCC120 VCC140 VCC141 VCC142)
+else ifn1of ($(VBOX_NEWER_VCC_TOOL_STEM), VCC120 VCC140 VCC141 VCC142 VCC143)
  $(error VBox: VBOX_NEWER_VCC_TOOL_STEM='$(VBOX_NEWER_VCC_TOOL_STEM)' is not supported)
 endif
@@ -3224,14 +3230,16 @@
  # Note! Changes in GCC are not detected automatically (yet).
  #
- if $(pos VBox,$(VBOX_GCC_TOOL)) > 0
-  include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC_TOOL).kmk
- else
-  include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
- endif
- ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
-  if $(pos VBox,$(VBOX_GCC32_TOOL)) > 0
-   include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC32_TOOL).kmk
+ ifneq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.arm64)
+  if $(pos VBox,$(VBOX_GCC_TOOL)) > 0
+   include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC_TOOL).kmk
   else
-   include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
+   include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
+  endif
+  ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
+   if $(pos VBox,$(VBOX_GCC32_TOOL)) > 0
+    include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC32_TOOL).kmk
+   else
+    include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
+   endif
   endif
  endif
@@ -3436,5 +3444,7 @@
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CC               ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CC))'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CXX              ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CXX))'
+ ifneq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.arm64)
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_LIBGCC                ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
+ endif
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign      ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-array_bounds      ?= $(call VBOX_GCC_CHECK_CC,-Wno-array-bounds,)'
@@ -5257,4 +5267,5 @@
 SDK_VBoxNtDll_LIBS.x86        ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-x86.lib
 SDK_VBoxNtDll_LIBS.amd64      ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-amd64.lib
+SDK_VBoxNtDll_LIBS.arm64      ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-arm64.lib
 
 #
@@ -5266,4 +5277,5 @@
  SDK_VBoxWinNewDevLib_LIBS.x86   = $(PATH_SDK_$(VBOX_WINPSDK)_LIB.x86)/newdev.lib
  SDK_VBoxWinNewDevLib_LIBS.amd64 = $(PATH_SDK_$(VBOX_WINPSDK)_LIB.amd64)/newdev.lib
+ SDK_VBoxWinNewDevLib_LIBS.arm64 = $(PATH_SDK_$(VBOX_WINPSDK)_LIB.arm64)/newdev.lib
 else
  SDK_VBoxWinNewDevLib_LIBS.x86   = $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/newdev.lib
@@ -6294,4 +6306,5 @@
  TEMPLATE_VBoxR3Exe_TOOL.win.x86       = $(VBOX_VCC_TOOL_STEM)X86
  TEMPLATE_VBoxR3Exe_TOOL.win.amd64     = $(VBOX_VCC_TOOL_STEM)AMD64
+ TEMPLATE_VBoxR3Exe_TOOL.win.arm64     = $(VBOX_VCC_TOOL_STEM)ARM64
  TEMPLATE_VBoxR3Exe_RCDEFS             = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
  if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
@@ -6358,4 +6371,9 @@
   	$(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.amd64)_LIB)/oldnames.lib
+  TEMPLATE_VBoxR3Exe_LIBS.arm64         = \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.arm64)_LIB)/vcruntime$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.arm64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.arm64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.arm64)_LIB)/oldnames.lib
   ifeq ($(KBUILD_TYPE),asan)
    TEMPLATE_VBoxR3Exe_LIBS.x86         += \
@@ -6690,4 +6708,9 @@
    	$(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
    	$(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/oldnames.lib
+   TEMPLATE_VBoxR3StaticBase_LIBS.arm64        = \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/libvcruntime$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/oldnames.lib
   endif
   ifeq ($(KBUILD_TYPE),asan)
@@ -6712,4 +6735,8 @@
    	$(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
    	$(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/oldnames.lib
+   TEMPLATE_VBoxR3StaticBase_LIBS.arm64        = \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.arm64)_LIB)/oldnames.lib
   endif
  endif
@@ -7245,4 +7272,5 @@
  TEMPLATE_VBoxMainExe_TOOL.win.x86       = $(VBOX_VCC_TOOL_STEM)X86
  TEMPLATE_VBoxMainExe_TOOL.win.amd64     = $(VBOX_VCC_TOOL_STEM)AMD64
+ TEMPLATE_VBoxMainExe_TOOL.win.arm64     = $(VBOX_VCC_TOOL_STEM)ARM64
  if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
   TEMPLATE_VBoxMainExe_SDKS              = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) $(VBOX_WINPSDK) $(VBOX_WINDDK)
@@ -7315,4 +7343,9 @@
   	$(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.amd64)_LIB)/oldnames.lib
+  TEMPLATE_VBoxMainExe_LIBS.arm64         = \
+    $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.arm64)_LIB)/vcruntime$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.arm64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.arm64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.arm64)_LIB)/oldnames.lib
   ifeq ($(KBUILD_TYPE),asan)
    TEMPLATE_VBoxMainExe_LIBS.x86         += \
@@ -8791,4 +8824,8 @@
   	$(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
+  TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS.arm64         = \
+    $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.arm64)_LIB)/oldnames.lib \
+    $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.arm64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
+    $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.arm64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
  endif # !VBOX_WITH_NOCRT_STATIC
  # Hack end
