Fix sys_clone() for thumb2.
Sometimes compiler take r7 register for output operand __res because there is no r7 register
in clobber registers for thumb2. And after assign "movs %0, r0\n" sys_clone() call "pop {r7}".
As result _res is corrupted by "pop".
Bug: linux-syscall-support:19
Change-Id: Ia5b56ebe3beb11585ac043738f70f9724c6f9e8d
Reviewed-on: https://chromium-review.googlesource.com/485499
Reviewed-by: Mark Seaborn <mseaborn@chromium.org>
diff --git a/linux_syscall_support.h b/linux_syscall_support.h
index 80a3e56..c3f4584 100644
--- a/linux_syscall_support.h
+++ b/linux_syscall_support.h
@@ -2624,7 +2624,7 @@
/* if (%r0 != 0)
* return %r0;
*/
- "movs %0,r0\n"
+ "cmp r0, #0\n"
"bne 1f\n"
/* In the child, now. Call "fn(arg)".
@@ -2655,8 +2655,9 @@
"swi 0x0\n"
"1:\n"
#ifdef __thumb2__
- "pop {r7}"
+ "pop {r7}\n"
#endif
+ "mov %0, r0"
: "=r" (__res)
: "r"(fn), "r"(__stack), "r"(__flags), "r"(arg),
"r"(__ptid), "r"(__tls), "r"(__ctid),