1*4882a593SmuzhiyunFrom 923d25365fbdff17fa4c8c2883960be07c3dad56 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3*4882a593SmuzhiyunDate: Fri, 5 May 2017 09:07:15 +0200
4*4882a593SmuzhiyunSubject: [PATCH] user-exec: fix usage of mcontext structure on ARM/uClibc
5*4882a593Smuzhiyun
6*4882a593Smuzhiyunuser-exec.c has some conditional code to decide how to use the
7*4882a593Smuzhiyunmcontext structure. Unfortunately, since uClibc defines __GLIBC__, but
8*4882a593Smuzhiyunwith old versions of __GLIBC__ and __GLIBC_MINOR__, an old code path
9*4882a593Smuzhiyungets used, which doesn't apply to uClibc.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunFix this by excluding __UCLIBC__, which ensures we fall back to the
12*4882a593Smuzhiyungeneral case of using uc_mcontext.arm_pc, which works fine with
13*4882a593SmuzhiyunuClibc.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
16*4882a593Smuzhiyun---
17*4882a593Smuzhiyun accel/tcg/user-exec.c | 2 +-
18*4882a593Smuzhiyun 1 file changed, 1 insertion(+), 1 deletion(-)
19*4882a593Smuzhiyun
20*4882a593Smuzhiyundiff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
21*4882a593Smuzhiyunindex 4ebe25461a..0496674fbd 100644
22*4882a593Smuzhiyun--- a/accel/tcg/user-exec.c
23*4882a593Smuzhiyun+++ b/accel/tcg/user-exec.c
24*4882a593Smuzhiyun@@ -540,7 +540,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun #if defined(__NetBSD__)
27*4882a593Smuzhiyun     pc = uc->uc_mcontext.__gregs[_REG_R15];
28*4882a593Smuzhiyun-#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
29*4882a593Smuzhiyun+#elif defined(__GLIBC__) && !defined(__UCLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
30*4882a593Smuzhiyun     pc = uc->uc_mcontext.gregs[R15];
31*4882a593Smuzhiyun #else
32*4882a593Smuzhiyun     pc = uc->uc_mcontext.arm_pc;
33*4882a593Smuzhiyun--
34*4882a593Smuzhiyun2.25.3
35*4882a593Smuzhiyun
36