summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2024-03-18 09:35:21 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2024-03-19 14:50:57 +0100
commit255b70454bcea7eba577b6f18ed9135e2ff51073 (patch)
treea3349f450d9ac5e9b00205064767c1de4a8b7285 /libc
parent75a7dc74cf8980480862a29ff056cec312f9aebf (diff)
riscv64: sync with glibc clone.S
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/riscv64/clone.S8
1 files changed, 7 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/riscv64/clone.S b/libc/sysdeps/linux/riscv64/clone.S
index f7684c88d..315de2ac8 100644
--- a/libc/sysdeps/linux/riscv64/clone.S
+++ b/libc/sysdeps/linux/riscv64/clone.S
@@ -29,6 +29,9 @@
.text
LEAF (clone)
+ /* Align stack to a 128-bit boundary as per RISC-V ABI. */
+ andi a1,a1,ALMASK
+
/* Sanity check arguments. */
beqz a0,L (invalid) /* No NULL function pointers. */
beqz a1,L (invalid) /* No NULL stack pointers. */
@@ -57,7 +60,7 @@ L (invalid):
li a0, -EINVAL
/* Something bad happened -- no child created. */
L (error):
- j __syscall_error
+ tail __syscall_error
END (clone)
/* Load up the arguments to the function. Put this block of code in
@@ -66,6 +69,9 @@ L (error):
ENTRY (__thread_start)
L (thread_start):
+ .cfi_label .Ldummy
+ cfi_undefined (ra)
+
/* Restore the arg for user's function. */
REG_L a1,0(sp) /* Function pointer. */
REG_L a0,SZREG(sp) /* Argument pointer. */