From b6266a6e4ceac8708304eed764e25777d08cf184 Mon Sep 17 00:00:00 2001 From: t-mustafin <66252296+t-mustafin@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:46:36 +0300 Subject: [PATCH] [RISC-V, LOONGARCH64] Fix FuncEvalHijack stackallocation (#88493) --- src/coreclr/debug/ee/loongarch64/dbghelpers.S | 6 +++--- src/coreclr/debug/ee/riscv64/dbghelpers.S | 4 ++-- .../pal/src/arch/loongarch64/activationhandlerwrapper.S | 2 +- .../pal/src/arch/loongarch64/dispatchexceptionwrapper.S | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coreclr/debug/ee/loongarch64/dbghelpers.S b/src/coreclr/debug/ee/loongarch64/dbghelpers.S index 07103d6c6771b..25452aa6a5dfc 100644 --- a/src/coreclr/debug/ee/loongarch64/dbghelpers.S +++ b/src/coreclr/debug/ee/loongarch64/dbghelpers.S @@ -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. @@ -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. diff --git a/src/coreclr/debug/ee/riscv64/dbghelpers.S b/src/coreclr/debug/ee/riscv64/dbghelpers.S index 71b584d7aa656..9376760b8fb6f 100644 --- a/src/coreclr/debug/ee/riscv64/dbghelpers.S +++ b/src/coreclr/debug/ee/riscv64/dbghelpers.S @@ -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. diff --git a/src/coreclr/pal/src/arch/loongarch64/activationhandlerwrapper.S b/src/coreclr/pal/src/arch/loongarch64/activationhandlerwrapper.S index 9cc8663fedf4f..59ad00dd293d0 100644 --- a/src/coreclr/pal/src/arch/loongarch64/activationhandlerwrapper.S +++ b/src/coreclr/pal/src/arch/loongarch64/activationhandlerwrapper.S @@ -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) diff --git a/src/coreclr/pal/src/arch/loongarch64/dispatchexceptionwrapper.S b/src/coreclr/pal/src/arch/loongarch64/dispatchexceptionwrapper.S index 0548f03462f93..d29913c377d99 100644 --- a/src/coreclr/pal/src/arch/loongarch64/dispatchexceptionwrapper.S +++ b/src/coreclr/pal/src/arch/loongarch64/dispatchexceptionwrapper.S @@ -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)