How to read disassembled file? Here is an example
4bc: e3a0244e mov r2, #1308622848
4c0: e3a0344e mov r3, #1308622848
4C4: e5933000 LDR r3, [R3]
These are like 4bc address code to run, e3a0244e machine code
That common assembly instructions What?
b, bl
These instructions is a jump instruction, except that in addition to a jump instruction bl, lr also saves the return address register.
mov
This command can be assigned to the value of a register to another register, or to a Changshu to the register. Literal constant must be able to express
When the number can not be used immediately to represent you can use ldr command assignment. ldr is a directive, instruction it is not real, compiler will expand into a real command.
ldr r1, =label
When a = number before its second parameter represents a directive, or that memory access instruction
ldr r1, [r2, # 4] the read address of the memory cell data r1 to r2 + 4 in
ldr r1, [r2] r2 read data address to the memory unit in r1
ldr r1, [r2], # 4 to address the memory cell data read r2, r1, and then r2 = r2 + 4
str r1, [r2, # 4] r1 save data to the memory unit address of r2 + 4
str r1, [r2] to save data to the memory cell address r1 to r2 of
str r1, [r2], # 4 stored in the data r1, r2 addresses to a memory unit, and then r2 = r2 + 4
add、sub
add r1, r2, #1 r1=r2+1
sub r1, r2, #1 r1=r2-1
msr mrs
msr cpsr, r0 r0 to copy the cpsr
mrs r0, cpsr copy cpsr to r0
There arm registers r0-r15 16
r15 indicates that the program counter, which is pc
r14 denotes lr, connected to register
r13 denotes sp, the data stack pointer
Generally, when the parameter is not more than 4, r0-r3 using four registers to pass arguments; if the number of parameters more than four, the remaining parameters by the data stack to pass
For the average return results with a0-a3 to pass