About ARM's B,BL jump instruction

Source: Internet
Author: User

. Text:00001260 A3 EB BL sub_24f4

Current Address + (offset << 2 + 8) = Destination Address

0x1260 + 0X4A3 * 4 + 8 = 24f4

Offset = (Destination address-current address-8) >> 2

offset = (0x24f4-0x1260-8)/4 = 0X4A3

Assuming that the address at the jump command is a, the address at the destination of the jump is B.
The B,BL instruction holds the offset address, which is calculated by:
1.b-(a+8). A+8 is the actual value of the PC is a+8 when the arm assembly line makes the instruction execute at a.
2. The value obtained in the first step is a multiple of 4, because arm's instruction is 4 aligned, that is, the lowest two bits are 00. The value is then shifted to the right by two bits.
3. Get the final offset

When executing:
1. Remove the offset
2. Move left two-bit
3. Add a PC, when the value of the PC is exactly the address value of the target, that is, the target address instruction entered the reference, the first line two is emptied
http://www.decell.org/article.asp?id=2

About ARM's B,BL jump instruction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.