好友
阅读权限20
听众
最后登录1970-1-1
|
C6000汇编实例详解2.txt
C6000汇编实例详解2.txt
//固定参数一般函数 反汇编
unsigned int funtionarg(unsigned int m,unsigned char k,unsigned long l)
{
unsigned int i,j;
unsigned char a,b;
unsigned long ll=0;
j=0x55aa;
i=m+j;
a=0x88;
b=a+0x11+k;
ll=l+1;
my_delay(100);
return i;
}
unsigned int funtionarg(unsigned int m,unsigned char k,unsigned long l)
{
8000AE34 C$DW$L$_tsk_main$2$E, funtionarg:
8000AE34 STW.D2T2 B3,*SP--[12] //压栈函数返回地址并分配48个字节
8000AE38 NOP 2
8000AE3C .fphead n, l, W, BU, br, nosat, 0000101
8000AE40 STDW.D2T1 A7:A6,*+SP[2] //压栈第三而参数
8000AE44 STB.D2T2 B4,*+SP[8] //压栈第二个参数
8000AE48 STW.D2T1 A4,*B15[1] //压栈第一个参数
8000AE4A NOP 2
unsigned int i,j;
unsigned char a,b;
unsigned long ll=0;
8000AE4C ZERO.L1 A5:A4 //A5:A4 = 0
8000AE50 STDW.D2T1 A5:A4,*+SP[5] //ll=*(SP+4*5)=A5:A4
8000AE54 NOP 2
j=0x55aa;
8000AE58 MVK.S2 0x55aa,B4 //B4=0x55aa
8000AE5C .fphead n, l, W, BU, nobr, nosat, 0000100
8000AE60 STW.D2T2 B4,*B15[7] //j=*(SP+4*7)=B4=0x55AA
8000AE62 NOP 2
i=m+j;
8000AE64 LDW.D2T2 *B15[7],B5 //B5=*(SP+4*7)=j
8000AE66 LDW.D2T2 *B15[1],B4 //B4=*(SP+4)=m
8000AE68 NOP 4
8000AE6A ADD.L2 B5,B4,B4 //B4=B4+B5
8000AE6C STW.D2T2 B4,*B15[6] //i=*(SP+4*6)=B4
8000AE6E NOP 2
a=0x88;
8000AE70 MVK.S2 0x0088,B4
8000AE74 STB.D2T2 B4,*+B15[32]
8000AE78 NOP 2
8000AE7C .fphead n, l, W, BU, nobr, nosat, 0001111
b=a+0x11+k;
8000AE80 LDBU.D2T2 *+B15[32],B4
8000AE84 LDBU.D2T2 *+SP[8],B5
8000AE88 NOP 4
8000AE8A ADD.L2 B5,B4,B4
8000AE8C ADDK.S2 17,B4
8000AE90 STB.D2T2 B4,*+B15[33]
8000AE94 NOP 2
ll=l+1;
8000AE98 LDDW.D2T2 *+SP[2],B5:B4
8000AE9C .fphead n, l, W, BU, nobr, nosat, 0000100
8000AEA0 MVK.L2 1,B6
8000AEA2 NOP 3
8000AEA4 ADDU.L2 B6,B5:B4,B5:B4
8000AEA8 STDW.D2T2 B5:B4,*+SP[5]
8000AEAC NOP 2
my_delay(100);
8000AEAE CALLP.S2 my_delay (PC-220 = 0x8000adc4),B3
8000AEB0 || MVK.S1 100,A4 //参数为100,用A4传参
return i;
8000AEB2 C$RL2:
8000AEB2 LDW.D2T1 *B15[6],A4 //A4=*(SP+4*6)=i;A4是返回值
8000AEB4 LDW.D2T2 *++SP[12],B3 //B3 程序返回地址
8000AEB8 BNOP.S2 B3,5
8000AEBC .fphead p, l, W, BU, br, nosat, 0011001
} |
|