From: t-mustafin <66252296+t-mustafin@users.noreply.github.com> Date: Sat, 8 Jul 2023 08:46:36 +0000 (+0300) Subject: [RISC-V, LOONGARCH64] Fix FuncEvalHijack stackallocation (#88493) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~1172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6266a6e4ceac8708304eed764e25777d08cf184;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [RISC-V, LOONGARCH64] Fix FuncEvalHijack stackallocation (#88493) --- diff --git a/src/coreclr/debug/ee/loongarch64/dbghelpers.S b/src/coreclr/debug/ee/loongarch64/dbghelpers.S index 07103d6..25452aa 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 71b584d..9376760 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 9cc8663..59ad00d 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 0548f03..d29913c 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)