Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
useless arm asm instructions
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
118 subscribers
Views
2659 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
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
useless arm asm instructions
mosfet mosfet
over 12 years ago
Note: This was originally posted on 10th December 2009 at
http://forums.arm.com
Hi,
Still trying to learn arm asm and this time there is a construct I don't understand :
void add_chunk(somestruct* ptrSomeStruct)
{
unknow chunkData;
__text:00015718 _add_chunk ;
__text:00015718 ;
__text:00015718
__text:00015718 var_8 = -8
__text:00015718
__text:00015718 PUSH {R4,R7,LR}
__text:0001571A ADD R7, SP, #0xC+var_8
__text:0001571C MOV R4, R0 ; R4 = ptrSomeStruct
__text:0001571E MOVS R0, #0x98 ; 'ÿ' ; size_t
__text:00015720 BLX _malloc ; chunkData = malloc(0x98)
__text:00015724 CBZ R0, locret_15736 ; if (!chunkData) goto locret_15736
__text:00015726 MOVS R3, #0 ; R3 = 0
__text:00015728 STR R3, [R0] ; chunkData->field0 = 0;
__text:0001572A STR R3, [R0,#4] ; chunkData->field4 = 0;
__text:0001572C LDR.W R3, [R4,#0xB4] ; R3 = ptrSomeStruct-> fieldB4;
__text:00015730 STR R0, [R3] ; ptrSomeStruct->fieldB4 = chunkData;
__text:00015732 STR.W R0, [R4,#0xB4] ; ptrSomeStruct->fieldB4 = chunkData;
__text:00015736
__text:00015736 locret_15736
_add_chunk+C j
__text:00015736 POP {R4,R7,PC}
__text:00015736
}
What I don't understand (if I didn't badly interpret last asm lines) is the fact that the 2 last lines
are doing exactly the same.
But maybe I forgot something simple.
I should add that I don't have corresponding source code so I make some assumptions about structure.
Parents
guestposter guestposter
over 12 years ago
Note: This was originally posted on 13th December 2009 at
http://forums.arm.com
The last two lines not the same, I was also having figuring this out, fixed this after hours...
Cancel
Vote up
0
Vote down
Cancel
Reply
guestposter guestposter
over 12 years ago
Note: This was originally posted on 13th December 2009 at
http://forums.arm.com
The last two lines not the same, I was also having figuring this out, fixed this after hours...
Cancel
Vote up
0
Vote down
Cancel
Children
No data