From 4a6c01c33ff4047f13ced25cdf20b766106cb40a Mon Sep 17 00:00:00 2001 From: X512 Date: Mon, 17 May 2021 16:42:37 +0900 Subject: [PATCH] glue: implement for riscv64 Change-Id: I0d701050e8ee008db68b54d458de07c653a370d7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3920 Reviewed-by: Adrien Destugues --- src/system/glue/arch/riscv64/crti.S | 6 +++++- src/system/glue/arch/riscv64/crtn.S | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/system/glue/arch/riscv64/crti.S b/src/system/glue/arch/riscv64/crti.S index 680b4f24a5..a810498c0f 100644 --- a/src/system/glue/arch/riscv64/crti.S +++ b/src/system/glue/arch/riscv64/crti.S @@ -21,8 +21,12 @@ .section .init FUNCTION(_init): + addi sp, sp, -16 + sd ra, 8(sp) // crtbegin.o stuff comes here .section .fini FUNCTION(_fini): - // crtbegin.o stuff comes here + addi sp, sp, -16 + sd ra, 8(sp) + // crtend.o stuff comes here diff --git a/src/system/glue/arch/riscv64/crtn.S b/src/system/glue/arch/riscv64/crtn.S index 48e3dc6170..572f60e156 100644 --- a/src/system/glue/arch/riscv64/crtn.S +++ b/src/system/glue/arch/riscv64/crtn.S @@ -9,9 +9,12 @@ */ .section .init - // the image ID and program args are still on the stack + ld ra, 8(sp) + addi sp, sp, 16 + ret .section .fini - // the image ID and program args are still on the stack - + ld ra, 8(sp) + addi sp, sp, 16 + ret