summaryrefslogtreecommitdiffstats
path: root/meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch')
-rw-r--r--meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch b/meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch
new file mode 100644
index 0000000..bda4807
--- /dev/null
+++ b/meta-bigendian/recipes-devtools/strace/strace/strace-4.8-arm-be8.patch
@@ -0,0 +1,37 @@
1strace: fix system call matching code in get_scno for be8 arm
2
3on ARM V7 operating in big endian mode strace does not work:
4
5root@genericarmv7ab:~# strace ls
6pid 1356 unknown syscall trap 0x000000ef
7
8it happens because ARM V7 when runs as big endian operates in be8 mode,
9where instruction are still in little endian form. Strace get_scno reads
10instructions and matches it to certain pattern, but in armeb case it needs
11to byteswap it before that.
12
13Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
14Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
15---
16 syscall.c | 10 ++++++++++
17 1 file changed, 10 insertions(+)
18
19--- a/syscall.c
20+++ b/syscall.c
21@@ -1374,6 +1374,16 @@ get_scno(struct tcb *tcp)
22 scno = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *)(arm_regs.ARM_pc - 4), NULL);
23 if (errno)
24 return -1;
25+
26+#if defined(__ARMEB__) && defined(__ARM_ARCH_7A__)
27+ /* We running big endian arm on ARMv7: instructions are
28+ * in little endian form so we need to byteswap it. Note
29+ * on older ARM like V5 Xscale code is in big endian form
30+ * byte swap is not needed in this case. I.e be8 vs be32.
31+ */
32+ scno = __builtin_bswap32(scno);
33+#endif /* __ARMEB__ && __ARM_ARCH_7A__ */
34+
35 /* EABI syscall convention? */
36 if (scno != 0xef000000) {
37 /* No, it's OABI */