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

你可能感兴趣的:(c,equals)