diff options
author | SaeHie Park <saehie.park@gmail.com> | 2016-11-22 21:55:26 +0900 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2016-11-22 13:55:26 +0100 |
commit | d4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f (patch) | |
tree | 26089e2d4f6bb48212e1ce99055f1e8e258d9861 | |
parent | b78b71f220ccb28eb6a5f9ea903536bdb6cd3f3d (diff) | |
download | coreclr-d4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f.tar.gz coreclr-d4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f.tar.bz2 coreclr-d4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f.zip |
[x86/Linux] fix and add for x86 cmake configuration (#8219)
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
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rwxr-xr-x | cross/build-rootfs.sh | 7 | ||||
-rw-r--r-- | cross/x86/sources.list.trusty | 11 | ||||
-rw-r--r-- | cross/x86/sources.list.vivid | 11 | ||||
-rw-r--r-- | cross/x86/sources.list.wily | 11 | ||||
-rw-r--r-- | cross/x86/sources.list.xenial | 11 | ||||
-rw-r--r-- | cross/x86/toolchain.cmake | 40 | ||||
-rw-r--r-- | cross/x86/tryrun.cmake | 127 | ||||
-rw-r--r-- | src/debug/ee/i386/dbghelpers.S | 70 | ||||
-rw-r--r-- | src/debug/ee/wks/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/pal/src/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/vm/i386/unixstubs.cpp | 90 |
13 files changed, 402 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore index b3ac01be87..ea3e8ea147 100644 --- a/.gitignore +++ b/.gitignore @@ -295,6 +295,8 @@ Makefile # Cross compilation cross/rootfs/* +# add x86 as it is ignored in 'Build results' +!cross/x86 #python import files *.pyc diff --git a/CMakeLists.txt b/CMakeLists.txt index 610f89b821..702d177325 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cross/build-rootfs.sh b/cross/build-rootfs.sh index 5caf208b11..cfa1a66f4a 100755 --- a/cross/build-rootfs.sh +++ b/cross/build-rootfs.sh @@ -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/cross/x86/sources.list.trusty b/cross/x86/sources.list.trusty new file mode 100644 index 0000000000..9b3085436e --- /dev/null +++ b/cross/x86/sources.list.trusty @@ -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/cross/x86/sources.list.vivid b/cross/x86/sources.list.vivid new file mode 100644 index 0000000000..26d37b20fc --- /dev/null +++ b/cross/x86/sources.list.vivid @@ -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/cross/x86/sources.list.wily b/cross/x86/sources.list.wily new file mode 100644 index 0000000000..c4b0b442ab --- /dev/null +++ b/cross/x86/sources.list.wily @@ -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/cross/x86/sources.list.xenial b/cross/x86/sources.list.xenial new file mode 100644 index 0000000000..ad9c5a0144 --- /dev/null +++ b/cross/x86/sources.list.xenial @@ -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/cross/x86/toolchain.cmake b/cross/x86/toolchain.cmake new file mode 100644 index 0000000000..63c64875fa --- /dev/null +++ b/cross/x86/toolchain.cmake @@ -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/cross/x86/tryrun.cmake b/cross/x86/tryrun.cmake new file mode 100644 index 0000000000..cfc52087c2 --- /dev/null +++ b/cross/x86/tryrun.cmake @@ -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/debug/ee/i386/dbghelpers.S b/src/debug/ee/i386/dbghelpers.S new file mode 100644 index 0000000000..d0a11011ca --- /dev/null +++ b/src/debug/ee/i386/dbghelpers.S @@ -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 diff --git a/src/debug/ee/wks/CMakeLists.txt b/src/debug/ee/wks/CMakeLists.txt index a096cbfca7..2b1aff57a1 100644 --- a/src/debug/ee/wks/CMakeLists.txt +++ b/src/debug/ee/wks/CMakeLists.txt @@ -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}) diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 74f16aa599..a51fe93523 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -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/vm/i386/unixstubs.cpp b/src/vm/i386/unixstubs.cpp new file mode 100644 index 0000000000..e7f49577e4 --- /dev/null +++ b/src/vm/i386/unixstubs.cpp @@ -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) + { + } +}; |