1 // This is an incomplete & imprecice implementation of the *nix file 2 // by the same name 3 4 5 // Since this is only intended for VC++ compilers 6 // use #pragma once instead of guard macros 7 #pragma once 8 9 #ifdef _MSC_VER // Only for cross compilation to windows 10 #include <inttypes.h> 11 12 #if defined(__linux__) && defined(__x86_64__) 13 # define SIZEOF_UCONTEXT 936 14 #elif defined(__linux__) && defined(__aarch64__) 15 # define SIZEOF_UCONTEXT 4560 16 #elif defined(__linux__) && defined(__arm__) 17 # define SIZEOF_UCONTEXT 744 18 #elif !defined(SIZEOF_UCONTEXT) 19 // It is not clear whether the sizeof(ucontext_t) is important 20 // While compiling on Windows the members are not referenced... 21 // However the size maybe important during a case or a memcpy 22 // Barring a full audit it could be important so require the size to be defined 23 # error SIZEOF_UCONTEXT is unknown for this target 24 #endif 25 26 typedef struct ucontext 27 { 28 uint8_t content[SIZEOF_UCONTEXT]; 29 } ucontext_t; 30 31 #ifdef __aarch64__ 32 // These types are used in the definition of the aarch64 unw_tdep_context_t 33 // They are not used in UNW_REMOTE_ONLY, so typedef them as something 34 typedef long sigset_t; 35 typedef long stack_t; 36 37 // Windows SDK defines reserved. It conflicts with arm64 ucontext 38 // Undefine it 39 #undef __reserved 40 #endif 41 42 #endif // _MSC_VER 43