From 3e324aa4815e11695da086b862302f3aea9ea7c1 Mon Sep 17 00:00:00 2001 From: neel Date: Thu, 4 Feb 2010 05:49:59 +0000 Subject: Reinstate the ptrace patch to restore the 'gp' register after calling a function. I made a mistake in assuming that the .cprestore directive will cause the assembler to automatically restore 'gp' after the 'jalr'. The .cprestore directive does its magic only after 'jal' and 'bal' instructions - not the 'jalr'. Pointed out by: c.jayachandran@gmail.com --- lib/libc/mips/sys/ptrace.S | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/libc/mips/sys/ptrace.S b/lib/libc/mips/sys/ptrace.S index 9be54a5..09b82c5 100644 --- a/lib/libc/mips/sys/ptrace.S +++ b/lib/libc/mips/sys/ptrace.S @@ -56,6 +56,9 @@ LEAF(ptrace) #endif la t9, _C_LABEL(__error) # locate address of errno jalr t9 +#ifdef __ABICALLS__ + lw gp, 16(sp) +#endif sw zero, 0(v0) lw ra, 32(sp) addu sp, sp, 40 -- cgit v1.1