Arm Community
Site
Search
User
Site
Search
User
Groups
Education Hub
Distinguished Ambassadors
Open Source Software and Platforms
Research Collaboration and Enablement
Forums
AI and ML forum
Architectures and Processors forum
Arm Development Platforms forum
Arm Development Studio forum
Arm Virtual Hardware forum
Automotive forum
Compilers and Libraries forum
Graphics, Gaming, and VR forum
High Performance Computing (HPC) forum
Infrastructure Solutions forum
Internet of Things (IoT) forum
Keil forum
Morello forum
Operating Systems forum
SoC Design and Simulation forum
SystemReady Forum
Blogs
AI and ML blog
Announcements
Architectures and Processors blog
Automotive blog
Graphics, Gaming, and VR blog
High Performance Computing (HPC) blog
Infrastructure Solutions blog
Internet of Things (IoT) blog
Operating Systems blog
SoC Design and Simulation blog
Tools, Software and IDEs blog
Support
Arm Support Services
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Support forums
Arm Development Studio forum
Concept of Scratch and Preserved Registers
Jump...
Cancel
Locked
Locked
Replies
4 replies
Subscribers
118 subscribers
Views
16783 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
Concept of Scratch and Preserved Registers
Muhammad Ahsan
over 10 years ago
Hi,
I am confused in understanding the difference between scratch and preserved registers. I have read the development guide of IAR Embedded Workbench but the topic was written in such a way that I could not get the real sence of it.
Any help or if possible some example that can help me differenciating between the both will be regarded.
Thanks in advance
Top replies
Martin Weidmann
over 10 years ago
+1
Note: This was originally posted on 5th April 2011 at http://forums.arm.com I've not used IAR's tools, but I'm assuming it follows the AAPCS (Procedure Call Standard for the ARM Architecture). The AAPCS...
Parents
Muhammad Ahsan
over 10 years ago
Note: This was originally posted on 5th April 2011 at
http://forums.arm.com
@ttfn thanks for your detailed reply. Actually what I am unable to understand is that we have two groups of registers r0-r3 and r4-r11. I know that r0-r3 can be used for passing parameters while the remaining cann't. I am passing 4 arguments to the function foo called by main as in your example. Inside function foo I am doing some calculations which involve r0-r6. after return I want to have the same values in all registers as they were before calling foo. Do I need to push r4-r6 on stack before calling foo and then pop them back after return to have the same register values or it will be done automatically as they are called preserved registers. I have seen in the stack window that r0-r3 are pushed to stack, when they are used as parameters.
I hope you got my point.
Cancel
Up
0
Down
Cancel
Reply
Muhammad Ahsan
over 10 years ago
Note: This was originally posted on 5th April 2011 at
http://forums.arm.com
@ttfn thanks for your detailed reply. Actually what I am unable to understand is that we have two groups of registers r0-r3 and r4-r11. I know that r0-r3 can be used for passing parameters while the remaining cann't. I am passing 4 arguments to the function foo called by main as in your example. Inside function foo I am doing some calculations which involve r0-r6. after return I want to have the same values in all registers as they were before calling foo. Do I need to push r4-r6 on stack before calling foo and then pop them back after return to have the same register values or it will be done automatically as they are called preserved registers. I have seen in the stack window that r0-r3 are pushed to stack, when they are used as parameters.
I hope you got my point.
Cancel
Up
0
Down
Cancel
Children
No data