/* memdump.s */ /* write memory contents to file `memdump.out' */ /* r4 contains the address where the program was loaded */ .text .set dump_addr, 0x2c000000 .set dump_size, 0x2000 .global _start _start: stmdb r13!, { r4, r14 } sub r13, r13, #0x28 ldr r0, =0x3c800000 ldr r1, =0xa5 str r1, [r0] mov r3, #0x20 str r3, [r13] add r0, r13, #4 mov r1, #0 add r2, r4, #outfile_path mov r3, #7 bl fopen cmp r0, #0 beq close add r0, r13, #4 ldr r1, =dump_addr ldr r2, =dump_size bl fwrite close: add r0, r13, #4 bl fclose add r13, r13, #0x28 ldmia r13!, { r4, r15 } outfile_path: .ascii "\0m\0e\0m\0d\0u\0m\0p\0.\0o\0u\0t\0\0" fopen: ldr r15, fopen_addr fopen_addr: .long 0x2c20 fclose: ldr r15, fclose_addr fclose_addr: .long 0x3258 fwrite: ldr r15, fwrite_addr fwrite_addr: .long 0x2e70