首页
社区
课程
招聘
懂arm汇编的进来,关于参数传递的
2004-6-27 10:33 5998

懂arm汇编的进来,关于参数传递的

2004-6-27 10:33
5998
下面是arm汇编的关于一个类函数的实现的部分代码:
                              .align        0
                              .global        Draw__8CDisplayR6TPointP10CFbsBitmapR5TRecti
                      Draw__8CDisplayR6TPointP10CFbsBitmapR5TRecti:
                              @ args = 4, pretend = 0, frame = 60
                  @ frame_needed = 0, current_function_anonymous_args = 0
                stmfd        sp!, {r4, r5, r6, r7, r8, r9, sl, lr}
                  sub        sp, sp, #60
                  mov        r7, r0
                  str        r1, [sp, #0]
                  mov        r6, r3
                  mov        r5, #0
                  subs        sl, r2, #0
                  beq        .L2054
                  add        r0, sp, #52 @不明白的地方
                  mov        r1, sl
                  bl        SizeInPixels__C10CFbsBitmap
                  add        r8, sp, #48
                  ldmib        r8, {r3-r4}
                  ldr        r2, [r6, #0]
                  cmp        r2, r3
                  bgt        .L2054
                  add        r0, sp, #44 @不明白的地方
                  mov        r1, sl
                  bl        SizeInPixels__C10CFbsBitmap
                  add        r3, sp, #44
                  ldmia        r3, {r3-r4}
                  ldr        r2, [r6, #4]
                  cmp        r2, r4
                bgt        .L2054
                  add        r0, sp, #36 @不明白的地方
                ldr        r1, [r7, #68]
                  bl        SizeInPixels__C10CFbsBitmap
                  add        r3, sp, #36
                  ldmia        r3, {r3-r4}
                  ldr        r9, [sp, #0]
                  ldr        r2, [r9, #0]
                  cmp        r2, r3
                  bgt        .L2054
                  add        r0, sp, #28 @不明白的地方
                  ldr        r1, [r7, #68]
                  bl        SizeInPixels__C10CFbsBitmap
                  add        r3, sp, #28
                  ldmia        r3, {r3-r4}
                  ldr        r2, [r9, #4]
                  cmp        r2, r4
                  bgt        .L2054
                  mov        r0, r6
                  bl        Width__C5TRect
                  ldr        r3, [r9, #0]
                  cmn        r0, r3
                  bmi        .L2054
                  mov        r0, r6
                  bl        Height__C5TRect
                ldr        r3, [r9, #4]
                cmn        r0, r3
                bpl        .L2053
这是这部分类的c++源代码:
void CDisplay::Draw(TPoint& aPoint,CFbsBitmap* aBitmap,TRect& aRect,TInt aKeyColor)
{

        if(aBitmap==NULL
                ||aRect.iTl.iX>aBitmap->SizeInPixels().iWidth
                ||aRect.iTl.iY>aBitmap->SizeInPixels().iHeight
                ||aPoint.iX>iOffScreenBmp->SizeInPixels().iWidth
                ||aPoint.iY>iOffScreenBmp->SizeInPixels().iHeight
                ||aPoint.iX+aRect.Width()<0
                ||aPoint.iY+aRect.Height()<0
                )
                return;
}
对于以上不明白的地方,我感到困惑的是,在调用别的函数的时候,如果函数的参数少于4个,则通过寄存器传递,调用SizeInPixels()函数传递的第一个参数是类指针,但上面的代码中,对于abitmap->sizeInPixels()这个函数的两次调用传进去的指针是add        r0, sp, #52和add        r0, sp, #44,对于同一个类,为什么调用的参数不一样呢?那位老大能帮我说明一下这些堆栈的情况。

[培训]科锐软件逆向50期预科班报名即将截止,速来!!! 50期正式班报名火爆招生中!!!

收藏
免费 3
打赏
分享
最新回复 (4)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
dualven 2004-6-27 13:51
2
0
看不懂
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
Voltage 2004-6-27 18:00
3
0
贴错地方了吧!去嵌入式论坛问问,你的问题挺简单的,这里主要是x86汇编。
雪    币: 519
活跃值: (1223)
能力值: ( LV12,RANK:650 )
在线值:
发帖
回帖
粉丝
RoBa 16 2004-6-27 18:26
4
0
什么是arm汇编,另一种处理器吗?
雪    币: 231
活跃值: (115)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
风云剑 2004-6-27 18:29
5
0
ARM也是一种处理器,多用于嵌入式系统,比如手机等。
游客
登录 | 注册 方可回帖
返回