Skip to content

Commit

Permalink
[RISCV-V] Fix context restoration as 101709
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mustafin committed May 13, 2024
1 parent fc76b1c commit 1e6b313
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/coreclr/pal/src/arch/riscv64/context2.S
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ LOCAL_LABEL(No_Restore_CONTEXT_INTEGER):
beqz t1, LOCAL_LABEL(No_Restore_CONTEXT_CONTROL)

ld ra, (CONTEXT_Ra)(t4)
ld t1, (CONTEXT_T4)(t4)
ld fp, (CONTEXT_Sp)(t4)
sd t1, -8(fp)
ld fp, (CONTEXT_Fp)(t4)
ld sp, (CONTEXT_Sp)(t4)
ld t1, (CONTEXT_Pc)(t4) // Since we cannot control $pc directly, we're going to corrupt t1
ld t4, (CONTEXT_T4)(t4)
ld sp, (CONTEXT_Sp)(t4)
ld t4, -8(sp)
jr t1

LOCAL_LABEL(No_Restore_CONTEXT_CONTROL):
Expand Down

0 comments on commit 1e6b313

Please sign in to comment.