L
L
Leonid2020-12-06 01:48:43
ARM
Leonid, 2020-12-06 01:48:43

How does register R15 behave when using the ADD instruction in ARM?

There is this listing:

ADD R1, R0, #3971 @ R1 = 0 + 3971 = 3971
ADD R15, R3, R1 @ R15 = 9928 + 3971=13899 ?? Видимо я что-то не понял

Find the value of register R15 after code execution.

The content of the register is as follows:
R0 = 0
R1 = 4131
R2 = 7435
R3 = 9928
...
R15 = 8

Correct answer: 14059.


Why is the answer 14059, although it seems to be 13899

Answer the question

In order to leave comments, you need to log in

6 answer(s)
V
Vasily Bannikov, 2020-12-06
@vabka

What logic should I use to solve this type of problem? What should be taken into account?
1. Read the rules. Especially point 5.12
2. Google it. Since we have RISC, we google something like "arm asm add" We found the keil
documentation and there is just something similar. There is even about some nuance with the R15, but I did not read it carefully. On the second line there will be habr After the first instruction, R0 and the constant 3971 will be added, and the result will be put in R1. After the second - R3 and R1 will be complicated, and the result in R15 I got: 13 899 I didn’t understand where 14059 comes from - maybe the task is a curve, or maybe I'm a fool. UPD: I'm an idiot. R15 is also a command counter. So apparently he still has time to go forward after addition
https://osdev.fandom.com/ru/wiki/Registers_of_general_n...
Let those who still fumbles supplement me

V
Vladimir T, 2020-12-06
@32bit_me

3971 + 0 + 9928 = 13899

L
lxfr, 2016-11-29
@lxfr

Try creating a .lock file on startup and deleting it on completion and checking for its existence with another script. If the file exists, then the script is either running or terminated abnormally.

D
Dmitry Ivaneychik, 2016-11-29
@DmitryIvaneychik

You can hang it on monit

A
Andrew, 2016-11-29
@R0dger

https://packagist.org/packages/texthtml/php-lock - help you!

A
Alexander Valle, 2016-11-29
@v1pby

There is such a thing as supervisor(ctl). And the screen will not be needed, and the lifting crutch is built in.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question