Skip to content

Commit

Permalink
[LoongArch64] Fix nonvolatile context restoration referenced 101709. (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
shushanhf authored and Ruihan-Yin committed May 30, 2024
1 parent b4a2f92 commit 8bee264
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/pal/src/arch/loongarch64/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#define CONTEXT_T6 CONTEXT_T5+SIZEOF_LOONGARCH_GPR
#define CONTEXT_T7 CONTEXT_T6+SIZEOF_LOONGARCH_GPR
#define CONTEXT_T8 CONTEXT_T7+SIZEOF_LOONGARCH_GPR
#define CONTEXT_X0 CONTEXT_T8+SIZEOF_LOONGARCH_GPR
#define CONTEXT_Fp CONTEXT_X0+SIZEOF_LOONGARCH_GPR
#define CONTEXT_R21 CONTEXT_T8+SIZEOF_LOONGARCH_GPR
#define CONTEXT_Fp CONTEXT_R21+SIZEOF_LOONGARCH_GPR
#define CONTEXT_S0 CONTEXT_Fp+SIZEOF_LOONGARCH_GPR
#define CONTEXT_S1 CONTEXT_S0+SIZEOF_LOONGARCH_GPR
#define CONTEXT_S2 CONTEXT_S1+SIZEOF_LOONGARCH_GPR
Expand Down
7 changes: 4 additions & 3 deletions src/coreclr/pal/src/arch/loongarch64/context2.S
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ LOCAL_LABEL(No_Restore_CONTEXT_INTEGER):

ld.d $ra, $t4, CONTEXT_Ra
ld.d $fp, $t4, CONTEXT_Fp
ld.d $sp, $t4, CONTEXT_Sp
ld.d $r21, $t4, CONTEXT_Pc
ld.d $t4, $t4, CONTEXT_T4
ld.d $sp, $t4, CONTEXT_Sp
// NOTE: the r21 and t4 had been trashed.
jirl $r0, $r21, 0


LOCAL_LABEL(No_Restore_CONTEXT_CONTROL):
ld.d $r21, $t4, CONTEXT_R21
ld.d $t4, $t4, CONTEXT_T4
jirl $r0, $ra, 0
LEAF_END RtlRestoreContext, _TEXT
Expand Down Expand Up @@ -202,7 +203,7 @@ LOCAL_LABEL(Done_CONTEXT_CONTROL):
st.d $t6, $a0, CONTEXT_T6
st.d $t7, $a0, CONTEXT_T7
st.d $t8, $a0, CONTEXT_T8
st.d $r21,$a0, CONTEXT_X0
st.d $r21,$a0, CONTEXT_R21
st.d $s0, $a0, CONTEXT_S0
st.d $s1, $a0, CONTEXT_S1
st.d $s2, $a0, CONTEXT_S2
Expand Down

0 comments on commit 8bee264

Please sign in to comment.