mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Hongliang Wang <wanghongliang@loongson.cn>
To: musl@lists.openwall.com
Subject: [musl] LoongArch: __clone:adjust stack to 16 align.
Date: Mon, 26 Feb 2024 16:42:30 +0800	[thread overview]
Message-ID: <3e2bbb10-9a93-3fb3-a3e7-a37331ca2b3c@loongson.cn> (raw)

[-- 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


                 reply	other threads:[~2024-02-26  8:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e2bbb10-9a93-3fb3-a3e7-a37331ca2b3c@loongson.cn \
    --to=wanghongliang@loongson.cn \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).