diff options
author | Adeel Mujahid <adeelbm@outlook.com> | 2017-09-24 06:33:05 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-09-24 06:33:05 +0300 |
commit | aa7549417fac672a7c8dae31ccd4d7ccc46b2dda (patch) | |
tree | 0960867179fb4b12bbbab7fd5d9a7305c87ebc62 /src/Native | |
parent | 5705c262df6b6da588e65eb4d7224700e10d9c87 (diff) |
Enable x86 build (#4598)
Diffstat (limited to 'src/Native')
-rw-r--r-- | src/Native/Bootstrap/main.cpp | 2 | ||||
-rw-r--r-- | src/Native/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/Native/Runtime/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/Native/Runtime/coreclr/bitvector.h | 462 | ||||
-rw-r--r-- | src/Native/Runtime/i386/Interlocked.asm | 3 | ||||
-rw-r--r-- | src/Native/Runtime/windows/CoffNativeCodeManager.cpp | 86 | ||||
-rw-r--r-- | src/Native/Runtime/windows/CoffNativeCodeManager.h | 2 | ||||
-rw-r--r-- | src/Native/Runtime/windows/PalRedhawkCommon.cpp | 6 | ||||
-rw-r--r-- | src/Native/Runtime/windows/PalRedhawkMinWin.cpp | 6 | ||||
-rw-r--r-- | src/Native/jitinterface/CMakeLists.txt | 4 |
10 files changed, 552 insertions, 30 deletions
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp index 8bb2bab23..bbeff8c9c 100644 --- a/src/Native/Bootstrap/main.cpp +++ b/src/Native/Bootstrap/main.cpp @@ -292,7 +292,7 @@ extern "C" void InitializeModules(void* osModule, void ** modules, int count, vo #if defined(_WIN32) extern "C" int __managed__Main(int argc, wchar_t* argv[]); -int wmain(int argc, wchar_t* argv[]) +int __cdecl wmain(int argc, wchar_t* argv[]) #else extern "C" int __managed__Main(int argc, char* argv[]); int main(int argc, char* argv[]) diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index 91f5d9a71..c486248fb 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -206,6 +206,10 @@ if(WIN32) add_compile_options($<$<CONFIG:Release>:/MT>) add_compile_options(/Zi) # enable debugging information set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + + if (CLR_CMAKE_PLATFORM_ARCH_I386) + add_compile_options(/Gz) + endif (CLR_CMAKE_PLATFORM_ARCH_I386) else(WIN32) string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE) if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG) diff --git a/src/Native/Runtime/CMakeLists.txt b/src/Native/Runtime/CMakeLists.txt index 0757aa424..ecf44f0ce 100644 --- a/src/Native/Runtime/CMakeLists.txt +++ b/src/Native/Runtime/CMakeLists.txt @@ -78,13 +78,16 @@ if(WIN32) windows/PalRedhawkMinWin.cpp ) - list(APPEND FULL_RUNTIME_SOURCES + list(APPEND FULL_RUNTIME_SOURCES windows/CoffNativeCodeManager.cpp ) + set(ASM_SUFFIX asm) + if(CLR_CMAKE_PLATFORM_ARCH_AMD64) set(ARCH_SOURCES_DIR amd64) - set(ASM_SUFFIX asm) + elseif(CLR_CMAKE_PLATFORM_ARCH_I386) + set(ARCH_SOURCES_DIR i386) endif() list(APPEND RUNTIME_SOURCES_ARCH_ASM diff --git a/src/Native/Runtime/coreclr/bitvector.h b/src/Native/Runtime/coreclr/bitvector.h new file mode 100644 index 000000000..a4181dbb8 --- /dev/null +++ b/src/Native/Runtime/coreclr/bitvector.h @@ -0,0 +1,462 @@ +// 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. + + +/***************************************************************************/ +/* BitVector.h */ +/***************************************************************************/ +// Routines to support a growable bitvector +/***************************************************************************/ + +#ifndef BITVECTOR_H +#define BITVECTOR_H 1 + + +#ifndef LIMITED_METHOD_CONTRACT +#define LIMITED_METHOD_CONTRACT +#define UNDEF_LIMITED_METHOD_CONTRACT +#endif + +#ifndef WRAPPER_NO_CONTRACT +#define WRAPPER_NO_CONTRACT +#define UNDEF_WRAPPER_NO_CONTRACT +#endif + +#ifndef SUPPORTS_DAC +#define SUPPORTS_DAC +#define UNDEF_SUPPORTS_DAC +#endif + +#ifndef _ASSERTE +#define _ASSERTE(x) +#define UNDEF_ASSERTE +#endif + +#define USE_BITVECTOR 1 +#if USE_BITVECTOR + +/* The bitvector class is meant to be a drop in replacement for an integer + (that is you use it like an integer), however it grows as needed. + + Features: + plug compatible with normal integers; + grows as needed + Optimized for the small case when the vector fits in machine word + Uses one machine word if vector fits in machine word (minus a bit) + + Some caveates: + You should use mutator operators &=, |= ... instead of the + non-mutators whenever possible to avoid creating a temps + + Specifically did NOT supply automatic coersions to + and from short types so that the programmer is aware of + when code was being injected on his behalf. The upshot of this + is that you have to use the BitVector() toUnsigned() to convert +*/ + +/***************************************************************************/ + +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 + + // Maximum number of bits in our bitvector +#define MAX_PTRARG_OFS 1024 + + enum { + IS_BIG = 1, // The low bit is used to discrimate m_val and m_vals + CHUNK_BITS = sizeof(ChunkType)*8, // The number of bits that we can manipuate as a chunk + SMALL_BITS = CHUNK_BITS - 1, // The number of bits we can fit in the small representation +// SMALL_BITS = 5, // TESTING ONLY: The number of bits we can fit in the small representation + VALS_COUNT = MAX_PTRARG_OFS / CHUNK_BITS, // The number of ChunkType elements in the Vals array + }; + +public: + BitVector() + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + m_val = 0; + } + + BOOL isBig() const + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + return ((m_val & IS_BIG) != 0); + } + + void toBig() + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + if (!isBig()) + { + doBigInit(smallBits()); + } + } + + explicit BitVector(ChunkType arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (arg > MaxVal) + { + doBigInit(arg); + } + else + { + m_val = ChunkType(arg << 1); + } + } + + BitVector(ChunkType arg, UINT shift) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if ((arg > MaxVal) || (shift >= SMALL_BITS) || (arg > (MaxVal >> shift))) + { + doBigInit(arg); + doBigLeftShiftAssign(shift); + } + else + { + m_val = ChunkType(arg << (shift+1)); + } + } + +#define CONSTRUCT_ptrArgTP(arg,shift) BitVector((arg), (shift)) + + BitVector(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (arg.isBig()) + { + doBigInit(arg); + } + else + { + m_val = arg.m_val; + } + } + + void operator <<=(unsigned shift) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if ((m_val == 0) || (shift == 0)) // Zero is a special case, don't need to do anything + return; + + if (isBig() || (shift >= SMALL_BITS) || (m_val > (MaxVal >> (shift-1)))) + { + doBigLeftShiftAssign(shift); + } + else + { + m_val <<= shift; + } + } + + void operator >>=(unsigned shift) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (isBig()) + { + doBigRightShiftAssign(shift); + } + else + { + m_val >>= shift; + m_val &= ~IS_BIG; // clear the isBig bit if it got set + } + } + + void operator |=(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (((m_val | arg.m_val) & IS_BIG) != 0) + { + doBigOrAssign(arg); + } + else + { + m_val |= arg.m_val; + } + } + + // Note that that is set difference, not subtration + void operator -=(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (((m_val | arg.m_val) & IS_BIG) != 0) + { + doBigDiffAssign(arg); + } + else + { + m_val &= ~arg.m_val; + } + } + + void operator &=(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (((m_val | arg.m_val) & IS_BIG) != 0) + { + doBigAndAssign(arg); + } + else + { + m_val &= arg.m_val; + } + } + + friend void setDiff(BitVector& target, const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + target -= arg; + } + + friend BOOL intersect(const BitVector& arg1, const BitVector& arg2) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (((arg1.m_val | arg2.m_val) & IS_BIG) != 0) + { + return arg1.doBigIntersect(arg2); + } + else + { + return ((arg1.m_val & arg2.m_val) != 0); + } + } + + BOOL operator ==(const BitVector& arg) const + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if ((m_val | arg.m_val) & IS_BIG) + { + return doBigEquals(arg); + } + else + { + return m_val == arg.m_val; + } + } + + BOOL operator !=(const BitVector& arg) const + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + return !(*this == arg); + } + + friend ChunkType toUnsigned(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + if (arg.isBig()) + { + return arg.m_vals.m_chunks[0]; // Note truncation + } + else + { + return arg.smallBits(); + } + } + + // Note that we require the invariant that zero is always stored in the + // small form so that this works bitvector is zero iff (m_val == 0) + friend BOOL isZero(const BitVector& arg) + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + return arg.m_val == 0; + } + + /* currently only used in asserts */ + BitVector operator &(const BitVector& arg) const + { + WRAPPER_NO_CONTRACT; + SUPPORTS_DAC; + + BitVector ret = *this; + ret &= arg; + return ret; + } + + int NumBits() const; + +private: + + static const ChunkType MaxVal = ((ChunkType)1 << SMALL_BITS) - 1; // Maximum value that can be stored in m_val + + // This is the structure that we use when the bit vector overflows. + // It is a simple vector. + struct Vals { + unsigned m_encodedLength; // An encoding of the current length of the 'm_chunks' array + ChunkType m_chunks[VALS_COUNT]; + + BOOL isBig() const + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + return ((m_encodedLength & IS_BIG) != 0); + } + + unsigned GetLength() const + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + if (isBig()) + { + unsigned length = (m_encodedLength >> 1); + _ASSERTE(length > 0); + return length; + } + else + { + return 0; + } + } + + void SetLength(unsigned length) + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + _ASSERTE(length > 0); + _ASSERTE(length <= VALS_COUNT); + + m_encodedLength = (ChunkType) (length << 1); + m_encodedLength |= (ChunkType) IS_BIG; + } + }; + + // + // This is the instance data for the bitvector + // + // We discrimininate on this + union { + ChunkType m_val; // if m_val bit 0 is false, then bits 1-N are the bit vector + Vals m_vals; // if m_val bit 1 is true, then use Vals + }; + + + ChunkType smallBits() const + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + _ASSERTE(!isBig()); + return (m_val >> 1); + } + +#ifdef STRIKE + void doBigInit(ChunkType arg) {} +#else + void doBigInit(ChunkType arg); +#endif + void doBigInit(const BitVector& arg); + void doBigLeftShiftAssign(unsigned arg); + void doBigRightShiftAssign(unsigned arg); + void doBigDiffAssign(const BitVector&); + void doBigAndAssign(const BitVector&); + void doBigOrAssign(const BitVector& arg); + BOOL doBigEquals(const BitVector&) const; + BOOL doBigIntersect(const BitVector&) const; +}; + +typedef BitVector ptrArgTP; + +#else // !USE_BITVECTOR + +typedef unsigned __int64 ptrArgTP; + + // Maximum number of bits in our bitvector +#define MAX_PTRARG_OFS (sizeof(ptrArgTP) * 8) + +#define CONSTRUCT_ptrArgTP(arg,shift) (((ptrArgTP) (arg)) << (shift)) + +inline BOOL isZero(const ptrArgTP& arg) +{ + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + return (arg == 0); +} + +inline ptrArgTP toUnsigned(const ptrArgTP& arg) +{ + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + return arg; +} + +inline void setDiff(ptrArgTP& target, const ptrArgTP& arg) +{ + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + target &= ~arg; +} + +inline BOOL intersect(const ptrArgTP arg1, const ptrArgTP arg2) +{ + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + return ((arg1 & arg2) != 0); +} + +#endif // !USE_BITVECTOR + +#ifdef UNDEF_LIMITED_METHOD_CONTRACT +#undef LIMITED_METHOD_CONTRACT +#undef UNDEF_LIMITED_METHOD_CONTRACT +#endif + +#ifdef UNDEF_WRAPPER_NO_CONTRACT +#undef WRAPPER_NO_CONTRACT +#undef UNDEF_WRAPPER_NO_CONTRACT +#endif + +#ifdef UNDEF_SUPPORTS_DAC +#undef SUPPORTS_DAC +#undef UNDEF_SUPPORTS_DAC +#endif + +#ifdef UNDEF_ASSERTE +#undef _ASSERTE +#undef UNDEF_ASSERTE +#endif + +#endif // BITVECTOR_H diff --git a/src/Native/Runtime/i386/Interlocked.asm b/src/Native/Runtime/i386/Interlocked.asm new file mode 100644 index 000000000..f9599b1b8 --- /dev/null +++ b/src/Native/Runtime/i386/Interlocked.asm @@ -0,0 +1,3 @@ +;; TODO: Implement + +end diff --git a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp index 3abd0b188..d0d8ff81c 100644 --- a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp +++ b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp @@ -29,13 +29,48 @@ #define UBF_FUNC_REVERSE_PINVOKE 0x08 #define UBF_FUNC_HAS_ASSOCIATED_DATA 0x10 -#if defined(_TARGET_AMD64_) +#ifdef _TARGET_X86_ +// +// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. +// +typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindData; +} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; + +typedef struct _KNONVOLATILE_CONTEXT_POINTERS { + + // The ordering of these fields should be aligned with that + // of corresponding fields in CONTEXT + // + // (See REGDISPLAY in Runtime/regdisp.h for details) + PDWORD Edi; + PDWORD Esi; + PDWORD Ebx; + PDWORD Edx; + PDWORD Ecx; + PDWORD Eax; + + PDWORD Ebp; + +} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; + +typedef struct _UNWIND_INFO { + ULONG FunctionLength; +} UNWIND_INFO, *PUNWIND_INFO; + +#elif defined(_TARGET_AMD64_) + +#define UNW_FLAG_NHANDLER 0x0 +#define UNW_FLAG_EHANDLER 0x1 +#define UNW_FLAG_UHANDLER 0x2 +#define UNW_FLAG_CHAININFO 0x4 // // The following structures are defined in Windows x64 unwind info specification // http://www.bing.com/search?q=msdn+Exception+Handling+x64 // - typedef union _UNWIND_CODE { struct { uint8_t CodeOffset; @@ -46,11 +81,6 @@ typedef union _UNWIND_CODE { uint16_t FrameOffset; } UNWIND_CODE, *PUNWIND_CODE; -#define UNW_FLAG_NHANDLER 0x0 -#define UNW_FLAG_EHANDLER 0x1 -#define UNW_FLAG_UHANDLER 0x2 -#define UNW_FLAG_CHAININFO 0x4 - typedef struct _UNWIND_INFO { uint8_t Version : 3; uint8_t Flags : 5; @@ -61,11 +91,11 @@ typedef struct _UNWIND_INFO { UNWIND_CODE UnwindCode[1]; } UNWIND_INFO, *PUNWIND_INFO; +#endif // _TARGET_X86_ + typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO; typedef DPTR(union _UNWIND_CODE) PTR_UNWIND_CODE; -#endif // _TARGET_AMD64_ - static PTR_VOID GetUnwindDataBlob(TADDR moduleBase, PTR_RUNTIME_FUNCTION pRuntimeFunction, /* out */ size_t * pSize) { #if defined(_TARGET_AMD64_) @@ -86,6 +116,14 @@ static PTR_VOID GetUnwindDataBlob(TADDR moduleBase, PTR_RUNTIME_FUNCTION pRuntim return pUnwindInfo; +#elif defined(_TARGET_X86_) + + PTR_UNWIND_INFO pUnwindInfo(dac_cast<PTR_UNWIND_INFO>(moduleBase + pRuntimeFunction->UnwindInfoAddress)); + + *pSize = sizeof(UNWIND_INFO); + + return pUnwindInfo; + #elif defined(_TARGET_ARM_) // if this function uses packed unwind data then at least one of the two least significant bits @@ -126,7 +164,9 @@ static PTR_VOID GetUnwindDataBlob(TADDR moduleBase, PTR_RUNTIME_FUNCTION pRuntim *pSize = size; return xdata; #else - #error unexpected target architecture + PORTABILITY_ASSERT("GetUnwindDataBlob"); + *pSize = 0; + return NULL; #endif } @@ -389,18 +429,29 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo, memset(&contextPointers, 0xDD, sizeof(contextPointers)); #endif -#define FOR_EACH_NONVOLATILE_REGISTER(F) \ - F(Rax) F(Rcx) F(Rdx) F(Rbx) F(Rbp) F(Rsi) F(Rdi) F(R8) F(R9) F(R10) F(R11) F(R12) F(R13) F(R14) F(R15) +#ifdef _TARGET_X86_ + #define FOR_EACH_NONVOLATILE_REGISTER(F) \ + F(E, ax) F(E, cx) F(E, dx) F(E, bx) F(E, bp) F(E, si) F(E, di) + #define WORDPTR PDWORD +#else + #define FOR_EACH_NONVOLATILE_REGISTER(F) \ + F(R, ax) F(R, cx) F(R, dx) F(R, bx) F(R, bp) F(R, si) F(R, di) \ + F(R, 8) F(R, 9) F(R, 10) F(R, 11) F(R, 12) F(R, 13) F(R, 14) F(R, 15) + #define WORDPTR PDWORD64 +#endif -#define REGDISPLAY_TO_CONTEXT(reg) \ - contextPointers.reg = (PDWORD64) pRegisterSet->p##reg; \ - if (pRegisterSet->p##reg != NULL) context.reg = *(pRegisterSet->p##reg); +#define REGDISPLAY_TO_CONTEXT(prefix, reg) \ + contextPointers.prefix####reg = (WORDPTR) pRegisterSet->pR##reg; \ + if (pRegisterSet->pR##reg != NULL) context.prefix##reg = *(pRegisterSet->pR##reg); -#define CONTEXT_TO_REGDISPLAY(reg) \ - pRegisterSet->p##reg = (PTR_UIntNative) contextPointers.reg; +#define CONTEXT_TO_REGDISPLAY(prefix, reg) \ + pRegisterSet->pR##reg = (PTR_UIntNative) contextPointers.prefix####reg; FOR_EACH_NONVOLATILE_REGISTER(REGDISPLAY_TO_CONTEXT); +#ifdef _TARGET_X86_ + PORTABILITY_ASSERT("CoffNativeCodeManager::UnwindStackFrame"); +#else // _TARGET_X86_ memcpy(&context.Xmm6, pRegisterSet->Xmm, sizeof(pRegisterSet->Xmm)); context.Rsp = pRegisterSet->SP; @@ -424,6 +475,7 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo, pRegisterSet->pIP = PTR_PCODE(pRegisterSet->SP - sizeof(TADDR)); memcpy(pRegisterSet->Xmm, &context.Xmm6, sizeof(pRegisterSet->Xmm)); +#endif // _TARGET_X86_ FOR_EACH_NONVOLATILE_REGISTER(CONTEXT_TO_REGDISPLAY); diff --git a/src/Native/Runtime/windows/CoffNativeCodeManager.h b/src/Native/Runtime/windows/CoffNativeCodeManager.h index b0d5390a4..31261614d 100644 --- a/src/Native/Runtime/windows/CoffNativeCodeManager.h +++ b/src/Native/Runtime/windows/CoffNativeCodeManager.h @@ -4,7 +4,7 @@ #pragma once -#if defined(_TARGET_AMD64_) +#if defined(_TARGET_AMD64_) || defined(_TARGET_X86_) struct T_RUNTIME_FUNCTION { uint32_t BeginAddress; uint32_t EndAddress; diff --git a/src/Native/Runtime/windows/PalRedhawkCommon.cpp b/src/Native/Runtime/windows/PalRedhawkCommon.cpp index 77375ee9f..7618b24c0 100644 --- a/src/Native/Runtime/windows/PalRedhawkCommon.cpp +++ b/src/Native/Runtime/windows/PalRedhawkCommon.cpp @@ -222,7 +222,7 @@ REDHAWK_PALEXPORT void REDHAWK_PALAPI PalGetPDBInfo(HANDLE hOsHandle, _Out_ GUID } } -REDHAWK_PALEXPORT Int32 PalGetProcessCpuCount() +REDHAWK_PALEXPORT Int32 REDHAWK_PALAPI PalGetProcessCpuCount() { static int CpuCount = 0; @@ -246,7 +246,7 @@ REDHAWK_PALEXPORT Int32 PalGetProcessCpuCount() //Reads the entire contents of the file into the specified buffer, buff //returns the number of bytes read if the file is successfully read //returns 0 if the file is not found, size is greater than maxBytesToRead or the file couldn't be opened or read -REDHAWK_PALEXPORT UInt32 PalReadFileContents(_In_z_ const TCHAR* fileName, _Out_writes_all_(maxBytesToRead) char* buff, _In_ UInt32 maxBytesToRead) +REDHAWK_PALEXPORT UInt32 REDHAWK_PALAPI PalReadFileContents(_In_z_ const TCHAR* fileName, _Out_writes_all_(maxBytesToRead) char* buff, _In_ UInt32 maxBytesToRead) { WIN32_FILE_ATTRIBUTE_DATA attrData; @@ -282,7 +282,7 @@ REDHAWK_PALEXPORT UInt32 PalReadFileContents(_In_z_ const TCHAR* fileName, _Out_ // Retrieves the entire range of memory dedicated to the calling thread's stack. This does // not get the current dynamic bounds of the stack, which can be significantly smaller than // the maximum bounds. -REDHAWK_PALEXPORT bool PalGetMaximumStackBounds(_Out_ void** ppStackLowOut, _Out_ void** ppStackHighOut) +REDHAWK_PALEXPORT bool REDHAWK_PALAPI PalGetMaximumStackBounds(_Out_ void** ppStackLowOut, _Out_ void** ppStackHighOut) { // VirtualQuery on the address of a local variable to get the allocation // base of the stack. Then use the StackBase field in the TEB to give diff --git a/src/Native/Runtime/windows/PalRedhawkMinWin.cpp b/src/Native/Runtime/windows/PalRedhawkMinWin.cpp index 80351f820..99d5a0315 100644 --- a/src/Native/Runtime/windows/PalRedhawkMinWin.cpp +++ b/src/Native/Runtime/windows/PalRedhawkMinWin.cpp @@ -112,7 +112,7 @@ REDHAWK_PALEXPORT bool REDHAWK_PALAPI PalHasCapability(PalCapability capability) // or if the thread was already registered with a different fiber. // Parameters: // thread - thread to attach -extern "C" void PalAttachThread(void* thread) +REDHAWK_PALEXPORT void REDHAWK_PALAPI PalAttachThread(void* thread) { void* threadFromCurrentFiber = FlsGetValue(g_flsIndex); @@ -134,7 +134,7 @@ extern "C" void PalAttachThread(void* thread) // thread - thread to detach // Return: // true if the thread was detached, false if there was no attached thread -extern "C" bool PalDetachThread(void* thread) +REDHAWK_PALEXPORT bool REDHAWK_PALAPI PalDetachThread(void* thread) { ASSERT(g_flsIndex != FLS_OUT_OF_INDEXES); void* threadFromCurrentFiber = FlsGetValue(g_flsIndex); @@ -189,8 +189,6 @@ extern "C" UInt64 PalGetCurrentThreadIdForLogging() } \ WHILE_0; -extern "C" int __stdcall PalGetModuleFileName(_Out_ const TCHAR** pModuleNameOut, HANDLE moduleBase); - REDHAWK_PALEXPORT UInt32_BOOL REDHAWK_PALAPI PalAllocateThunksFromTemplate(_In_ HANDLE hTemplateModule, UInt32 templateRva, size_t templateSize, _Outptr_result_bytebuffer_(templateSize) void** newThunksOut) { #ifdef XBOX_ONE diff --git a/src/Native/jitinterface/CMakeLists.txt b/src/Native/jitinterface/CMakeLists.txt index 15091699c..46c071c8a 100644 --- a/src/Native/jitinterface/CMakeLists.txt +++ b/src/Native/jitinterface/CMakeLists.txt @@ -7,7 +7,7 @@ set(NATIVE_SOURCES corinfoexception.cpp ) -if(WIN32) +if(WIN32 AND CLR_CMAKE_PLATFORM_ARCH_AMD64) set(NATIVE_SOURCES ${NATIVE_SOURCES} CodeHeap.cpp JITCodeManager.cpp @@ -16,7 +16,7 @@ if(WIN32) add_definitions(-DGCINFODECODER_NO_EE) add_definitions(-DFEATURE_REDHAWK) -endif(WIN32) +endif(WIN32 AND CLR_CMAKE_PLATFORM_ARCH_AMD64) add_library(jitinterface SHARED |