mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] LoongArch: __clone:adjust stack to 16 align.
@ 2024-02-26  8:42 Hongliang Wang
  0 siblings, 0 replies; only message in thread
From: Hongliang Wang @ 2024-02-26  8:42 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Hi,

According to LoongArch ABI Specs, stack need to be 16 align
to improve performance and compiler layout of stack frames.

---
  src/thread/loongarch64/clone.s | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/thread/loongarch64/clone.s b/src/thread/loongarch64/clone.s
index e971ab4b..a165b365 100644
--- a/src/thread/loongarch64/clone.s
+++ b/src/thread/loongarch64/clone.s
@@ -7,6 +7,7 @@
  .hidden __clone
  .type __clone,@function
  __clone:
+	bstrins.d $a1, $zero, 3, 0   #stack to 16 align
  	# Save function pointer and argument pointer on new thread stack
  	addi.d  $a1, $a1, -16
  	st.d    $a0, $a1, 0     # save function pointer
-- 
2.37.1


Regards,
Hongliang Wang


[-- Attachment #2: 0001-LoongArch-__clone-adjust-stack-to-16-align.patch --]
[-- Type: text/x-patch, Size: 926 bytes --]

From 12b17ef912050bbbcafe48eb0ac9326ca565d782 Mon Sep 17 00:00:00 2001
From: wanghongliang <wanghongliang@loongson.cn>
Date: Mon, 26 Feb 2024 02:12:28 +0800
Subject: [PATCH] LoongArch:__clone:adjust stack to 16 align.

According to LoongArch ABI Specs, stack need to be 16 align
to improve performance and compiler layout of stack frames.

Signed-off-by: wanghongliang <wanghongliang@loongson.cn>
---
 src/thread/loongarch64/clone.s | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/thread/loongarch64/clone.s b/src/thread/loongarch64/clone.s
index e971ab4b..a165b365 100644
--- a/src/thread/loongarch64/clone.s
+++ b/src/thread/loongarch64/clone.s
@@ -7,6 +7,7 @@
 .hidden __clone
 .type __clone,@function
 __clone:
+	bstrins.d $a1, $zero, 3, 0   #stack to 16 align
 	# Save function pointer and argument pointer on new thread stack
 	addi.d  $a1, $a1, -16
 	st.d    $a0, $a1, 0     # save function pointer
-- 
2.37.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-26  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26  8:42 [musl] LoongArch: __clone:adjust stack to 16 align Hongliang Wang

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).