[rv]信号处理进入用户态前恢复gp (#9072)

* [rv/virt/stackframe.h]添加GP寄存器保存偏移量宏

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

* [rv]信号处理切换到用户态前恢复gp
This commit is contained in:
heyuanjie87 2024-06-21 09:09:41 +08:00 committed by GitHub
parent af5bd68c58
commit 06ad67d549
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 0 deletions

View File

@ -174,6 +174,9 @@ arch_thread_signal_enter:
/* dummy a2 */ /* dummy a2 */
mv a2, a1 mv a2, a1
/* restore user GP */
LOAD gp, FRAME_OFF_GP(s3)
/** /**
* handler(signo, psi, ucontext); * handler(signo, psi, ucontext);
*/ */

View File

@ -16,6 +16,7 @@
#define BYTES(idx) ((idx) * REGBYTES) #define BYTES(idx) ((idx) * REGBYTES)
#define FRAME_OFF_SSTATUS BYTES(2) #define FRAME_OFF_SSTATUS BYTES(2)
#define FRAME_OFF_SP BYTES(32) #define FRAME_OFF_SP BYTES(32)
#define FRAME_OFF_GP BYTES(3)
#include "cpuport.h" #include "cpuport.h"
#include "encoding.h" #include "encoding.h"

View File

@ -21,6 +21,7 @@
#define BYTES(idx) ((idx) * REGBYTES) #define BYTES(idx) ((idx) * REGBYTES)
#define FRAME_OFF_SSTATUS BYTES(2) #define FRAME_OFF_SSTATUS BYTES(2)
#define FRAME_OFF_SP BYTES(32) #define FRAME_OFF_SP BYTES(32)
#define FRAME_OFF_GP BYTES(3)
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__