From 981e9728390b401404c36241e2ce6bd4cfcb723d Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 16 May 2022 14:33:26 +0100 Subject: mips: add native backtrace implementation Should make debugging crashes on native MIPS targets far easier. This is by no means a 100% complete or robust implementation but it seems to handle the vast majority of functions. Change-Id: Id5f430270e02b5092b79026b6876675c784aa649 --- lib/mipsunwinder/init_context_32.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/mipsunwinder/init_context_32.S (limited to 'lib/mipsunwinder/init_context_32.S') diff --git a/lib/mipsunwinder/init_context_32.S b/lib/mipsunwinder/init_context_32.S new file mode 100644 index 0000000000..a943d13dc3 --- /dev/null +++ b/lib/mipsunwinder/init_context_32.S @@ -0,0 +1,12 @@ +#include "mips.h" + + .text + .global mips_bt_start + +mips_bt_start: + addiu v0, ra, -8 + sw v0, 0(a0) /* ctx->pc = ra - 8 */ + sw sp, 4(a0) /* ctx->sp = sp */ + sw zero, 8(a0) /* ctx->depth = 0 */ + sw zero, 12(a0) /* ctx->valid = 0 */ + jr ra -- cgit v1.2.3