summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2018-05-24 10:48:55 -0400
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit059f624b552e0cedf6683bd7dad62ed950e9f5b4 (patch)
tree81e1dc68cfedcd8ade803975eb2a2f2a3b33164f /src/basic
parent879dc2984771e5a24a01bd752d3fa3ebfeccb1ff (diff)
basic: fix raw_clone() on 32-bit sparc
The clone syscall uses the same semantics as on 64-bit. The trap number for syscall entry is different. Bug: https://bugs.gentoo.org/656368
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/raw-clone.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/raw-clone.h b/src/basic/raw-clone.h
index d8a686631..d35540903 100644
--- a/src/basic/raw-clone.h
+++ b/src/basic/raw-clone.h
@@ -39,10 +39,10 @@ static inline pid_t raw_clone(unsigned long flags) {
/* On s390/s390x and cris the order of the first and second arguments
* of the raw clone() system call is reversed. */
ret = (pid_t) syscall(__NR_clone, NULL, flags);
-#elif defined(__sparc__) && defined(__arch64__)
+#elif defined(__sparc__)
{
/**
- * sparc64 always returns the other process id in %o0, and
+ * sparc always returns the other process id in %o0, and
* a boolean flag whether this is the child or the parent in
* %o1. Inline assembly is needed to get the flag returned
* in %o1.
@@ -52,7 +52,11 @@ static inline pid_t raw_clone(unsigned long flags) {
asm volatile("mov %2, %%g1\n\t"
"mov %3, %%o0\n\t"
"mov 0 , %%o1\n\t"
+#if defined(__arch64__)
"t 0x6d\n\t"
+#else
+ "t 0x10\n\t"
+#endif
"mov %%o1, %0\n\t"
"mov %%o0, %1" :
"=r"(in_child), "=r"(child_pid) :