Skip to content

Commit

Permalink
[rv]信号处理进入用户态前恢复gp (RT-Thread#9072)
Browse files Browse the repository at this point in the history
* [rv/virt/stackframe.h]添加GP寄存器保存偏移量宏

* 【rv/c906/stackframe.h]定义GP寄存器存储偏移量

* [rv]信号处理切换到用户态前恢复gp
  • Loading branch information
heyuanjie87 authored Jun 21, 2024
1 parent af5bd68 commit 06ad67d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/lwp/arch/risc-v/rv64/lwp_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -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);
*/
Expand Down
1 change: 1 addition & 0 deletions libcpu/risc-v/t-head/c906/stackframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions libcpu/risc-v/virt64/stackframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down

0 comments on commit 06ad67d

Please sign in to comment.