summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSaeHie Park <saehie.park@gmail.com>2016-11-22 21:55:26 +0900
committerJan Vorlicek <janvorli@microsoft.com>2016-11-22 13:55:26 +0100
commitd4b1a7473dcaa7ed9ead85ce3ff0fb39e1d5059f (patch)
tree26089e2d4f6bb48212e1ce99055f1e8e258d9861 /src
parentb78b71f220ccb28eb6a5f9ea903536bdb6cd3f3d (diff)
downloadcoreclr-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
Diffstat (limited to 'src')
-rw-r--r--src/debug/ee/i386/dbghelpers.S70
-rw-r--r--src/debug/ee/wks/CMakeLists.txt4
-rw-r--r--src/pal/src/CMakeLists.txt12
-rw-r--r--src/vm/i386/unixstubs.cpp90
4 files changed, 173 insertions, 3 deletions
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)
+ {
+ }
+};