[x86/Linux] fix and add for x86 cmake configuration (dotnet/coreclr#8219)
authorSaeHie Park <saehie.park@gmail.com>
Tue, 22 Nov 2016 12:55:26 +0000 (21:55 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 22 Nov 2016 12:55:26 +0000 (13:55 +0100)
This patch will add x86 part for cross build
- add x86 in build-rootfs and related cross files
- add x86 parts in CMakeLists.txt to pass configuration
- add required source files to pass configuration

Commit migrated from https://github.com/dotnet/coreclr/commit/d4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f

12 files changed:
src/coreclr/CMakeLists.txt
src/coreclr/cross/build-rootfs.sh
src/coreclr/cross/x86/sources.list.trusty [new file with mode: 0644]
src/coreclr/cross/x86/sources.list.vivid [new file with mode: 0644]
src/coreclr/cross/x86/sources.list.wily [new file with mode: 0644]
src/coreclr/cross/x86/sources.list.xenial [new file with mode: 0644]
src/coreclr/cross/x86/toolchain.cmake [new file with mode: 0644]
src/coreclr/cross/x86/tryrun.cmake [new file with mode: 0644]
src/coreclr/src/debug/ee/i386/dbghelpers.S [new file with mode: 0644]
src/coreclr/src/debug/ee/wks/CMakeLists.txt
src/coreclr/src/pal/src/CMakeLists.txt
src/coreclr/src/vm/i386/unixstubs.cpp [new file with mode: 0644]

index 610f89b..702d177 100644 (file)
@@ -104,6 +104,8 @@ else (WIN32)
       if (DEFINED ENV{CROSSCOMPILE})
         if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
           find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+          find_program(OBJCOPY objcopy)
         else()
           clr_unknown_arch()
         endif()
@@ -135,6 +137,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
         set(CLR_CMAKE_PLATFORM_UNIX_ARM 1)
     elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
         set(CLR_CMAKE_PLATFORM_UNIX_ARM64 1)
+    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+        set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
     else()
         clr_unknown_arch()
     endif()
@@ -215,6 +219,9 @@ elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
 elseif(CLR_CMAKE_PLATFORM_UNIX_AMD64)
   set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
   set(CLR_CMAKE_HOST_ARCH "x64")
+elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+  set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+  set(CLR_CMAKE_HOST_ARCH "x86")
 elseif(WIN32)
   # CLR_CMAKE_HOST_ARCH is passed in as param to cmake
   if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
@@ -445,6 +452,9 @@ if (CLR_CMAKE_PLATFORM_UNIX)
     elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
       message("Detected Linux ARM64")
       add_definitions(-DLINUX64)
+    elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+      message("Detected Linux i686")
+      add_definitions(-DLINUX32)
     else()
       clr_unknown_arch()
     endif()
index 5caf208..cfa1a66 100755 (executable)
@@ -3,7 +3,7 @@
 usage()
 {
     echo "Usage: $0 [BuildArch] [UbuntuCodeName] [lldbx.y]"
-    echo "BuildArch can be: arm(default), arm-softfp, arm64"
+    echo "BuildArch can be: arm(default), arm-softfp, arm64, x86"
     echo "UbuntuCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily, xenial. If BuildArch is arm-softfp, UbuntuCodeName is ignored."
     echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8"
 
@@ -43,6 +43,11 @@ for i in "$@"
             __UbuntuRepo="http://ftp.debian.org/debian/"
             __UbuntuCodeName=jessie
             ;;
+        x86)
+            __BuildArch=x86
+            __UbuntuArch=i386
+            __UbuntuRepo="http://archive.ubuntu.com/ubuntu/"
+            ;;
         lldb3.6)
             __LLDB_Package="lldb-3.6-dev"
             ;;
diff --git a/src/coreclr/cross/x86/sources.list.trusty b/src/coreclr/cross/x86/sources.list.trusty
new file mode 100644 (file)
index 0000000..9b30854
--- /dev/null
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
diff --git a/src/coreclr/cross/x86/sources.list.vivid b/src/coreclr/cross/x86/sources.list.vivid
new file mode 100644 (file)
index 0000000..26d37b2
--- /dev/null
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ vivid main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
diff --git a/src/coreclr/cross/x86/sources.list.wily b/src/coreclr/cross/x86/sources.list.wily
new file mode 100644 (file)
index 0000000..c4b0b44
--- /dev/null
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ wily main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ wily main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ wily-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ wily-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse
diff --git a/src/coreclr/cross/x86/sources.list.xenial b/src/coreclr/cross/x86/sources.list.xenial
new file mode 100644 (file)
index 0000000..ad9c5a0
--- /dev/null
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
diff --git a/src/coreclr/cross/x86/toolchain.cmake b/src/coreclr/cross/x86/toolchain.cmake
new file mode 100644 (file)
index 0000000..63c6487
--- /dev/null
@@ -0,0 +1,40 @@
+
+set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR i686)
+
+add_compile_options("-m32")
+add_compile_options("--sysroot=${CROSS_ROOTFS}")
+add_compile_options("-Wno-error=unused-command-line-argument")
+
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/i686-linux-gnu")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/i386-linux-gnu")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -m32")
+
+set(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS}    ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+
+set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}")
+if(LLVM_CROSS_DIR)
+    set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "")
+    set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "")
+    set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "")
+    set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "")
+else()
+    set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "")
+    set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include")
+    if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}")
+        set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}")
+    else()
+        set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include")
+    endif()
+endif()
diff --git a/src/coreclr/cross/x86/tryrun.cmake b/src/coreclr/cross/x86/tryrun.cmake
new file mode 100644 (file)
index 0000000..cfc5208
--- /dev/null
@@ -0,0 +1,127 @@
+SET( REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SSCANF_SUPPORT_ll_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_SCHED_GET_PRIORITY_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_WORKING_GETTIMEOFDAY_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_WORKING_CLOCK_GETTIME_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_MONOTONIC_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_MMAP_DEV_ZERO_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SEM_INIT_MODIFIES_ERRNO_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ACOS_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ASIN_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_POW_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_VALID_NEGATIVE_INF_POW_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_VALID_POSITIVE_INF_POW_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ATAN2_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_LOG_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_LOG10_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( UNGETC_NOT_RETURN_EOF_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAS_POSIX_SEMAPHORES_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( GETPWUID_R_SETS_ERRNO_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_THREAD_CPUTIME_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_SCHED_GETCPU_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_CTL_EXITCODE
+     1
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_MAPS_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_STAT_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_STATUS_EXITCODE
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES
+     0
+     CACHE STRING "Result from TRY_RUN" FORCE)
diff --git a/src/coreclr/src/debug/ee/i386/dbghelpers.S b/src/coreclr/src/debug/ee/i386/dbghelpers.S
new file mode 100644 (file)
index 0000000..d0a1101
--- /dev/null
@@ -0,0 +1,70 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.intel_syntax noprefix
+#include "unixasmmacros.inc"
+
+//extern FuncEvalHijackWorker:proc
+
+// @dbgtodo- once we port Funceval, use the ExceptionHijack stub instead of this func-eval stub.
+NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix
+        push eax        // the ptr to the DebuggerEval
+        call C_FUNC(FuncEvalHijackWorker)
+        jmp  eax        // return is the patch addresss to jmp to
+
+NESTED_END FuncEvalHijack, _TEXT
+
+//
+// Flares for interop debugging.
+// Flares are exceptions (breakpoints) at well known addresses which the RS
+// listens for when interop debugging.
+//
+
+// This exception is from managed code.
+LEAF_ENTRY SignalHijackStartedFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,1
+        ret
+LEAF_END SignalHijackStartedFlare, _TEXT
+
+// Start the handoff
+LEAF_ENTRY ExceptionForRuntimeHandoffStartFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,2
+        ret
+LEAF_END ExceptionForRuntimeHandoffStartFlare, _TEXT
+
+// Finish the handoff.
+LEAF_ENTRY ExceptionForRuntimeHandoffCompleteFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,3
+        ret
+LEAF_END ExceptionForRuntimeHandoffCompleteFlare, _TEXT
+
+// Signal execution return to unhijacked state
+LEAF_ENTRY SignalHijackCompleteFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,4
+        ret
+LEAF_END SignalHijackCompleteFlare, _TEXT
+
+// This exception is from unmanaged code.
+LEAF_ENTRY ExceptionNotForRuntimeFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,5
+        ret
+LEAF_END ExceptionNotForRuntimeFlare, _TEXT
+
+// The Runtime is synchronized.
+LEAF_ENTRY NotifyRightSideOfSyncCompleteFlare, _TEXT
+        int 3
+        // make sure that the basic block is unique
+        test eax,6
+        ret
+LEAF_END NotifyRightSideOfSyncCompleteFlare, _TEXT
index a096cbf..2b1aff5 100644 (file)
@@ -55,9 +55,7 @@ else ()
 
 add_compile_options(-fPIC)
 
-if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
-  add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
-elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_I386)
   add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
 elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
   add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS})
