Skip to content

Commit

Permalink
[RISC-V, LOONGARCH64] Fix FuncEvalHijack stackallocation (#88493)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mustafin authored Jul 8, 2023
1 parent e05b3e7 commit b6266a6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/coreclr/debug/ee/loongarch64/dbghelpers.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// hijacking stub used to perform a func-eval, see Debugger::FuncEvalSetup() for use.
//
// on entry:
// x0 : pointer to DebuggerEval object
// a0 : pointer to DebuggerEval object
//

// @dbgtodo- once we port Funceval, use the ExceptionHijack stub instead of this func-eval stub.
Expand All @@ -17,9 +17,9 @@ NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix
// you change the prolog you will also need to update the personality routine.

// push arg to the stack so our personality routine can find it
// push lr to get good stacktrace in debugger
// push ra to get good stacktrace in debugger
// $fp,$ra
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, -32
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, 32
st.d $a0, $sp, 16

// FuncEvalHijackWorker returns the address we should jump to.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/ee/riscv64/dbghelpers.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix
// you change the prolog you will also need to update the personality routine.

// push arg to the stack so our personality routine can find it
// push lr to get good stacktrace in debugger
PROLOG_SAVE_REG_PAIR_INDEXED fp, ra, -32
// push ra to get good stacktrace in debugger
PROLOG_SAVE_REG_PAIR_INDEXED fp, ra, 32
sd a0, 16(sp)

// FuncEvalHijackWorker returns the address we should jump to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ C_FUNC(ActivationHandlerReturnOffset):

NESTED_ENTRY ActivationHandlerWrapper, _TEXT, NoHandler
// $fp,$ra
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, -(16 + CONTEXT_Size)
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, (16 + CONTEXT_Size)
// Should never actually run
EMIT_BREAKPOINT
bl EXTERNAL_C_FUNC(ActivationHandler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ C_FUNC(PAL_DispatchExceptionReturnOffset):

NESTED_ENTRY PAL_DispatchExceptionWrapper, _TEXT, NoHandler
// $fp,$ra
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, -16
PROLOG_SAVE_REG_PAIR_INDEXED 22, 1, 16
// Should never actually run
EMIT_BREAKPOINT
bl EXTERNAL_C_FUNC(PAL_DispatchException)
Expand Down

0 comments on commit b6266a6

Please sign in to comment.