This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How interpret the asm lines

Note: This was originally posted on 1st December 2009 at http://forums.arm.com

Hi,

I am trying to understand how a library compiled for arm is working and I have a problem to undertstand the following lines :
You just need to know that GDGStackRef and GDGStateRef  are pointers to structure and that GDStack is defined like that :

typedef struct __GDGStack {

signed long refcount; //0x00
long capacity;   //0x04
size_t index;   //0x08
GDGStateRef *gstate; //0x0C

} GDGStack, *GDGStackRef;



GDGStackRef GDGStackCreateWithGState(GDGStateRef stateSrc)
{
GDGStackRef stack;
GDGStateRef gstateTemp;

__text:000025EE                 MOV     R6, R0

... Some code not interesting ...

__text:0000261E ; ---------------------------------------------------------------------------
__text:0000261E
__text:0000261E loc_261E                                ;
__text:0000261E                 CBNZ    R6, loc_2626         ; if (stateSrc) goto loc_2626
__text:00002620                 BL      _GDGStateCreate ; gstateTemp = GDGStateCreate();
__text:00002624                 B       loc_262C ; goto loc_262C;
__text:00002626 ; ---------------------------------------------------------------------------

... Some code not interesting ...

__text:0000262C loc_262C                               
__text:0000262C                 MOV     R5, R0  ; R5 = gstateTemp;
__text:0000262E                 CBNZ    R0, loc_263A ; if (gstateTemp) goto loc_263A

... Some code not interesting ...


__text:0000263A
__text:0000263A loc_263A                                ;
__text:0000263A                 LDR     R3, [R4,#8] ;          R3 = stack->index
__text:0000263C                 LDR     R2, [R4,#0xC] ;  R2 = stack->gstate
__text:0000263E                 STR.W   R0, [R2,R3,LSL#2];
__text:00002642                 ADDS    R3, #1  ;
__text:00002644                 STR     R3, [R4,#8] ;  stack->index++


My problem is to understand R0, [R2,R3,LSL#2], how would you interpret ?
Could you detailed ?
0