index 74f16aa..a51fe93 100644 (file)
@@ -32,6 +32,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
   set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
   add_definitions(-D_ARM64_)
+elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+  set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+  add_definitions(-D_X86_)
 else()
   message(FATAL_ERROR "Only ARM and AMD64 is supported")
 endif()
@@ -61,6 +64,8 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM)
 elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
   add_definitions(-DBIT64=1)
   add_definitions(-D_WIN64=1)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+  add_definitions(-DBIT32=1)
 endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_PLATFORM_ALPINE_LINUX)
@@ -99,6 +104,13 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
     arch/arm64/exceptionhelper.S
     arch/arm64/processor.cpp
   )
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+  set(ARCH_SOURCES
+    #arch/i386/context2.S
+    #arch/i386/debugbreak.S
+    #arch/i386/exceptionhelper.S
+    arch/i386/processor.cpp
+  )
 endif()
 
 if(PAL_CMAKE_PLATFORM_ARCH_ARM)
diff --git a/src/coreclr/src/vm/i386/unixstubs.cpp b/src/coreclr/src/vm/i386/unixstubs.cpp
new file mode 100644 (file)
index 0000000..e7f4957
--- /dev/null
@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "common.h"
+
+extern "C"
+{
+    void RedirectForThrowControl()
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void NakedThrowHelper()
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void PInvokeStubForHost()
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void PInvokeStubForHostInner(DWORD dwStackSize, LPVOID pStackFrame, LPVOID pTarget)
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void ProfileEnterNaked(FunctionIDOrClientID functionIDOrClientID)    
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void ProfileLeaveNaked(FunctionIDOrClientID functionIDOrClientID)
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    void ProfileTailcallNaked(FunctionIDOrClientID functionIDOrClientID)
+    {
+        PORTABILITY_ASSERT("Implement for PAL");
+    }
+
+    DWORD getcpuid(DWORD arg, unsigned char result[16])
+    {
+        DWORD eax;
+        __asm("  xor %%ecx, %%ecx\n" \
+              "  cpuid\n" \
+              "  mov %%eax, 0(%[result])\n" \
+              "  mov %%ebx, 4(%[result])\n" \
+              "  mov %%ecx, 8(%[result])\n" \
+              "  mov %%edx, 12(%[result])\n" \
+            : "=a"(eax) /*output in eax*/\
+            : "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
+            : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+          );
+        return eax;
+    }
+    
+    DWORD getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16])
+    {
+        DWORD eax;
+        __asm("  cpuid\n" \
+              "  mov %%eax, 0(%[result])\n" \
+              "  mov %%ebx, 4(%[result])\n" \
+              "  mov %%ecx, 8(%[result])\n" \
+              "  mov %%edx, 12(%[result])\n" \
+            : "=a"(eax) /*output in eax*/\
+            : "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
+            : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+          );
+        return eax;
+    }
+
+    DWORD xmmYmmStateSupport()
+    {
+        DWORD eax;
+        __asm("  xgetbv\n" \
+            : "=a"(eax) /*output in eax*/\
+            : "c"(0) /*inputs - 0 in ecx*/\
+            : "eax", "edx" /* registers that are clobbered*/
+          );
+        // check OS has enabled both XMM and YMM state support
+        return ((eax & 0x06) == 0x06) ? 1 : 0;
+    }
+    
+    void STDCALL JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
+    {
+    }
+};