Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdeel <adeelbm@outlook.com>2017-10-04 23:49:24 +0300
committerAdeel <adeelbm@outlook.com>2017-10-04 23:49:24 +0300
commit753c19b595773f4fabbba09ef184385324271d45 (patch)
tree4aa695538ab8c41d4aa48ed16635f90e4e5d7663 /src/Native
parent72a64d72d9d07dc2b9085a22129e3361c7b34dcd (diff)
Enable x86 support for Unix
Also enabled cross compilation of x86 binaries on x64 host. Ubuntu Dockerfiles: <details> <summary><b><ins>Baseline: x64 build on x64 host</ins></b></summary> ```dockerfile FROM ubuntu RUN cat /etc/*-release RUN apt-get update RUN apt-get install -y \ autoconf bash clang cmake gcc libtool curl \ libunwind-dev llvm make openssl lldb git uuid-dev RUN git clone https://github.com/dotnet/corert -b master --single-branch WORKDIR /corert RUN ./build.sh # or ./build.sh x64 ``` </details> <details> <summary><b><ins>PR: x86 build on x86 host</ins></b></summary> ```dockerfile FROM i386/ubuntu RUN cat /etc/*-release RUN apt-get update RUN apt-get install -y \ bash clang cmake gcc libtool curl \ libunwind-dev llvm make openssl lldb git uuid-dev RUN git clone https://github.com/am11/corert -b linux-x86 --single-branch WORKDIR /corert RUN ./build.sh x86 ``` </details> <details> <summary><b><ins>PR: x86 build on x64 host</ins></b></summary> ```dockerfile FROM ubuntu RUN cat /etc/*-release RUN apt-get update RUN apt-get install -y \ bash clang cmake gcc libtool curl \ libunwind-dev llvm make openssl lldb git uuid-dev \ g++-multilib RUN git clone https://github.com/am11/corert -b linux-x86 --single-branch WORKDIR /corert RUN ./build.sh x86 ``` </details>
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/CMakeLists.txt33
-rw-r--r--src/Native/Runtime/CMakeLists.txt10
-rw-r--r--src/Native/Runtime/PalRedhawk.h4
-rw-r--r--src/Native/Runtime/PalRedhawkCommon.h2
-rw-r--r--src/Native/Runtime/coreclr/bitvector.h6
-rw-r--r--src/Native/Runtime/coreclr/gcinfotypes.h17
-rw-r--r--src/Native/Runtime/gcdump.cpp2
-rw-r--r--src/Native/Runtime/i386/AllocFast.S5
-rw-r--r--src/Native/Runtime/i386/CallDescrWorker.S5
-rw-r--r--src/Native/Runtime/i386/CallingConventionConverterHelpers.S5
-rw-r--r--src/Native/Runtime/i386/ExceptionHandling.S5
-rw-r--r--src/Native/Runtime/i386/Interlocked.S5
-rw-r--r--src/Native/Runtime/i386/InteropThunksHelpers.S5
-rw-r--r--src/Native/Runtime/i386/PInvoke.S5
-rw-r--r--src/Native/Runtime/i386/StubDispatch.S5
-rw-r--r--src/Native/Runtime/i386/UniversalTransition.S5
-rw-r--r--src/Native/Runtime/i386/WriteBarriers.S5
-rw-r--r--src/Native/Runtime/inc/gcinfo.h4
-rw-r--r--src/Native/Runtime/startup.cpp2
-rw-r--r--src/Native/Runtime/unix/UnixContext.cpp22
-rwxr-xr-xsrc/Native/gen-buildsys-clang.sh1
-rw-r--r--src/Native/inc/unix/poppack.h40
-rw-r--r--src/Native/inc/unix/pshpack1.h39
-rw-r--r--src/Native/inc/unix/pshpack4.h39
-rw-r--r--src/Native/libunwind/include/__libunwind_config.h4
25 files changed, 241 insertions, 34 deletions
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt
index c486248fb..ad55c469f 100644
--- a/src/Native/CMakeLists.txt
+++ b/src/Native/CMakeLists.txt
@@ -22,11 +22,11 @@ function(clr_unknown_arch)
if (WIN32)
message(FATAL_ERROR "Only AMD64 and I386 are supported")
else()
- message(FATAL_ERROR "Only AMD64, ARM64, ARM and ARMEL are supported")
+ message(FATAL_ERROR "Only AMD64, ARM64, ARM, ARMEL and I386 are supported")
endif()
endfunction()
-if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
+if (CLR_CMAKE_TARGET_ARCH STREQUAL x64 OR CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(IS_64BIT_BUILD 1)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
add_definitions(-DBIT32=1)
@@ -60,12 +60,14 @@ endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
+ if(CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM 1)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
+ set(CLR_CMAKE_PLATFORM_UNIX_TARGET_I386 1)
else()
clr_unknown_arch()
endif()
@@ -99,10 +101,15 @@ if (CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-Wno-null-arithmetic)
add_compile_options(-Wno-null-conversion)
- if (CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
+ if (CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 OR CLR_CMAKE_PLATFORM_UNIX_TARGET_I386)
# Allow 16 byte compare-exchange
add_compile_options(-mcx16)
+ endif()
+
+ if (CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
add_definitions(-DUNIX_AMD64_ABI)
+ elseif (CLR_CMAKE_PLATFORM_UNIX_TARGET_I386)
+ add_definitions(-DUNIX_X86_ABI)
endif()
# Disable strict warning on unused functions.
@@ -122,7 +129,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_PLATFORM_DARWIN)
if(CLR_CMAKE_PLATFORM_LINUX)
- set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
+ set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
endif(CLR_CMAKE_PLATFORM_LINUX)
endif(CLR_CMAKE_PLATFORM_UNIX)
@@ -132,6 +139,8 @@ elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64)
set(CLR_CMAKE_PLATFORM_ARCH_ARM64 1)
elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
+elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_I386)
+ set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
elseif(WIN32)
if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
@@ -161,7 +170,7 @@ function(get_compile_definitions DefinitionName)
foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST)
if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$")
- # The entries that contain generator expressions must have the -D inside of the
+ # The entries that contain generator expressions must have the -D inside of the
# expression. So we transform e.g. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-D_DEBUG>
set(DEFINITION "$<$<CONFIG:${CMAKE_MATCH_1}>:-D${CMAKE_MATCH_2}>")
else()
@@ -189,8 +198,8 @@ else()
endif()
# Set the passed in RetSources variable to the list of sources with added current source directory
-# to form absolute paths.
-# The parameters after the RetSources are the input files.
+# to form absolute paths.
+# The parameters after the RetSources are the input files.
function(convert_to_absolute_path RetSources)
set(Sources ${ARGN})
foreach(Source IN LISTS Sources)
@@ -222,6 +231,10 @@ elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
else ()
message(FATAL_ERROR "Unknown build type. Set CMAKE_BUILD_TYPE to DEBUG or RELEASE.")
endif ()
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ add_compile_options(-m32)
+ link_libraries(-m32)
+endif()
endif (WIN32)
include(configure.cmake)
diff --git a/src/Native/Runtime/CMakeLists.txt b/src/Native/Runtime/CMakeLists.txt
index ecf44f0ce..24536e364 100644
--- a/src/Native/Runtime/CMakeLists.txt
+++ b/src/Native/Runtime/CMakeLists.txt
@@ -42,7 +42,7 @@ set(COMMON_RUNTIME_SOURCES
thread.cpp
threadstore.cpp
UniversalTransitionHelpers.cpp
-
+
../gc/gccommon.cpp
../gc/gceewks.cpp
../gc/gcwks.cpp
@@ -124,15 +124,15 @@ else()
)
endif()
+ set(ASM_SUFFIX S)
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
set(ARCH_SOURCES_DIR amd64)
- set(ASM_SUFFIX S)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
set(ARCH_SOURCES_DIR arm64)
- set(ASM_SUFFIX S)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
set(ARCH_SOURCES_DIR arm)
- set(ASM_SUFFIX S)
+ elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ set(ARCH_SOURCES_DIR i386)
endif()
list(APPEND RUNTIME_SOURCES_ARCH_ASM
@@ -148,7 +148,7 @@ list(APPEND RUNTIME_SOURCES_ARCH_ASM
${ARCH_SOURCES_DIR}/ExceptionHandling.${ASM_SUFFIX}
${ARCH_SOURCES_DIR}/Interlocked.${ASM_SUFFIX}
${ARCH_SOURCES_DIR}/PInvoke.${ASM_SUFFIX}
- ${ARCH_SOURCES_DIR}/InteropThunksHelpers.${ASM_SUFFIX}
+ ${ARCH_SOURCES_DIR}/InteropThunksHelpers.${ASM_SUFFIX}
${ARCH_SOURCES_DIR}/StubDispatch.${ASM_SUFFIX}
${ARCH_SOURCES_DIR}/UniversalTransition.${ASM_SUFFIX}
${ARCH_SOURCES_DIR}/WriteBarriers.${ASM_SUFFIX}
diff --git a/src/Native/Runtime/PalRedhawk.h b/src/Native/Runtime/PalRedhawk.h
index 86d0ee917..0dc30f19d 100644
--- a/src/Native/Runtime/PalRedhawk.h
+++ b/src/Native/Runtime/PalRedhawk.h
@@ -31,7 +31,7 @@
#endif
#ifndef _INC_WINDOWS
-//#ifndef DACCESS_COMPILE
+//#ifndef DACCESS_COMPILE
// There are some fairly primitive type definitions below but don't pull them into the rest of Redhawk unless
// we have to (in which case these definitions will move to CommonTypes.h).
@@ -807,7 +807,7 @@ typedef UInt32 (__stdcall *BackgroundCallback)(_In_opt_ void* pCallbackContext);
REDHAWK_PALIMPORT bool REDHAWK_PALAPI PalStartBackgroundGCThread(_In_ BackgroundCallback callback, _In_opt_ void* pCallbackContext);
REDHAWK_PALIMPORT bool REDHAWK_PALAPI PalStartFinalizerThread(_In_ BackgroundCallback callback, _In_opt_ void* pCallbackContext);
-typedef UInt32 (__stdcall *PalHijackCallback)(HANDLE hThread, _In_ PAL_LIMITED_CONTEXT* pThreadContext, _In_opt_ void* pCallbackContext);
+typedef UInt32_BOOL (*PalHijackCallback)(HANDLE hThread, _In_ PAL_LIMITED_CONTEXT* pThreadContext, _In_opt_ void* pCallbackContext);
REDHAWK_PALIMPORT UInt32 REDHAWK_PALAPI PalHijack(HANDLE hThread, _In_ PalHijackCallback callback, _In_opt_ void* pCallbackContext);
#ifdef FEATURE_ETW
diff --git a/src/Native/Runtime/PalRedhawkCommon.h b/src/Native/Runtime/PalRedhawkCommon.h
index 4edab876b..5166ad4b4 100644
--- a/src/Native/Runtime/PalRedhawkCommon.h
+++ b/src/Native/Runtime/PalRedhawkCommon.h
@@ -134,6 +134,8 @@ struct PAL_LIMITED_CONTEXT
UIntNative GetIp() const { return IP; }
UIntNative GetSp() const { return Rsp; }
UIntNative GetFp() const { return Rbp; }
+ void SetIp(UIntNative ip) { IP = ip; }
+ void SetSp(UIntNative sp) { Rsp = sp; }
#endif // _TARGET_ARM_
};
diff --git a/src/Native/Runtime/coreclr/bitvector.h b/src/Native/Runtime/coreclr/bitvector.h
index a4181dbb8..0f273dbac 100644
--- a/src/Native/Runtime/coreclr/bitvector.h
+++ b/src/Native/Runtime/coreclr/bitvector.h
@@ -12,7 +12,6 @@
#ifndef BITVECTOR_H
#define BITVECTOR_H 1
-
#ifndef LIMITED_METHOD_CONTRACT
#define LIMITED_METHOD_CONTRACT
#define UNDEF_LIMITED_METHOD_CONTRACT
@@ -60,8 +59,9 @@
class BitVector {
// Set this to be unsigned char to do testing, should be UINT_PTR for real life
- typedef UINT_PTR ChunkType; // The size of integer type that the machine can operate on directly
-// typedef BYTE ChunkType; // Use for testing
+ typedef uint32_t BOOL;
+ typedef uintptr_t ChunkType; // The size of integer type that the machine can operate on directly
+// typedef BYTE ChunkType; // Use for testing
// Maximum number of bits in our bitvector
#define MAX_PTRARG_OFS 1024
diff --git a/src/Native/Runtime/coreclr/gcinfotypes.h b/src/Native/Runtime/coreclr/gcinfotypes.h
index c802d97ec..9b949b55f 100644
--- a/src/Native/Runtime/coreclr/gcinfotypes.h
+++ b/src/Native/Runtime/coreclr/gcinfotypes.h
@@ -18,12 +18,11 @@
#define BITS_PER_SIZE_T ((int)sizeof(size_t)*8)
-
//--------------------------------------------------------------------------------
-// It turns out, that ((size_t)x) << y == x, when y is not a literal
+// It turns out, that ((size_t)x) << y == x, when y is not a literal
// and its value is BITS_PER_SIZE_T
// I guess the processor only shifts of the right operand modulo BITS_PER_SIZE_T
-// In many cases, we want the above operation to yield 0,
+// In many cases, we want the above operation to yield 0,
// hence the following macros
//--------------------------------------------------------------------------------
__forceinline size_t SAFE_SHIFT_LEFT(size_t x, size_t count)
@@ -346,7 +345,7 @@ enum infoHdrAdjustConstants {
SET_RET_KIND_MAX = 4, // 2 bits for ReturnKind
ADJ_ENCODING_MAX = 0x7f, // Maximum valid encoding in a byte
// Also used to mask off next bit from each encoding byte.
- MORE_BYTES_TO_FOLLOW = 0x80 // If the High-bit of a header or adjustment byte
+ MORE_BYTES_TO_FOLLOW = 0x80 // If the High-bit of a header or adjustment byte
// is set, then there are more adjustments to follow.
};
@@ -416,7 +415,7 @@ enum infoHdrAdjust2 {
#define INVALID_ARGTAB_OFFSET 0
-#include <pshpack1.h>
+#include "pshpack1.h"
// Working set optimization: saving 12 * 128 = 1536 bytes in infoHdrShortcut
struct InfoHdr;
@@ -524,7 +523,7 @@ union CallPattern {
unsigned val;
};
-#include <poppack.h>
+#include "poppack.h"
#define IH_MAX_PROLOG_SIZE (51)
@@ -543,8 +542,8 @@ inline void GetInfoHdr(int index, InfoHdr * header)
PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header);
-BYTE FASTCALL encodeHeaderFirst(const InfoHdr& header, InfoHdr* state, int* more, int *pCached);
-BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, BYTE &codeSet);
+uint8_t FASTCALL encodeHeaderFirst(const InfoHdr& header, InfoHdr* state, int* more, int *pCached);
+uint8_t FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, uint8_t &codeSet);
size_t FASTCALL decodeUnsigned(PTR_CBYTE src, unsigned* value);
size_t FASTCALL decodeUDelta(PTR_CBYTE src, unsigned* value, unsigned lastValue);
@@ -569,7 +568,7 @@ void FASTCALL decodeCallPattern(int pattern,
unsigned * argMask,
unsigned * codeDelta);
-#endif // _TARGET_86_
+#endif // _TARGET_86_
// Stack offsets must be 8-byte aligned, so we use this unaligned
// offset to represent that the method doesn't have a security object
diff --git a/src/Native/Runtime/gcdump.cpp b/src/Native/Runtime/gcdump.cpp
index 8b178f649..20eeae53c 100644
--- a/src/Native/Runtime/gcdump.cpp
+++ b/src/Native/Runtime/gcdump.cpp
@@ -301,10 +301,12 @@ void GCDump::DumpCallsiteString(UInt32 callsiteOffset, PTR_UInt8 pbCallsiteStrin
case CSR_NUM_RSI: regName = "RSI"; break;
case CSR_NUM_RDI: regName = "RDI"; break;
case CSR_NUM_RBP: regName = "RBP"; break;
+#ifdef _TARGET_AMD64_
case CSR_NUM_R12: regName = "R12"; break;
case CSR_NUM_R13: regName = "R13"; break;
case CSR_NUM_R14: regName = "R14"; break;
case CSR_NUM_R15: regName = "R15"; break;
+#endif // _TARGET_AMD64_
#endif // _ARM_
}
gcPrintf("%02x | 3 %s%s%s \n", b, regName, interior, pinned);
diff --git a/src/Native/Runtime/i386/AllocFast.S b/src/Native/Runtime/i386/AllocFast.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/AllocFast.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/CallDescrWorker.S b/src/Native/Runtime/i386/CallDescrWorker.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/CallDescrWorker.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/CallingConventionConverterHelpers.S b/src/Native/Runtime/i386/CallingConventionConverterHelpers.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/CallingConventionConverterHelpers.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/ExceptionHandling.S b/src/Native/Runtime/i386/ExceptionHandling.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/ExceptionHandling.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/Interlocked.S b/src/Native/Runtime/i386/Interlocked.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/Interlocked.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/InteropThunksHelpers.S b/src/Native/Runtime/i386/InteropThunksHelpers.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/InteropThunksHelpers.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/PInvoke.S b/src/Native/Runtime/i386/PInvoke.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/PInvoke.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/StubDispatch.S b/src/Native/Runtime/i386/StubDispatch.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/StubDispatch.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/UniversalTransition.S b/src/Native/Runtime/i386/UniversalTransition.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/UniversalTransition.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/i386/WriteBarriers.S b/src/Native/Runtime/i386/WriteBarriers.S
new file mode 100644
index 000000000..1dc275673
--- /dev/null
+++ b/src/Native/Runtime/i386/WriteBarriers.S
@@ -0,0 +1,5 @@
+// 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.
+
+// TODO: Implement
diff --git a/src/Native/Runtime/inc/gcinfo.h b/src/Native/Runtime/inc/gcinfo.h
index 5ce6b1c27..21e7a7ff0 100644
--- a/src/Native/Runtime/inc/gcinfo.h
+++ b/src/Native/Runtime/inc/gcinfo.h
@@ -361,10 +361,12 @@ enum CalleeSavedRegNum
CSR_NUM_RSI = 0x01,
CSR_NUM_RDI = 0x02,
CSR_NUM_RBP = 0x03,
+#ifdef _TARGET_AMD64_
CSR_NUM_R12 = 0x04,
CSR_NUM_R13 = 0x05,
CSR_NUM_R14 = 0x06,
CSR_NUM_R15 = 0x07,
+#endif // _TARGET_AMD64_
};
enum CalleeSavedRegMask
@@ -393,10 +395,12 @@ enum ScratchRegNum
SR_NUM_RAX = 0x00,
SR_NUM_RCX = 0x01,
SR_NUM_RDX = 0x02,
+#ifdef _TARGET_AMD64_
SR_NUM_R8 = 0x03,
SR_NUM_R9 = 0x04,
SR_NUM_R10 = 0x05,
SR_NUM_R11 = 0x06,
+#endif // _TARGET_AMD64_
};
enum ScratchRegMask
diff --git a/src/Native/Runtime/startup.cpp b/src/Native/Runtime/startup.cpp
index 2bc152cb1..4b2a7be4f 100644
--- a/src/Native/Runtime/startup.cpp
+++ b/src/Native/Runtime/startup.cpp
@@ -34,7 +34,7 @@ unsigned __int64 g_startupTimelineEvents[NUM_STARTUP_TIMELINE_EVENTS] = { 0 };
#endif // PROFILE_STARTUP
#ifdef PLATFORM_UNIX
-Int32 __stdcall RhpHardwareExceptionHandler(UIntNative faultCode, UIntNative faultAddress, PAL_LIMITED_CONTEXT* palContext, UIntNative* arg0Reg, UIntNative* arg1Reg);
+Int32 RhpHardwareExceptionHandler(UIntNative faultCode, UIntNative faultAddress, PAL_LIMITED_CONTEXT* palContext, UIntNative* arg0Reg, UIntNative* arg1Reg);
#else
Int32 __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs);
#endif
diff --git a/src/Native/Runtime/unix/UnixContext.cpp b/src/Native/Runtime/unix/UnixContext.cpp
index 495a33fcf..3be92658f 100644
--- a/src/Native/Runtime/unix/UnixContext.cpp
+++ b/src/Native/Runtime/unix/UnixContext.cpp
@@ -228,6 +228,7 @@ static void RegDisplayToUnwindContext(REGDISPLAY* regDisplay, unw_context_t *unw
#undef ASSIGN_REG
#undef ASSIGN_REG_PTR
+
#endif // _ARM_
}
@@ -325,6 +326,10 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
GET_CONTEXT_POINTER(UNW_AARCH64_X26, 26) \
GET_CONTEXT_POINTER(UNW_AARCH64_X27, 27) \
GET_CONTEXT_POINTER(UNW_AARCH64_X28, 28)
+#elif defined(_X86_)
+#define GET_CONTEXT_POINTERS \
+ GET_CONTEXT_POINTER(UNW_X86_EBP, Rbp) \
+ GET_CONTEXT_POINTER(UNW_X86_EBX, Rbx)
#else
#error unsupported architecture
#endif
@@ -361,10 +366,23 @@ void UnwindCursorToRegDisplay(unw_cursor_t *cursor, unw_context_t *unwContext, R
ASSIGN_REG(R14, R14) \
ASSIGN_REG(R15, R15)
-#define ASSIGN_TWO_ARGUMENT_REGS(arg0Reg, arg1Reg) \
- MCREG_Rdi(nativeContext->uc_mcontext) = arg0Reg; \
+#define ASSIGN_TWO_ARGUMENT_REGS(arg0Reg, arg1Reg) \
+ MCREG_Rdi(nativeContext->uc_mcontext) = arg0Reg; \
MCREG_Rsi(nativeContext->uc_mcontext) = arg1Reg;
+#elif defined(_X86_)
+#define ASSIGN_CONTROL_REGS \
+ ASSIGN_REG(Eip, IP) \
+ ASSIGN_REG(Esp, Rsp)
+
+#define ASSIGN_INTEGER_REGS \
+ ASSIGN_REG(Ebx, Rbx) \
+ ASSIGN_REG(Ebp, Rbp)
+
+#define ASSIGN_TWO_ARGUMENT_REGS(arg0Reg, arg1Reg) \
+ MCREG_Ecx(nativeContext->uc_mcontext) = arg0Reg; \
+ MCREG_Edx(nativeContext->uc_mcontext) = arg1Reg;
+
#elif defined(_ARM_)
#define ASSIGN_CONTROL_REGS \
diff --git a/src/Native/gen-buildsys-clang.sh b/src/Native/gen-buildsys-clang.sh
index 72e9a0cbb..864f29172 100755
--- a/src/Native/gen-buildsys-clang.sh
+++ b/src/Native/gen-buildsys-clang.sh
@@ -127,6 +127,7 @@ else
"-DCMAKE_OBJDUMP=$llvm_objdump" \
"-DCMAKE_RANLIB=$llvm_ranlib" \
"-DCMAKE_BUILD_TYPE=$build_type" \
+ "-DCLR_CMAKE_TARGET_ARCH=$build_arch" \
$cmake_extra_defines \
"$1/src/Native"
fi
diff --git a/src/Native/inc/unix/poppack.h b/src/Native/inc/unix/poppack.h
new file mode 100644
index 000000000..aee3b49a3
--- /dev/null
+++ b/src/Native/inc/unix/poppack.h
@@ -0,0 +1,40 @@
+// 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.
+//
+
+//
+// ===========================================================================
+// File: poppack.h
+//
+// ===========================================================================
+/*
+Abstract:
+
+ This file turns packing of structures off. (That is, it enables
+ automatic alignment of structure fields.) An include file is needed
+ because various compilers do this in different ways.
+
+ poppack.h is the complement to pshpack?.h. An inclusion of poppack.h
+ MUST ALWAYS be preceded by an inclusion of one of pshpack?.h, in one-to-one
+ correspondence.
+
+ For Microsoft compatible compilers, this file uses the pop option
+ to the pack pragma so that it can restore the previous saved by the
+ pshpack?.h include file.
+
+*/
+
+#if ! (defined(lint) || defined(RC_INVOKED))
+#if ( _MSC_VER >= 800 && !defined(_M_I86)) || defined(_PUSHPOP_SUPPORTED)
+#pragma warning(disable:4103)
+#if !(defined( MIDL_PASS )) || defined( __midl )
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif
+#else
+#pragma pack()
+#endif
+#endif // ! (defined(lint) || defined(RC_INVOKED))
+
diff --git a/src/Native/inc/unix/pshpack1.h b/src/Native/inc/unix/pshpack1.h
new file mode 100644
index 000000000..884e4c9c4
--- /dev/null
+++ b/src/Native/inc/unix/pshpack1.h
@@ -0,0 +1,39 @@
+// 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.
+//
+
+//
+// ===========================================================================
+// File: pshpack1.h
+//
+// ===========================================================================
+
+/*++
+
+Abstract:
+
+ This file turns 1 byte packing of structures on. (That is, it disables
+ automatic alignment of structure fields.) An include file is needed
+ because various compilers do this in different ways. For Microsoft
+ compatible compilers, this files uses the push option to the pack pragma
+ so that the poppack.h include file can restore the previous packing
+ reliably.
+
+ The file poppack.h is the complement to this file.
+
+--*/
+
+#if ! (defined(lint) || defined(RC_INVOKED))
+#if ( _MSC_VER >= 800 && !defined(_M_I86)) || defined(_PUSHPOP_SUPPORTED)
+#pragma warning(disable:4103)
+#if !(defined( MIDL_PASS )) || defined( __midl )
+#pragma pack(push,1)
+#else
+#pragma pack(1)
+#endif
+#else
+#pragma pack(1)
+#endif
+#endif // ! (defined(lint) || defined(RC_INVOKED))
+
diff --git a/src/Native/inc/unix/pshpack4.h b/src/Native/inc/unix/pshpack4.h
new file mode 100644
index 000000000..c72dec96e
--- /dev/null
+++ b/src/Native/inc/unix/pshpack4.h
@@ -0,0 +1,39 @@
+// 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.
+//
+
+//
+// ===========================================================================
+// File: pshpack4.h
+//
+// ===========================================================================
+
+/*++
+
+Abstract:
+
+ This file turns 4 byte packing of structures on. (That is, it disables
+ automatic alignment of structure fields.) An include file is needed
+ because various compilers do this in different ways. For Microsoft
+ compatible compilers, this files uses the push option to the pack pragma
+ so that the poppack.h include file can restore the previous packing
+ reliably.
+
+ The file poppack.h is the complement to this file.
+
+--*/
+
+#if ! (defined(lint) || defined(RC_INVOKED))
+#if ( _MSC_VER >= 800 && !defined(_M_I86)) || defined(_PUSHPOP_SUPPORTED)
+#pragma warning(disable:4103)
+#if !(defined( MIDL_PASS )) || defined( __midl )
+#pragma pack(push,4)
+#else
+#pragma pack(4)
+#endif
+#else
+#pragma pack(4)
+#endif
+#endif // ! (defined(lint) || defined(RC_INVOKED))
+
diff --git a/src/Native/libunwind/include/__libunwind_config.h b/src/Native/libunwind/include/__libunwind_config.h
index 93a3be1eb..df252b1fb 100644
--- a/src/Native/libunwind/include/__libunwind_config.h
+++ b/src/Native/libunwind/include/__libunwind_config.h
@@ -20,8 +20,8 @@
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
# if defined(__i386__)
# define _LIBUNWIND_TARGET_I386 1
-# define _LIBUNWIND_CONTEXT_SIZE 25
-# define _LIBUNWIND_CURSOR_SIZE 32
+# define _LIBUNWIND_CONTEXT_SIZE 13
+# define _LIBUNWIND_CURSOR_SIZE 23
# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9
# elif defined(__x86_64__)
# define _LIBUNWIND_TARGET_X86_64 1