From 06ad67d549533e11fd3a2488ee776e36441a4d27 Mon Sep 17 00:00:00 2001 From: heyuanjie87 Date: Fri, 21 Jun 2024 09:09:41 +0800 Subject: [PATCH] =?UTF-8?q?[rv]=E4=BF=A1=E5=8F=B7=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E7=94=A8=E6=88=B7=E6=80=81=E5=89=8D=E6=81=A2?= =?UTF-8?q?=E5=A4=8Dgp=20(#9072)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [rv/virt/stackframe.h]添加GP寄存器保存偏移量宏 * 【rv/c906/stackframe.h]定义GP寄存器存储偏移量 * [rv]信号处理切换到用户态前恢复gp --- components/lwp/arch/risc-v/rv64/lwp_gcc.S | 3 +++ libcpu/risc-v/t-head/c906/stackframe.h | 1 + libcpu/risc-v/virt64/stackframe.h | 1 + 3 files changed, 5 insertions(+) diff --git a/components/lwp/arch/risc-v/rv64/lwp_gcc.S b/components/lwp/arch/risc-v/rv64/lwp_gcc.S index 61db9b24e51..c0936623bfd 100644 --- a/components/lwp/arch/risc-v/rv64/lwp_gcc.S +++ b/components/lwp/arch/risc-v/rv64/lwp_gcc.S @@ -174,6 +174,9 @@ arch_thread_signal_enter: /* dummy a2 */ mv a2, a1 + /* restore user GP */ + LOAD gp, FRAME_OFF_GP(s3) + /** * handler(signo, psi, ucontext); */ diff --git a/libcpu/risc-v/t-head/c906/stackframe.h b/libcpu/risc-v/t-head/c906/stackframe.h index d6fd0c3c5ea..6e8ab0c7bd2 100644 --- a/libcpu/risc-v/t-head/c906/stackframe.h +++ b/libcpu/risc-v/t-head/c906/stackframe.h @@ -16,6 +16,7 @@ #define BYTES(idx) ((idx) * REGBYTES) #define FRAME_OFF_SSTATUS BYTES(2) #define FRAME_OFF_SP BYTES(32) +#define FRAME_OFF_GP BYTES(3) #include "cpuport.h" #include "encoding.h" diff --git a/libcpu/risc-v/virt64/stackframe.h b/libcpu/risc-v/virt64/stackframe.h index 550fa8947e2..4caf3bc7ab8 100644 --- a/libcpu/risc-v/virt64/stackframe.h +++ b/libcpu/risc-v/virt64/stackframe.h @@ -21,6 +21,7 @@ #define BYTES(idx) ((idx) * REGBYTES) #define FRAME_OFF_SSTATUS BYTES(2) #define FRAME_OFF_SP BYTES(32) +#define FRAME_OFF_GP BYTES(3) #ifdef __ASSEMBLY__