MIPS指令的疑问

For the job reason, i need to statistic the stack frame of application binary.  Any way, i studied the MIPS16E assembly instruction.  And found that there is a set of intruction to save register at the beginning of function, named save.

 

So, i think only need thing to do is to filt the save instruction.

I am enjoying the feeling for using python. So following code is easy to come the work down.

      8 string_file = open('cuncuntong_flash.dasm')
      9 tmp = string_file.read()
     10
     11 stop_pos = tmp.find('Disassembly of section .flashro:')
     12 code = tmp[0:stop_pos]
     13 #print string
     14
     15 p = re.compile(r'<(?P<func>.*)>:/s*/n.*save/s*([/w-]+,|)(?P<size>/d+),')
     16
     17 dest_file = open('func_size.csv','w')
     18
     19 for i in p.finditer(code):
     20     dest_file.write(i.group('func'))
     21     dest_file.write(',')
     22
     23     dest_file.write(i.group('size'))
     24     dest_file.write('/n')

Regular expression is excellent facility to accomplish these tasks.

 

Then put the statistic data to a csv. At last, i get the file as follows.

 

 

avl_si_load_chan_table2040
avl_si_save_chan_table2040
cct_ui_start1056
avl_si_load_ts848
avl_si_save_ts824
setting_menu_list_pressed_callback616
avl_printf304
osd_linklist_update240
cct_start224
avl_osd_draw_character216
tune_to_transponder216

 

...................

 

But, it is very odd to find that the biggest stack frame is 2040. And i can't find anyer larger. While the temporary variable is larger than 2040.

After having several test, i guess that, 2040 is the biggest value for save instruction.

 

Maybe this the MIPS toolchain's bug.

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值