Commit 0cceb4aa authored by Franck Bui-Huu's avatar Franck Bui-Huu Committed by Ralf Baechle

[MIPS] Make get_frame_info() more robust

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: default avatarFranck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 1666a6fc
...@@ -321,17 +321,15 @@ static int get_frame_info(struct mips_frame_info *info) ...@@ -321,17 +321,15 @@ static int get_frame_info(struct mips_frame_info *info)
if (is_jal_jalr_jr_ins(ip)) if (is_jal_jalr_jr_ins(ip))
break; break;
if (is_sp_move_ins(ip)) { if (!info->frame_size) {
if (info->frame_size) if (is_sp_move_ins(ip))
continue; info->frame_size = - ip->i_format.simmediate;
info->frame_size = - ip->i_format.simmediate; continue;
} }
if (info->pc_offset == -1 && is_ra_save_ins(ip)) {
if (is_ra_save_ins(ip)) {
if (info->pc_offset != -1)
continue;
info->pc_offset = info->pc_offset =
ip->i_format.simmediate / sizeof(long); ip->i_format.simmediate / sizeof(long);
break;
} }
} }
if (info->frame_size && info->pc_offset >= 0) /* nested */ if (info->frame_size && info->pc_offset >= 0) /* nested */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment