.text .global _start _start: ldr sp, =4096 bl main halt: b halt
int main() { unsigned int *pGPFCON = (unsigned int *)0x56000050; unsigned int *pGPFDAT = (unsigned int *)0x56000054; *pGPFCON = 0x100; *pGPFDAT = 0; return 0; }
LED. ELF: File-littlearm the format ELF32 the Disassembly of sectionTop. text: 00000000 <_start>: 0 : e3a0da01 MOV SP, # 4096 ; 0x1000 // set the stack to 4096 . 4 : BL eb000000 C <main> // skip main function performing 00000008 <HALT>: . 8 : B eafffffe . 8 <HALT> 0000000c <main>: C: e1a0c00d MOV IP, // sp sp value to the assignment = IP 4096 10 : e92dd800 STMDB sp !, {FP, IP, LR , pc} // pc is R15 lr is R14 ip is R11 is R12 fp value // first reduction sp 4, sp = 4092 and the value of pc into the memory referred to in 4096-4093 and then Save 4 // sp value 4088, then the value of lr placed 4092-4089 refers to memory // sp value and then reduced to 4084 4, and then the value of ip into memory referred 4088-4085 @ 4 is then reduced sp value 4080, then the value of ip into 4083 to referred to memory 4080 // the above instruction is a need to be saved before calling main register 14 : e24cb004 Sub FP, IP, # . 4 ; 0x4 // IP-FP. 4 = 4092 = 18 is : e24dd008 Sub SP, SP, # . 8 ; 0x8. 4 // = SP = SP-4072 . 1 C: e3a03456 MOV r3, # 1442840576 ; 0x56000000 0x56000000 into the // r3, 20 is : e2833050 the Add r3, r3, # 80 ; 0x50 // add 80 to the value of r3 becomes 0x56000050 24 : e50b3010 STR r3, [FP, # - 16 ] // 0x56000050 into the [ 4076 ] first local variables 28 : e3a03456 MOV r3, # 1,442,840,576 ; 0x56000000 onto 0x56000000 // r3 in the 2 C: e2833054 the Add r3, r3, # 84 ; 0x54 // the value of r3 plus 84 becomes 0x56000054 30: E50b3014 STR r3, [fp, # -20 is ] // 0x56000050 into the [ 4072 ] second local variables 34 is : e51b2010 LDR r2, [FP, # - 16 ] // to memory [ 4076 Value] 0x56000050 go into r2 38 is : e3a03c01 MOV R3, # 256 ; 0x100 . 3 C: e5823000 STR R3, [R2] // write the 0x100 [0x56000050] to memory 40 : e51b2014 LDR R2, [FP, # - 20 is ] // to memory [ 4072 ] r2 value 0x56000054 go into 44 is : e3a03000 MOV R3, # 0 ;0x0 48 : e5823000 STR R3, [R2] // write the 0x0 [0x56000054] to memory . 4 C: e3a03000 MOV R3, # 0 ; 0x0 50 : e1a00003 MOV r0 of, R3 54 is : e24bd00c Sub SP, FP, # 12 is ; 0xc // FP-12 is SP = 4092-12 = 4080 = 58 : LDMIA e89da800 SP, {fp, SP, PC} // first value in the memory 4080 to 4083 to fp, and a memory 4084 to 4087 SP, SP = 4096 // Finally, the 4088-4091 value to the pc, which is the main function call finished, // the address of the next instruction after there lr register before calling the Disassembly of sectionTop. Comment: 00000000 <.comment>: 0 : 43.4347 million cmpmi R3, # 0 ; 0x0 . 4 : 47282 03A undefined . 8 : 2 029554e eorcs R5, R9 , LR, ASR # 10 C: 2e342e33 mrccs 14 , . 1 , R2, CR4, CR3, { . 1 } 10 : the Address 0x10 IS OUT of bounds.