0001-user-exec-fix-usage-of-mcontext-structure-on-ARM-uCl.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From d3f1e7e9ff9aae3f770b0bcb9aa3c2f787f76a1b Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Fri, 5 May 2017 09:07:15 +0200
  4. Subject: [PATCH] user-exec: fix usage of mcontext structure on ARM/uClibc
  5. user-exec.c has some conditional code to decide how to use the
  6. mcontext structure. Unfortunately, since uClibc defines __GLIBC__, but
  7. with old versions of __GLIBC__ and __GLIBC_MINOR__, an old code path
  8. gets used, which doesn't apply to uClibc.
  9. Fix this by excluding __UCLIBC__, which ensures we fall back to the
  10. general case of using uc_mcontext.arm_pc, which works fine with
  11. uClibc.
  12. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  13. ---
  14. user-exec.c | 2 +-
  15. 1 file changed, 1 insertion(+), 1 deletion(-)
  16. diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
  17. index 6db0758..2b3d116 100644
  18. --- a/accel/tcg/user-exec.c
  19. +++ b/accel/tcg/user-exec.c
  20. @@ -463,7 +463,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
  21. #if defined(__NetBSD__)
  22. pc = uc->uc_mcontext.__gregs[_REG_R15];
  23. -#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
  24. +#elif defined(__GLIBC__) && !defined(__UCLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
  25. pc = uc->uc_mcontext.gregs[R15];
  26. #else
  27. pc = uc->uc_mcontext.arm_pc;
  28. --
  29. 2.7.4