Function call in ARM instructions

Publisher:BlossomWhisperLatest update time:2016-05-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Important registers

SP stack pointer, each exception mode has its own independent r13, which usually points to the stack dedicated to the exception mode, that is to say, the five exception modes and non-exception modes (user mode and system mode) have their own independent stacks, indexed by different stack pointers. In this way, when ARM enters the exception mode, the program can push general registers into the stack and pop them when returning, ensuring the integrity of the program status in various modes

LR Link register, generally used to store the return address; when executing instructions such as BL or BLX, it automatically stores the address of the next instruction, that is, the return address

PC Program Counter, stores the instruction to be executed

 

2. Program jump

B

BL

BX Rm; switch instruction set, jump to the label of another instruction set;

BLX Rm; Store the address of the next instruction of the current instruction in LR, and then jump to the address of another instruction set label

 

--

Seeing this, we need to note that not all function calls follow the AAPCS calling method. On the contrary, some ARM C compilers may force the return address to be stored on the stack, and then use forced jump instructions such as B or BX to jump.

Note that, in practice, not all function calls follow the AAPCS calling conventions: Instead of transferring the return address to lr register, the ARM C compiler may enforce the return address to be push onto the stack and afterwards performs a direct branch to the function through a B or BX instruction.

Reference address:Function call in ARM instructions

Previous article:Summary of memory access instructions in ARM instructions
Next article:The impact of instruction +s on the flag bit in cpsr

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号