Modify __int64 definition in PAL to match the OS definition (#77056)
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 18 Oct 2022 20:25:03 +0000 (22:25 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2022 20:25:03 +0000 (13:25 -0700)
* Modify __int64 definition in PAL to match the OS definition

This change modifies the definition of __int64 and thus of many other
types defined on the basis of it to match the OS definitions. This
ensures that we can use these types in interfaces between code in
coreclr and various PALs that are compiled against OS headers.

The key issue was that we were defining __int64 for 64 bit OSes as
long while Unix defines it as long long. The size of those types is the
same on Unix, but they are different and result in different mangling of
C++ names.

* Fix coreclr tests build

* Fix comment on #endif in jit.h

* Reflect PR feedback

* Fix jit source formatting

* Fix FreeBSD build

21 files changed:
src/coreclr/debug/createdump/crashinfounix.cpp
src/coreclr/debug/inc/dacdbistructures.inl
src/coreclr/inc/check.inl
src/coreclr/inc/clrtypes.h
src/coreclr/inc/daccess.h
src/coreclr/inc/regdisp.h
src/coreclr/jit/compiler.hpp
src/coreclr/jit/gentree.h
src/coreclr/jit/jit.h
src/coreclr/jit/register.h
src/coreclr/jit/utils.h
src/coreclr/pal/inc/pal.h
src/coreclr/pal/inc/pal_mstypes.h
src/coreclr/pal/src/exception/remote-unwind.cpp
src/coreclr/pal/src/exception/seh-unwind.cpp
src/coreclr/pal/src/misc/sysinfo.cpp
src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
src/coreclr/tools/StressLogAnalyzer/StressLogPlugin.cpp
src/coreclr/tools/StressLogAnalyzer/strike.h
src/coreclr/vm/gcenv.os.cpp
src/tests/profiler/native/getappdomainstaticaddress/getappdomainstaticaddress.cpp

index d7e93bd..77a5439 100644 (file)
@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
             TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
             InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);
 
-            uint64_t ehFrameStart;
-            uint64_t ehFrameSize;
+            ULONG64 ehFrameStart;
+            ULONG64 ehFrameSize;
             if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
             {
                 TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
index 9478ce5..e31583f 100644 (file)
@@ -640,8 +640,6 @@ void FieldData::ClearFields()
     m_pFldStaticAddress = NULL;
 }
 
-typedef ULONG_PTR SIZE_T;
-
 inline
 BOOL FieldData::OkToGetOrSetInstanceOffset()
 {
index f234e98..070278a 100644 (file)
@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
     CHECK_OK;
 }
 
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+inline CHECK CheckOverflow(const void *address, SIZE_T offset)
+{
+    CHECK((UINT64) address + offset >= (UINT64) address);
+
+    CHECK_OK;
+}
+#endif // HOST_UNIX && HOST_BIT64
 
 inline CHECK CheckUnderflow(UINT value1, UINT value2)
 {
index 5e83573..6ab68eb 100644 (file)
@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
     return (value+alignment-1)&~(UINT64)(alignment-1);
 }
 
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
+{
+    STATIC_CONTRACT_LEAF;
+    STATIC_CONTRACT_SUPPORTS_DAC;
+    return (value+alignment-1)&~(SIZE_T)(alignment-1);
+}
+#endif // HOST_UNIX && HOST_BIT64
+
 inline UINT AlignDown(UINT value, UINT alignment)
 {
     STATIC_CONTRACT_LEAF;
@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
     return (UINT) (AlignUp(value, alignment) - value);
 }
 
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+inline UINT AlignmentPad(SIZE_T value, UINT alignment)
+{
+    STATIC_CONTRACT_WRAPPER;
+    return (UINT) (AlignUp(value, alignment) - value);
+}
+#endif // HOST_UNIX && HOST_BIT64
+
 inline UINT AlignmentTrim(UINT value, UINT alignment)
 {
     STATIC_CONTRACT_LEAF;
@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
     return ((UINT)value)&(alignment-1);
 }
 
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
+{
+    STATIC_CONTRACT_LEAF;
+    STATIC_CONTRACT_SUPPORTS_DAC;
+    return ((UINT)value)&(alignment-1);
+}
+#endif // HOST_UNIX && HOST_BIT64
+
 #endif  // CLRTYPES_H_
index a8056a5..df31ac5 100644 (file)
@@ -1027,6 +1027,12 @@ public:
     {
         return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
     }
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+    DPtrType operator+(unsigned long long val)
+    {
+        return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
+    }
+#endif // HOST_UNIX && HOST_BIT64
     DPtrType operator+(short val)
     {
         return DPtrType(m_addr + val * sizeof(type));
index 7a51ec5..b6ccc87 100644 (file)
@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
     return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
 #elif defined(TARGET_AMD64)
     _ASSERTE(regNum < 16);
-    return &regs->Rax + regNum;
+    return (size_t *)&regs->Rax + regNum;
 #elif defined(TARGET_ARM)
         _ASSERTE(regNum < 16);
         return (size_t *)&regs->R0 + regNum;
index dbead03..e9b118f 100644 (file)
@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
 #endif
 }
 
+#if defined(HOST_UNIX) && defined(HOST_64BIT)
+inline unsigned genLog2(size_t value)
+{
+    return genLog2((unsigned __int64)value);
+}
+#endif // HOST_UNIX && HOST_BIT64
+
 /*****************************************************************************
  *
  *  Return the lowest bit that is set in the given register mask.
@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
 {
     static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
                           std::is_same<T, long long>::value || std::is_same<T, float>::value ||
-                          std::is_same<T, double>::value));
+                          std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));
+
     static_assert_no_msg(sizeof(int64_t) == sizeof(long long));
 
     var_types typeOfValue = TYP_UNDEF;
index 70abd0a..85e27fe 100644 (file)
@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
 template <typename T>
 inline void GenTreeIntConCommon::SetValueTruncating(T value)
 {
-    static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
+    static_assert_no_msg(
+        (std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));
 
     if (TypeIs(TYP_LONG))
     {
index 8fcc451..8d8eedd 100644 (file)
 #error Unsupported or unset target architecture
 #endif
 
+typedef ptrdiff_t ssize_t;
+
 // Include the AMD64 unwind codes when appropriate.
 #if defined(TARGET_AMD64)
 #include "win64unwind.h"
@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
 // this is used for native code sizes.
 typedef unsigned UNATIVE_OFFSET;
 
-typedef ptrdiff_t ssize_t;
-
 // Type used for weights (e.g. block and edge weights)
 typedef double weight_t;
 
@@ -631,8 +631,15 @@ inline unsigned int unsigned_abs(int x)
 #ifdef TARGET_64BIT
 inline size_t unsigned_abs(ssize_t x)
 {
+    return ((size_t)abs((__int64)x));
+}
+
+#ifdef HOST_UNIX
+inline size_t unsigned_abs(__int64 x)
+{
     return ((size_t)abs(x));
 }
+#endif // HOST_UNIX
 #endif // TARGET_64BIT
 
 /*****************************************************************************/
index 9719747..6f63bc5 100644 (file)
@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)
 
 #ifdef TARGET_AMD64
 #define XMMBASE 16
