From d8d3151f6744a89cf62d045d10e1b0dfa5e34015 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Thu, 23 Aug 2018 09:32:24 -0700 Subject: [PATCH] Deal with compilation warnings in VM in cross-bitness scenario (#18707) --- src/debug/inc/arm/primitives.h | 6 +++--- src/inc/clrnt.h | 2 +- src/inc/daccess.h | 4 ++-- src/inc/regdisp.h | 16 ++++++++-------- src/vm/arm/stubs.cpp | 2 +- src/vm/peimagelayout.cpp | 2 +- src/vm/stubmgr.h | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/debug/inc/arm/primitives.h b/src/debug/inc/arm/primitives.h index 24779d7..336f991 100644 --- a/src/debug/inc/arm/primitives.h +++ b/src/debug/inc/arm/primitives.h @@ -50,7 +50,7 @@ inline CORDB_ADDRESS GetPatchEndAddr(CORDB_ADDRESS patchAddr) template inline T _ClearThumbBit(T addr) { - return (T)(((DWORD)addr) & ~THUMB_CODE); + return (T)(((CORDB_ADDRESS)addr) & ~THUMB_CODE); } @@ -148,7 +148,7 @@ inline PRD_TYPE CORDbgGetInstruction(UNALIGNED CORDB_ADDRESS_TYPE* address) { LIMITED_METHOD_CONTRACT; - ULONG ptraddr = dac_cast(address); + CORDB_ADDRESS ptraddr = (CORDB_ADDRESS)address; _ASSERTE(ptraddr & THUMB_CODE); ptraddr &= ~THUMB_CODE; return *(PRD_TYPE *)ptraddr; @@ -160,7 +160,7 @@ inline void CORDbgSetInstruction(CORDB_ADDRESS_TYPE* address, // In a DAC build, this function assumes the input is an host address. LIMITED_METHOD_DAC_CONTRACT; - ULONG ptraddr = dac_cast(address); + CORDB_ADDRESS ptraddr = (CORDB_ADDRESS)address; _ASSERTE(ptraddr & THUMB_CODE); ptraddr &= ~THUMB_CODE; diff --git a/src/inc/clrnt.h b/src/inc/clrnt.h index 487a370..95f7458 100644 --- a/src/inc/clrnt.h +++ b/src/inc/clrnt.h @@ -907,7 +907,7 @@ FORCEINLINE ULONG RtlpGetFunctionEndAddress ( __in PT_RUNTIME_FUNCTION FunctionEntry, - __in ULONG ImageBase + __in TADDR ImageBase ) { ULONG FunctionLength; diff --git a/src/inc/daccess.h b/src/inc/daccess.h index 01ed65d..67e5843 100644 --- a/src/inc/daccess.h +++ b/src/inc/daccess.h @@ -2399,13 +2399,13 @@ typedef DPTR(IMAGE_TLS_DIRECTORY) PTR_IMAGE_TLS_DIRECTORY; typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO; #endif -#ifdef _WIN64 +#ifdef _TARGET_64BIT_ typedef DPTR(T_RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO; #if defined(_TARGET_AMD64_) typedef DPTR(union _UNWIND_CODE) PTR_UNWIND_CODE; #endif // _TARGET_AMD64_ -#endif // _WIN64 +#endif // _TARGET_64BIT_ #ifdef _TARGET_ARM_ typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; diff --git a/src/inc/regdisp.h b/src/inc/regdisp.h index ed60f4b..06ceaf2 100644 --- a/src/inc/regdisp.h +++ b/src/inc/regdisp.h @@ -147,7 +147,7 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) { #endif } -#elif defined(_WIN64) +#elif defined(_TARGET_64BIT_) #if defined(_TARGET_ARM64_) typedef struct _Arm64VolatileContextPointer @@ -278,7 +278,7 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) { #error "RegDisplay functions are not implemented on this platform." #endif -#if defined(_WIN64) || defined(_TARGET_ARM_) || (defined(_TARGET_X86_) && defined(WIN64EXCEPTIONS)) +#if defined(_TARGET_64BIT_) || defined(_TARGET_ARM_) || (defined(_TARGET_X86_) && defined(WIN64EXCEPTIONS)) // This needs to be implemented for platforms that have funclets. inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display) { @@ -289,7 +289,7 @@ inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display) #elif defined(_TARGET_ARM64_) return (LPVOID)display->pCurrentContext->X0; #elif defined(_TARGET_ARM_) - return (LPVOID)display->pCurrentContext->R0; + return (LPVOID)((TADDR)display->pCurrentContext->R0); #elif defined(_TARGET_X86_) return (LPVOID)display->pCurrentContext->Eax; #else @@ -302,24 +302,24 @@ inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) { LIMITED_METHOD_CONTRACT; -#if defined(_WIN64) +#if defined(_TARGET_64BIT_) pRD->SP = (INT_PTR)GetSP(pRD->pCurrentContext); pRD->ControlPC = INT_PTR(GetIP(pRD->pCurrentContext)); -#elif defined(_TARGET_ARM_) // _WIN64 +#elif defined(_TARGET_ARM_) pRD->SP = (DWORD)GetSP(pRD->pCurrentContext); pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); -#elif defined(_TARGET_X86_) // _TARGET_ARM_ +#elif defined(_TARGET_X86_) pRD->SP = (DWORD)GetSP(pRD->pCurrentContext); pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); #else // _TARGET_X86_ PORTABILITY_ASSERT("SyncRegDisplayToCurrentContext"); -#endif // _TARGET_ARM_ || _TARGET_X86_ +#endif #ifdef DEBUG_REGDISPLAY CheckRegDisplaySP(pRD); #endif // DEBUG_REGDISPLAY } -#endif // _WIN64 || _TARGET_ARM_ || (_TARGET_X86_ && WIN64EXCEPTIONS) +#endif // _TARGET_64BIT_ || _TARGET_ARM_ || (_TARGET_X86_ && WIN64EXCEPTIONS) typedef REGDISPLAY *PREGDISPLAY; diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp index d97062d..bd3ad51 100644 --- a/src/vm/arm/stubs.cpp +++ b/src/vm/arm/stubs.cpp @@ -2984,7 +2984,7 @@ void StubLinkerCPU::ThumbEmitCondRegJump(CodeLabel *target, BOOL nonzero, ThumbR EmitLabelRef(target, reinterpret_cast(gThumbCondJump), variation); } -unsigned int StubLinkerCPU::HashMulticastInvoke(MetaSig *pSig) +UINT_PTR StubLinkerCPU::HashMulticastInvoke(MetaSig *pSig) { // Generate a hash key as follows: // Bit0-2 : num of general purpose registers used diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index 655c283..5bc4e36 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -235,7 +235,7 @@ void PEImageLayout::ApplyBaseRelocations() #ifdef _TARGET_ARM_ case IMAGE_REL_BASED_THUMB_MOV32: - PutThumb2Mov32((UINT16 *)address, GetThumb2Mov32((UINT16 *)address) + delta); + PutThumb2Mov32((UINT16 *)address, GetThumb2Mov32((UINT16 *)address) + (INT32)delta); pEndAddressToFlush = max(pEndAddressToFlush, address + 8); break; #endif diff --git a/src/vm/stubmgr.h b/src/vm/stubmgr.h index ed774ec..fc77ca9 100644 --- a/src/vm/stubmgr.h +++ b/src/vm/stubmgr.h @@ -917,7 +917,7 @@ public: return dac_cast(pContext->Rcx); #endif #elif defined(_TARGET_ARM_) - return dac_cast(pContext->R0); + return dac_cast((TADDR)pContext->R0); #elif defined(_TARGET_ARM64_) return dac_cast(pContext->X0); #else @@ -980,7 +980,7 @@ public: return context.Rip; #elif defined(_TARGET_ARM_) - return *((PCODE *)pContext->R11 + 1); + return *((PCODE *)((TADDR)pContext->R11) + 1); #elif defined(_TARGET_ARM64_) return *((PCODE *)pContext->Fp + 1); #else -- 2.7.4