Skip to content

Commit

Permalink
[MIPS] Make get_frame_info() more robust
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Franck Bui-Huu authored and Ralf Baechle committed Sep 27, 2006
1 parent 1666a6f commit 0cceb4a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions arch/mips/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,15 @@ static int get_frame_info(struct mips_frame_info *info)

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 */
Expand Down

0 comments on commit 0cceb4a

Please sign in to comment.