-#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
+#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
 #else // !TARGET_AMD64
 #define XMMBASE 8
-#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
+#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
 #endif // !TARGET_AMD64
 
 REGDEF(XMM0,    0+XMMBASE,  XMMMASK(0),   "mm0"  )
index 9dbce41..0e129f1 100644 (file)
@@ -821,6 +821,7 @@ template <typename T>
 bool FitsIn(var_types type, T value)
 {
     static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
+                          std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
                           std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));
 
     switch (type)
index ecc72fc..3947e56 100644 (file)
@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
     return llabs(_X);
 }
 
+#ifdef HOST_64BIT
+inline __int64 abs(SSIZE_T _X) {
+    return llabs((__int64)_X);
+}
+#endif
+
 }
 #endif
 
index 90378a8..ddeb135 100644 (file)
@@ -195,12 +195,7 @@ extern "C" {
 // they must be either signed or unsigned) and we want to be able to use
 // __int64 as though it were intrinsic
 
-#ifdef HOST_64BIT
-#define __int64     long
-#else // HOST_64BIT
 #define __int64     long long
-#endif // HOST_64BIT
-
 #define __int32     int
 #define __int16     short int
 #define __int8      char        // assumes char is signed
@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
 #define UlongToPtr(ul) ULongToPtr(ul)
 #define UintToPtr(ui)  UIntToPtr(ui)
 
-typedef ULONG_PTR SIZE_T, *PSIZE_T;
-typedef LONG_PTR SSIZE_T, *PSSIZE_T;
+#ifdef HOST_64BIT
+typedef unsigned long SIZE_T;
+typedef long SSIZE_T;
+#else
+typedef unsigned int SIZE_T;
+typedef int SSIZE_T;
+#endif
+
+static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
+static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");
 
 #ifndef SIZE_T_MAX
 #define SIZE_T_MAX ULONG_PTR_MAX
@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
 #endif
 
 #ifndef PAL_STDCPP_COMPAT
-#if defined(__APPLE_CC__) || defined(__linux__)
 #ifdef HOST_64BIT
 typedef unsigned long size_t;
+typedef long ssize_t;
 typedef long ptrdiff_t;
 #else // !HOST_64BIT
 typedef unsigned int size_t;
 typedef int ptrdiff_t;
 #endif // !HOST_64BIT
-#else
-typedef ULONG_PTR size_t;
-typedef LONG_PTR ptrdiff_t;
-#endif
 #endif // !PAL_STDCPP_COMPAT
 #define _SIZE_T_DEFINED
 
@@ -596,8 +595,8 @@ typedef int intptr_t;
 typedef unsigned int uintptr_t;
 #endif // !HOST_64BIT
 #else
-typedef INT_PTR intptr_t;
-typedef UINT_PTR uintptr_t;
+typedef long int intptr_t;
+typedef unsigned long int uintptr_t;
 #endif
 
 #endif // PAL_STDCPP_COMPAT
index 87bb1d4..22c72ee 100644 (file)
@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
 static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
 {
 #if defined(TARGET_AMD64)
-    GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
 #elif defined(TARGET_X86)
     GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
     GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
     GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
     GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
 #elif defined(TARGET_ARM64)
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
 #elif defined(TARGET_LOONGARCH64)
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
 #elif defined(TARGET_S390X)
-    GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
 #elif defined(TARGET_POWERPC64)
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
 #else
 #error unsupported architecture
 #endif
index e26a53b..e94922c 100644 (file)
@@ -518,12 +518,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
 void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
 {
 #if (defined(HOST_UNIX) && defined(HOST_AMD64)) || (defined(HOST_WINDOWS) && defined(TARGET_AMD64))
-    GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T **)&contextPointers->Rbp);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T **)&contextPointers->Rbx);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T **)&contextPointers->R12);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T **)&contextPointers->R13);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T **)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T **)&contextPointers->R15);
 #elif (defined(HOST_UNIX) && defined(HOST_X86)) || (defined(HOST_WINDOWS) && defined(TARGET_X86))
     GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
     GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
@@ -547,101 +547,101 @@ void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOL
     GetContextPointer(cursor, unwContext, UNW_ARM_D14, (SIZE_T **)&contextPointers->D14);
     GetContextPointer(cursor, unwContext, UNW_ARM_D15, (SIZE_T **)&contextPointers->D15);
 #elif (defined(HOST_UNIX) && defined(HOST_ARM64)) || (defined(HOST_WINDOWS) && defined(TARGET_ARM64))
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V8, &contextPointers->D8);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V9, &contextPointers->D9);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V10, &contextPointers->D10);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V11, &contextPointers->D11);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V12, &contextPointers->D12);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V13, &contextPointers->D13);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V14, &contextPointers->D14);
-    GetContextPointer(cursor, unwContext, UNW_AARCH64_V15, &contextPointers->D15);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V8, (SIZE_T**)&contextPointers->D8);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V9, (SIZE_T**)&contextPointers->D9);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V10, (SIZE_T**)&contextPointers->D10);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V11, (SIZE_T**)&contextPointers->D11);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V12, (SIZE_T**)&contextPointers->D12);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V13, (SIZE_T**)&contextPointers->D13);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V14, (SIZE_T**)&contextPointers->D14);
+    GetContextPointer(cursor, unwContext, UNW_AARCH64_V15, (SIZE_T**)&contextPointers->D15);
 #elif (defined(HOST_UNIX) && defined(HOST_S390X))
