linux-mips
[Top] [All Lists]

[PATCH 6/7] Make get_frame_info() more robust

To: anemo@mba.ocn.ne.jp
Subject: [PATCH 6/7] Make get_frame_info() more robust
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
Date: Thu, 3 Aug 2006 09:29:20 +0200
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org, Franck Bui-Huu <vagabon.xyz@gmail.com>
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=E9wOh2qzG5p/ItjTYsVq6dEiPkkX7q64YH+vxY7yj6MgtkOns2Ea5AuqOCmEEHEeyh1F6XquoU+kM1Y9HBLY8yAfEEV8vMTSpKuNrBzF9VID524Tx3KTML0Q+ahH3tVQoL7ZS7yvvKqlrDISm450YQzfrZXLDiu0C554EIik89I=
In-reply-to: <11545901611096-git-send-email-vagabon.xyz@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <11545901611096-git-send-email-vagabon.xyz@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Now get_frame_info() wants to detect move sp instruction first. It
assumes that the save ra in the stack instruction can't happen
before allocating frame size space into the stack.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
---
 arch/mips/kernel/process.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index da332d7..309bfa4 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -321,17 +321,15 @@ static int get_frame_info(struct mips_fr
 
                if (is_jal_jalr_jr_ins(ip))
                        break;
-               if (is_sp_move_ins(ip)) {
-                       if (info->frame_size)
-                               continue;
-                       info->frame_size = - ip->i_format.simmediate;
+               if (!info->frame_size) {
+                       if (is_sp_move_ins(ip))
+                               info->frame_size = - ip->i_format.simmediate;
+                       continue;
                }
-
-               if (is_ra_save_ins(ip)) {
-                       if (info->pc_offset != -1)
-                               continue;
+               if (info->pc_offset == -1 && is_ra_save_ins(ip)) {
                        info->pc_offset =
                                ip->i_format.simmediate / sizeof(long);
+                       break;
                }
        }
        if (info->frame_size && info->pc_offset >= 0) /* nested */
-- 
1.4.2.rc2


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