ucontext.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* struct ucontext definition, LoongArch64 version.
  2. Copyright (C) 2024 uClibc-ng contributors.
  3. Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. #ifndef _SYS_UCONTEXT_H
  6. #define _SYS_UCONTEXT_H 1
  7. #include <features.h>
  8. #include <signal.h>
  9. #include <bits/sigcontext.h>
  10. #ifdef __USE_MISC
  11. # define NGREG 32
  12. # define LARCH_REG_RA 1
  13. # define LARCH_REG_SP 3
  14. # define LARCH_REG_S0 23
  15. # define LARCH_REG_S1 24
  16. # define LARCH_REG_A0 4
  17. # define LARCH_REG_S2 25
  18. # define LARCH_REG_NARGS 8
  19. typedef unsigned long int greg_t;
  20. /* Container for all general registers. */
  21. typedef unsigned long int gregset_t[32];
  22. #endif
  23. typedef struct mcontext_t
  24. {
  25. unsigned long long int __pc;
  26. unsigned long long int __gregs[32];
  27. unsigned int __flags;
  28. unsigned long long int __extcontext[0]
  29. __attribute__ ((__aligned__ (16)));
  30. } mcontext_t;
  31. /* Userlevel context. */
  32. typedef struct ucontext
  33. {
  34. unsigned long int __uc_flags;
  35. struct ucontext *uc_link;
  36. stack_t uc_stack;
  37. sigset_t uc_sigmask;
  38. /* Padding to allow sigset_t to be expanded in the future. */
  39. char __glibc_reserved[1024 / 8 - sizeof (sigset_t)];
  40. mcontext_t uc_mcontext;
  41. } ucontext_t;
  42. #endif /* sys/ucontext.h */