-    GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
 #elif (defined(HOST_UNIX) && defined(HOST_LOONGARCH64))
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
-    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
+    GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
 #elif (defined(HOST_UNIX) && defined(HOST_RISCV64))
 #error "TODO-RISCV64: review this"
 
     // https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/2d865a2964fe06bfc569ab00c74e152b582ed764/riscv-cc.adoc
 
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X1, &contextPointers->Ra);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X4, &contextPointers->Tp);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X5, &contextPointers->T0);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X7, &contextPointers->T1);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X8, &contextPointers->S0);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X9, &contextPointers->S1);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X10, &contextPointers->A0);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X11, &contextPointers->A1);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X12, &contextPointers->A2);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X13, &contextPointers->A3);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X14, &contextPointers->A4);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X15, &contextPointers->A5);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X16, &contextPointers->A6);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X17, &contextPointers->A7);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X18, &contextPointers->S2);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X19, &contextPointers->S3);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X20, &contextPointers->S4);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X21, &contextPointers->S5);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X22, &contextPointers->S6);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X23, &contextPointers->S7);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X24, &contextPointers->S8);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X25, &contextPointers->S9);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X26, &contextPointers->S10);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X27, &contextPointers->S11);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X28, &contextPointers->T3);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X29, &contextPointers->T4);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X30, &contextPointers->T5);
-    GetContextPointer(cursor, unwContext, UNW_RISCV_X31, &contextPointers->T6);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X1, (SIZE_T **)&contextPointers->Ra);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X4, (SIZE_T **)&contextPointers->Tp);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X5, (SIZE_T **)&contextPointers->T0);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X7, (SIZE_T **)&contextPointers->T1);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X8, (SIZE_T **)&contextPointers->S0);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X9, (SIZE_T **)&contextPointers->S1);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X10, (SIZE_T **)&contextPointers->A0);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X11, (SIZE_T **)&contextPointers->A1);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X12, (SIZE_T **)&contextPointers->A2);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X13, (SIZE_T **)&contextPointers->A3);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X14, (SIZE_T **)&contextPointers->A4);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X15, (SIZE_T **)&contextPointers->A5);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X16, (SIZE_T **)&contextPointers->A6);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X17, (SIZE_T **)&contextPointers->A7);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X18, (SIZE_T **)&contextPointers->S2);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X19, (SIZE_T **)&contextPointers->S3);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X20, (SIZE_T **)&contextPointers->S4);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X21, (SIZE_T **)&contextPointers->S5);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X22, (SIZE_T **)&contextPointers->S6);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X23, (SIZE_T **)&contextPointers->S7);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X24, (SIZE_T **)&contextPointers->S8);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X25, (SIZE_T **)&contextPointers->S9);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X26, (SIZE_T **)&contextPointers->S10);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X27, (SIZE_T **)&contextPointers->S11);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X28, (SIZE_T **)&contextPointers->T3);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X29, (SIZE_T **)&contextPointers->T4);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X30, (SIZE_T **)&contextPointers->T5);
+    GetContextPointer(cursor, unwContext, UNW_RISCV_X31, (SIZE_T **)&contextPointers->T6);
 #elif (defined(HOST_UNIX) && defined(HOST_POWERPC64))
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
-    GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
+    GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
 #else
 #error unsupported architecture
 #endif
index d9ddb02..102a012 100644 (file)
@@ -438,7 +438,7 @@ GlobalMemoryStatusEx(
         {
             // Ensure that we don't try to read the /proc/meminfo in successive calls to the GlobalMemoryStatusEx
             // if we have failed to access the file or the file didn't contain the MemAvailable value.
-            tryReadMemInfo = ReadMemAvailable(&lpBuffer->ullAvailPhys);
+            tryReadMemInfo = ReadMemAvailable((uint64_t*)&lpBuffer->ullAvailPhys);
         }
 
         if (!tryReadMemInfo)
index f66f05c..d5bee67 100644 (file)
@@ -4,6 +4,7 @@
 #include "strike.h"
 #include "util.h"
 #include <stdio.h>
+#include <stdint.h>
 #include <ctype.h>
 #include <minipal/utils.h>
 
@@ -15,14 +16,9 @@ class MapViewHolder
     void* whatever;
 };
 
-typedef unsigned char uint8_t;
-typedef unsigned int uint32_t;
-#ifdef HOST_WINDOWS
-typedef long long int64_t;
-#else
+#ifndef HOST_WINDOWS
 #define FEATURE_PAL
 #endif
-typedef size_t uint64_t;
 #endif // STRESS_LOG
 #define STRESS_LOG_READONLY
 #include "../../../inc/stresslog.h"
index 88ca852..4a41414 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <math.h>
 
 #ifndef INFINITY
@@ -32,13 +33,6 @@ class MapViewHolder
     void* whatever;
 };
 
