From: JianTao Shan <shanjiantao@loongson.cn>
To: musl@lists.openwall.com
Cc: lixing@loongson.cn, wanghongliang@loongson.cn,
huajingyun@loongson.cn, JianTao Shan <shanjiantao@loongson.cn>
Subject: [musl] [PATCH] loongarch64: add fpu and simd context to signal.h
Date: Mon, 23 Sep 2024 02:52:29 +0000 [thread overview]
Message-ID: <20240923025229.1127803-1-shanjiantao@loongson.cn> (raw)
The signal stack extension field of loongarch64 is mutable, and the types
are distinguished according to some magic. The lack of this part of the uapi
definition will cause some projects such as dotnet to fail to compile on musl.
---
arch/loongarch64/bits/signal.h | 50 ++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/arch/loongarch64/bits/signal.h b/arch/loongarch64/bits/signal.h
index 5a9ed8c9..1487c0d7 100644
--- a/arch/loongarch64/bits/signal.h
+++ b/arch/loongarch64/bits/signal.h
@@ -18,6 +18,14 @@
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+/* FP context was used */
+#define SC_USED_FP (1 << 0)
+/* Address error was due to memory load */
+#define SC_ADDRERR_RD (1 << 30)
+/* Address error was due to memory store */
+#define SC_ADDRERR_WR (1 << 31)
+
+/* FPU context */
typedef unsigned long greg_t, gregset_t[32];
struct sigcontext {
@@ -26,6 +34,48 @@ struct sigcontext {
unsigned sc_flags;
unsigned long sc_extcontext[] __attribute__((__aligned__(16)));
};
+
+#define CONTEXT_INFO_ALIGN 16
+struct sctx_info {
+ unsigned magic;
+ unsigned size;
+ unsigned long padding; /* padding to 16 bytes */
+};
+
+#define FPU_CTX_MAGIC 0x46505501
+#define FPU_CTX_ALIGN 8
+struct fpu_context {
+ unsigned long regs[32];
+ unsigned long fcc;
+ unsigned fcsr;
+};
+
+/* LSX context */
+#define LSX_CTX_MAGIC 0x53580001
+#define LSX_CTX_ALIGN 16
+struct lsx_context {
+ unsigned long regs[2*32];
+ unsigned long fcc;
+ unsigned fcsr;
+};
+
+/* LASX context */
+#define LASX_CTX_MAGIC 0x41535801
+#define LASX_CTX_ALIGN 32
+struct lasx_context {
+ unsigned long regs[4*32];
+ unsigned long fcc;
+ unsigned fcsr;
+};
+
+/* LBT context */
+#define LBT_CTX_MAGIC 0x42540001
+#define LBT_CTX_ALIGN 8
+struct lbt_context {
+ unsigned long regs[4];
+ unsigned eflags;
+ unsigned ftop;
+};
#endif
typedef struct {
--
2.46.1
reply other threads:[~2024-09-23 2:53 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=20240923025229.1127803-1-shanjiantao@loongson.cn \
--to=shanjiantao@loongson.cn \
--cc=huajingyun@loongson.cn \
--cc=lixing@loongson.cn \
--cc=musl@lists.openwall.com \
--cc=wanghongliang@loongson.cn \
/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).