Skip to content

Commit bc1c969

Browse files
chenhuacaitsbogend
authored andcommitted
MIPS: Loongson-3: Calculate ra properly when unwinding the stack
Loongson-3 has 16-bytes load/store instructions: gslq and gssq. This patch calculate ra properly when unwinding the stack, if ra is saved by gssq and restored by gslq. Signed-off-by: Huacai Chen <chenhc@lemote.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 195615e commit bc1c969

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎arch/mips/kernel/process.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,21 @@ static inline int is_ra_save_ins(union mips_instruction *ip, int *poff)
279279
*poff = ip->i_format.simmediate / sizeof(ulong);
280280
return 1;
281281
}
282-
282+
#ifdef CONFIG_CPU_LOONGSON64
283+
if ((ip->loongson3_lswc2_format.opcode == swc2_op) &&
284+
(ip->loongson3_lswc2_format.ls == 1) &&
285+
(ip->loongson3_lswc2_format.fr == 0) &&
286+
(ip->loongson3_lswc2_format.base == 29)) {
287+
if (ip->loongson3_lswc2_format.rt == 31) {
288+
*poff = ip->loongson3_lswc2_format.offset << 1;
289+
return 1;
290+
}
291+
if (ip->loongson3_lswc2_format.rq == 31) {
292+
*poff = (ip->loongson3_lswc2_format.offset << 1) + 1;
293+
return 1;
294+
}
295+
}
296+
#endif
283297
return 0;
284298
#endif
285299
}

0 commit comments

Comments
 (0)