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

ARM64 inline assembly BL BLR BR instructions

lo all,

I am in the middle of a problem that I can't seem to figure out. It involves testing the instruction set using c++ and inline assembly for the arm64. My current problems are with BL, BLR and the BR instructions. My current code looks as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#define LDRARRAYLENGTH (4)
__asm __volatile
(
".global myFunction \n\t"
".p2align 4 \n\t"
".type myFunction,%function \n\t"
"myFunction: \n\t"
"mov x0, #10 \n\t"
"ret x30 \n\t"
);
/*
*
*/
bool BranchingModes(void)
{
bool BranchingModesFlag = false;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Issue is the code doesn't seem to make to the for loop after BranchingModes function. I know it's the asm section of the BranchingModes function which utilizes the BL instruction.  I am not sure what I am doing wrong with that instruction. Am I returning correctly out of the "myFunction" using "ret x30"? I have attempted to use "BR x30" with no success. As BL updates "PC+4" and gets sorted to x30.  Similar issue with the BLR instruction, I would appreciate any insight with my issues. Hello all,

0