MIPS assemble instruction analysis in check_poison_obj

  The C code in kernel as the following:

for (i = 0; i < size; i++) {
1792 char exp = POISON_FREE;
1793 if (i == size - 1)
1794 exp = POISON_END;
1795 //printk("KSDBG:realobj[i]=%d,exp=%d/n",realobj[i], exp);
1796 if (realobj[i] != exp) {
1797 int limit;
1798 /* Mismatch ! */


The corresponding assemble code as the following:

8017f1a0: 26310001 addiu s1,s1,1
/* That means "i++", s1 represent the value of i
*/
8017f1a4: 0233102a slt v0,s1,s3
8017f1a8: 10400023 beqz v0,8017f238
8017f1ac: 00000000 nop
8017f1b0: 02511021 addu v0,s2,s1
/* s2 is the base address of realobj .So v0 can equal realobj[i] after s2 add s1
*/
8017f1b4: 80450000 lb a1,0(v0)
/* Then load the value of realobj[i] to a1, that is sign-extended instruction.
*/
8017f1b8: 02b12026 xor a0,s5,s1
/*
To judge if s5 equals s1 and save the result to a0
*/
8017f1bc: 2402006b li v0,107
/*
set v0 to 107(0x6b)
*/
8017f1c0: 2403ffa5 li v1,-91
/* set v1 to 0xa5 */
8017f1c4: 0064100a movz v0,v1,a0
/* if the result of previous xor instrucion(the value of a0) equals zero, then move v1 to v0, that is to say, set the
value of v0 to 0xa5*/
8017f1c8: 10a2fff5 beq a1,v0,8017f1a0
/* judge if a1 equals v0 */

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值