From 34d6509c1ebec9ea23131974dc37d5e764dd440d Mon Sep 17 00:00:00 2001 From: Hongchen Zhang Date: Wed, 16 Aug 2023 10:29:44 +0800 Subject: [PATCH] LoongArch: export lsx/lasx related struct to user space LoongArch inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7TK5K ------------------------------------------ To keep consistent with upstream uapi headers,we expoort lsx/lasx related struct to user space. Signed-off-by: Hongchen Zhang (cherry picked from commit 8610af34f76c77f7258e858b60580074aadd4c7c) --- arch/loongarch/include/uapi/asm/ptrace.h | 10 ++++++++++ arch/loongarch/include/uapi/asm/sigcontext.h | 18 ++++++++++++++++++ arch/loongarch/kernel/signal.c | 18 ------------------ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/arch/loongarch/include/uapi/asm/ptrace.h b/arch/loongarch/include/uapi/asm/ptrace.h index 083193f4a5d5..5e437b44756a 100644 --- a/arch/loongarch/include/uapi/asm/ptrace.h +++ b/arch/loongarch/include/uapi/asm/ptrace.h @@ -46,6 +46,16 @@ struct user_fp_state { uint32_t fcsr; }; +struct user_lsx_state { + /* 32 registers, 128 bits width per register. */ + uint64_t vregs[32*2]; +}; + +struct user_lasx_state { + /* 32 registers, 256 bits width per register. */ + uint64_t vregs[32*4]; +}; + #define PTRACE_SYSEMU 0x1f #define PTRACE_SYSEMU_SINGLESTEP 0x20 diff --git a/arch/loongarch/include/uapi/asm/sigcontext.h b/arch/loongarch/include/uapi/asm/sigcontext.h index 52e49b8bf4be..4cd7d16f7037 100644 --- a/arch/loongarch/include/uapi/asm/sigcontext.h +++ b/arch/loongarch/include/uapi/asm/sigcontext.h @@ -41,4 +41,22 @@ struct fpu_context { __u32 fcsr; }; +/* LSX context */ +#define LSX_CTX_MAGIC 0x53580001 +#define LSX_CTX_ALIGN 16 +struct lsx_context { + __u64 regs[2*32]; + __u64 fcc; + __u32 fcsr; +}; + +/* LASX context */ +#define LASX_CTX_MAGIC 0x41535801 +#define LASX_CTX_ALIGN 32 +struct lasx_context { + __u64 regs[4*32]; + __u64 fcc; + __u32 fcsr; +}; + #endif /* _UAPI_ASM_SIGCONTEXT_H */ diff --git a/arch/loongarch/kernel/signal.c b/arch/loongarch/kernel/signal.c index f268a1639a34..08d80842fa99 100644 --- a/arch/loongarch/kernel/signal.c +++ b/arch/loongarch/kernel/signal.c @@ -80,24 +80,6 @@ struct extctx_layout { struct _ctx_layout end; }; -/* LSX context */ -#define LSX_CTX_MAGIC 0x53580001 -#define LSX_CTX_ALIGN 16 -struct lsx_context { - __u64 regs[2*32]; - __u64 fcc; - __u32 fcsr; -}; - -/* LASX context */ -#define LASX_CTX_MAGIC 0x41535801 -#define LASX_CTX_ALIGN 32 -struct lasx_context { - __u64 regs[4*32]; - __u64 fcc; - __u32 fcsr; -}; - static void __user *get_ctx_through_ctxinfo(struct sctx_info *info) { return (void __user *)((char *)info + sizeof(struct sctx_info)); -- Gitee