-typedef unsigned char uint8_t;
-typedef unsigned int uint32_t;
-#ifdef HOST_WINDOWS
-typedef long long int64_t;
-#endif
-typedef size_t uint64_t;
-
 bool IsInCantAllocStressLogRegion()
 {
     return true;
index 5b59ac7..22c6d31 100644 (file)
@@ -2,11 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 #include <stdio.h>
+#include <stdint.h>
 #include <windows.h>
 
-typedef unsigned char uint8_t;
-typedef unsigned int uint32_t;
-typedef size_t uint64_t;
 typedef void* TADDR;
 extern BOOL g_bDacBroken;
 
index fe6dfce..4f0868d 100644 (file)
@@ -117,7 +117,7 @@ bool GCToOSInterface::Initialize()
     g_pageSizeUnixInl = GetOsPageSize();
 
     uint32_t currentProcessCpuCount = PAL_GetLogicalCpuCountFromOS();
-    if (PAL_GetCurrentThreadAffinitySet(AffinitySet::BitsetDataSize, g_processAffinitySet.GetBitsetData()))
+    if (PAL_GetCurrentThreadAffinitySet(AffinitySet::BitsetDataSize, (UINT_PTR *)g_processAffinitySet.GetBitsetData()))
     {
         _ASSERTE(currentProcessCpuCount == g_processAffinitySet.Count());
     }
index 6c16e67..c7c00ad 100644 (file)
@@ -194,7 +194,7 @@ HRESULT GetAppDomainStaticAddress::ModuleUnloadStarted(ModuleID moduleId)
             {
                 if (DEBUG_OUT)
                 {
-                    printf("ClassID 0x%" PRIxPTR " being removed due to parent module unloading\n", classId);
+                    printf("ClassID 0x%" PRIxPTR " being removed due to parent module unloading\n", (uintptr_t)classId);
                 }
 
                 it = classADMap.erase(it);
@@ -211,7 +211,7 @@ HRESULT GetAppDomainStaticAddress::ModuleUnloadStarted(ModuleID moduleId)
 
                 if (DEBUG_OUT)
                 {
-                    printf("Checking generic argument 0x%" PRIxPTR " of class 0x%" PRIxPTR "\n", typeArg, classId);
+                    printf("Checking generic argument 0x%" PRIxPTR " of class 0x%" PRIxPTR "\n", (uintptr_t)typeArg, (uintptr_t)classId);
                 }
 
                 hr = pCorProfilerInfo->GetClassIDInfo(typeArg, &typeArgModId, NULL);
@@ -285,7 +285,7 @@ HRESULT GetAppDomainStaticAddress::ClassLoadFinished(ClassID classId, HRESULT hr
     hr = pCorProfilerInfo->GetThreadAppDomain(threadId, &appDomainId);
     if (FAILED(hr))
     {
-        printf("GetThreadAppDomain returned 0x%x for ThreadID 0x%" PRIxPTR "\n", hr, threadId);
+        printf("GetThreadAppDomain returned 0x%x for ThreadID 0x%" PRIxPTR "\n", hr, (uintptr_t)threadId);
         ++failures;
         return hr;
     }
@@ -303,7 +303,7 @@ HRESULT GetAppDomainStaticAddress::ClassLoadFinished(ClassID classId, HRESULT hr
                                           NULL);
     if (FAILED(hr))
     {
-        printf("GetClassIDInfo2 returned 0x%x for ClassID 0x%" PRIxPTR "\n", hr, classId);
+        printf("GetClassIDInfo2 returned 0x%x for ClassID 0x%" PRIxPTR "\n", hr, (uintptr_t)classId);
         ++failures;
     }
 
@@ -386,7 +386,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
 
         if (DEBUG_OUT)
         {
-            printf("Calling GetClassIDInfo2 on classId 0x%" PRIxPTR "\n", classId);
+            printf("Calling GetClassIDInfo2 on classId 0x%" PRIxPTR "\n", (uintptr_t)classId);
             fflush(stdout);
         }
 
@@ -400,7 +400,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
                                     NULL);
         if (FAILED(hr))
         {
-            printf("GetClassIDInfo2 returned 0x%x for ClassID 0x%" PRIxPTR "\n", hr, classId);
+            printf("GetClassIDInfo2 returned 0x%x for ClassID 0x%" PRIxPTR "\n", hr, (uintptr_t)classId);
             ++failures;
             continue;
         }
@@ -418,7 +418,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
         }
         else if (FAILED(hr))
         {
-            printf("GetModuleMetaData returned 0x%x  for ModuleID 0x%" PRIxPTR "\n", hr, classModuleId);
+            printf("GetModuleMetaData returned 0x%x  for ModuleID 0x%" PRIxPTR "\n", hr, (uintptr_t)classModuleId);
             ++failures;
             continue;
         }
@@ -430,7 +430,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
 
         if (DEBUG_OUT)
         {
-            printf("Calling GetClassIDInfo2 (again?) on classId 0x%" PRIxPTR "\n", classId);
+            printf("Calling GetClassIDInfo2 (again?) on classId 0x%" PRIxPTR "\n", (uintptr_t)classId);
             fflush(stdout);
         }
 
@@ -513,7 +513,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
 
                     if (DEBUG_OUT)
                     {
-                        printf("Calling GetAppDomainStaticAddress on classId=0x%" PRIxPTR "\n", classId);
+                        printf("Calling GetAppDomainStaticAddress on classId=0x%" PRIxPTR "\n", (uintptr_t)classId);
                         fflush(stdout);
                     }