Moving and moving assembly

I am having trouble decrypting this assembly code block. What will be the value of r1 to the end and how will I get there?

3242ba66 f6454118 movw r1, 0x5c18 3242ba6a 466f mov r7, sp 3242ba6c f6c0415a movt r1, 0xc5a 3242ba70 f2460002 movw r0, 0x6002 3242ba74 f6c0405a movt r0, 0xc5a 3242ba78 4479 add r1, pc 3242ba7a 4478 add r0, pc 3242ba7c 6809 ldr r1, [r1, #0] 
+6
source share
1 answer

movw , followed by movt , is the usual way to load a 32-bit value into a register. This is the equivalent of OR combining these two immediate values ​​together with movt , which is the top 16-bit. In this case, r1 = (movt immediate value << 16) | (movw immediate value)) r1 = (movt immediate value << 16) | (movw immediate value)) .

 3242ba66 f6454118 movw r1, 0x5c18 // r1 = 0x5c18 3242ba6a 466f mov r7, sp 3242ba6c f6c0415a movt r1, 0xc5a // r1 = (r1 & 0xffff) | (0xc5a << 16) 3242ba70 f2460002 movw r0, 0x6002 3242ba74 f6c0405a movt r0, 0xc5a 3242ba78 4479 add r1, pc // r1 = r1 + pc 3242ba7a 4478 add r0, pc 3242ba7c 6809 ldr r1, [r1, #0] // r1 = *(r1 + 0) 
+26
source

Source: https://habr.com/ru/post/899496/


All Articles