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