ucontext.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2026 Waldemar Brodkorb <wbx@uclibc-ng.org>
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. /* struct ucontext definition.
  6. Copyright (C) 2022-2026 Free Software Foundation, Inc.
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library. If not, see
  17. <https://www.gnu.org/licenses/>. */
  18. /* Don't rely on this, the interface is currently messed up and may need to
  19. be broken to be fixed. */
  20. #ifndef _SYS_UCONTEXT_H
  21. #define _SYS_UCONTEXT_H 1
  22. #include <features.h>
  23. #ifdef __USE_MISC
  24. #define LARCH_NGREG 32
  25. #define LARCH_REG_RA 1
  26. #define LARCH_REG_SP 3
  27. #define LARCH_REG_S0 23
  28. #define LARCH_REG_S1 24
  29. #define LARCH_REG_A0 4
  30. #define LARCH_REG_S2 25
  31. #define LARCH_REG_NARGS 8
  32. typedef unsigned long int greg_t;
  33. /* Container for all general registers. */
  34. typedef greg_t gregset_t[32];
  35. #endif
  36. typedef struct mcontext_t
  37. {
  38. unsigned long long __pc;
  39. unsigned long long __gregs[32];
  40. unsigned int __flags;
  41. unsigned long long __extcontext[0] __attribute__((__aligned__(16)));
  42. } mcontext_t;
  43. /* Userlevel context. */
  44. typedef struct ucontext_t
  45. {
  46. unsigned long int __uc_flags;
  47. struct ucontext_t *uc_link;
  48. stack_t uc_stack;
  49. sigset_t uc_sigmask;
  50. mcontext_t uc_mcontext;
  51. } ucontext_t;
  52. #endif /* sys/ucontext.h */