Created
July 1, 2011 15:37
-
-
Save Ludo6431/1058797 to your computer and use it in GitHub Desktop.
REing an arm asm function...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 | |
sub_203A0A4: | |
LDR R3, [R1,#4] | |
CMP R3, #0 | |
LDRNE R2, [R1] | |
STRNE R2, [R3] | |
LDR R2, [R1] | |
CMP R2, #0 | |
LDREQ R0, [R1,#4] | |
LDRNE R1, [R1,#4] | |
STRNE R1, [R2,#4] | |
BX LR | |
#endif | |
// => | |
int *sub_203A0A4(int *R0, int **R1) { | |
if(R1[1]) | |
R1[1][0] = R1[0]; | |
if(R1[0]) | |
R1[0][1] = R1[1]; | |
else | |
return R1[1]; | |
return R0; | |
} | |
// => (guessing...) | |
typedef struct list list; | |
struct list { | |
list *prev; | |
list *next; | |
// void *data ? | |
}; | |
// drop an element from a list | |
// returns the new start of the list | |
list *list_drop(list *start, list *el) { | |
if(el->next) | |
el->next->prev = el->prev; | |
if(el->prev) | |
el->prev->next = el->next; | |
else | |
return el->next; | |
return start; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if 0 | |
sub_203A0CC: | |
STR R0, [R1,#4] | |
MOV R2, #0 | |
STR R2, [R1] | |
CMP R0, #0 | |
STRNE R1, [R0] | |
MOV R0, R1 | |
BX LR | |
#endif | |
// => (see sub_203A0A4.c) | |
// add a new element in a list from the start | |
// returns the new start of the list | |
list *list_prepend(list *start, list *new) { | |
new->next = start; | |
new->prev = NULL; | |
if(start) | |
start->prev = new; | |
return new; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment