Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
Restoring Resister Values
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
119 subscribers
Views
3040 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
Restoring Resister Values
Muhammad Ahsan
over 12 years ago
Note: This was originally posted on 17th March 2011 at
http://forums.arm.com
Hi,
I am working with Cortex M3 and I wrote a program in which I am calling a C function that is implemented in Assembly language. Four parameters are passed to the function, which are assigned to the Registers R0-R3. After performing some calculations on R0-R3 in the subroutine implemented in assembly language, when I return back to the C function the values of the R0-R3 are not the same as at the function's entry point rather R0-R3 contain results of the calculations performed in the subroutines. How can I get the same values back as they were at the starting point of the function call?
Looking forward for some useful hint.
Thanks and Regards
Parents
Yogatheesan Varatharajah
over 12 years ago
Note: This was originally posted on 17th March 2011 at
http://forums.arm.com
I think assembly functions perform operations based on the addresses. So if you use a register to perform an operation, the calculated value will be stored in the same address. To avoid that, once that register address is available, move the content of that register to another vacant address an perform your calculations on that address. That will leave the original register unchanged.
I hope this answered your question.
Best regards,
Theesan.
Cancel
Vote up
0
Vote down
Cancel
Reply
Yogatheesan Varatharajah
over 12 years ago
Note: This was originally posted on 17th March 2011 at
http://forums.arm.com
I think assembly functions perform operations based on the addresses. So if you use a register to perform an operation, the calculated value will be stored in the same address. To avoid that, once that register address is available, move the content of that register to another vacant address an perform your calculations on that address. That will leave the original register unchanged.
I hope this answered your question.
Best regards,
Theesan.
Cancel
Vote up
0
Vote down
Cancel
Children
No data