[Arm프로세서] AAPCS: Armv8: 브랜치와 복귀 명령어 - bl

Guillermo Austin Kim|2021년 8월 14일
Posts

[Arm프로세서] AAPCS: Armv8: 브랜치와 복귀 명령어 - bl

Guillermo Austin Kim|2021년 8월 14일

Arm 스팩 문서를 보면서 BL 명령어에 대해 알아봅시다. C6.2.33 BLBranch with Link branches to a PC-relative offset, setting the register X30 to PC+4. It provides a hint that this is a subroutine call.[출처] DDI0487Fc_armv8_arm.pdf 위 스팩의 내용을 조금 이해하기 어려운데, 쉽게 다음과 같이 정리할 수 있습니다. * PC와 관련된 오프셋으로 지정된 주소로 브랜치 * 브랜치를 하고 복귀할 주소를 X30 레지스터에 설정 위 내용을 읽으면 어떤 동작인지 파악하기 어려운데요. 이해를 돕기 위해 bl 명령어가 있는 예시 코드를 분석하겠습니다. 01 0x1004