linux-mips
[Top] [All Lists]

Re: Bug in the syscall tracing code

To: "Gleb O. Raiko" <raiko@niisi.msk.ru>
Subject: Re: Bug in the syscall tracing code
From: "Gleb O. Raiko" <raiko@niisi.msk.ru>
Date: Fri, 07 Oct 2005 16:44:59 +0400
Cc: linux-mips@linux-mips.org
In-reply-to: <43455D2D.1010901@niisi.msk.ru>
Organization: NIISI RAN
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <43455D2D.1010901@niisi.msk.ru>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
Hello,

4. I know there should be yet another way.

The way is to load a saved register in the delay slot of jalr. The saved register shall not be s0, of course, because it's saved by the first instruction in save_static_function. So the proposed patch is

arch/mips/kernel/scall32-o32.S:

syscall_trace_entry:
        SAVE_STATIC
-       move    s0, t2
+       move    s1, t2
        move    a0, sp
        li      a1, 0
        jal     do_syscall_trace

        lw      a0, PT_R4(sp)           # Restore argument registers
        lw      a1, PT_R5(sp)
        lw      a2, PT_R6(sp)
        lw      a3, PT_R7(sp)
-        jalr   s0
+       .set push
+       .set noreorder
+       jalr    s1
+        lw     s1, PT_R17(sp)
+       .set pop

The rest of ABIs shall be implemented in the same way.

Regards,
Gleb.

<Prev in Thread] Current Thread [Next in Thread>