summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-02-08 05:39:59 +0100
committerRich Felker <dalias@aerifal.cx>2025-02-21 19:56:28 -0500
commit5e03c03fcde3534b37a0b995a438cd176d6882d3 (patch)
treed518e50885df2ac31337fec4fbe9589c04460f37
parent06c5e4e832f4796be02c743270fb554f978de02c (diff)
downloadmusl-5e03c03fcde3534b37a0b995a438cd176d6882d3.tar.gz
clone: align the given stack pointer on or1k and riscv
This was an oversight specific to these archs; others have always aligned the new stack pointer correctly.
-rw-r--r--src/thread/or1k/clone.s2
-rw-r--r--src/thread/riscv32/clone.s1
-rw-r--r--src/thread/riscv64/clone.s1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/thread/or1k/clone.s b/src/thread/or1k/clone.s
index 2473ac20..9a84aeba 100644
--- a/src/thread/or1k/clone.s
+++ b/src/thread/or1k/clone.s
@@ -6,6 +6,8 @@
.hidden __clone
.type __clone,@function
__clone:
+ l.xori r11, r0, -4
+ l.and r4, r4, r11
l.addi r4, r4, -8
l.sw 0(r4), r3
l.sw 4(r4), r6
diff --git a/src/thread/riscv32/clone.s b/src/thread/riscv32/clone.s
index 3102239d..e2116e33 100644
--- a/src/thread/riscv32/clone.s
+++ b/src/thread/riscv32/clone.s
@@ -8,6 +8,7 @@
.type __clone, %function
__clone:
# Save func and arg to stack
+ andi a1, a1, -16
addi a1, a1, -16
sw a0, 0(a1)
sw a3, 4(a1)
diff --git a/src/thread/riscv64/clone.s b/src/thread/riscv64/clone.s
index db908248..0e6f41a8 100644
--- a/src/thread/riscv64/clone.s
+++ b/src/thread/riscv64/clone.s
@@ -8,6 +8,7 @@
.type __clone, %function
__clone:
# Save func and arg to stack
+ andi a1, a1, -16
addi a1, a1, -16
sd a0, 0(a1)
sd a3, 8(a1)