flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > [fasmarm] Syntax for far address loading |
| Author |
|
|
Chris Leslie 27 Nov 2025, 20:11
In fasmarm elf64 how can i load a register with a far label address? Adr x0, mylabel won't look far enough and ldr x0,=mylabel is not valid.
|
|||
|
|
Tomasz Grysztar 27 Nov 2025, 20:28
Perhaps it's the ADRP that you're looking for? I have the technique demonstrated at the very end of chapter 1.6 of my formats tutorial.
|
|||
|
|
Chris Leslie 27 Nov 2025, 20:47
Yes, I need to load the page address with adrp and then add the offset of my label, but getting a syntax that passes is the problem. I will try to adapt the technique at the end of chapter 1.6.
|
|||
|
|
revolution 27 Nov 2025, 22:33
For relative labels this can be used:
Code: format elf64 executable at 0x123456789a0 processor cpu64_v8 my_label: adrp x0,far_label add x0,x0,far_label and 0xfff rb 1 shl 25 far_label: Code: 00000078: 90010000 V8 adrp x0,0x002000000 0000007c: 91288000 V8 add x0,x0,0xa20 |
|||
|
|
Chris Leslie 28 Nov 2025, 10:20
Thanks revolution. What is the purpose of at 0x123456789a0?
And, what does rb 1 shl 25 do in that position? |
|||
|
|
revolution 28 Nov 2025, 14:00
0x123456789a0 is just an example to demonstrate a "large" address that can't be encoded in one instruction.
rb 1 shl 25 is just an example to skip a large amount of space to create a "far" label that can't be reached in one instruction. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.