|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] xen/arm64: head: Introduce a macro to get a PC-relative address of a symbol
commit b352d468f4d2f12f8ee6a0f6d81cdd8010cc8699
Author: Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Jun 17 14:51:21 2019 +0100
Commit: Julien Grall <julien.grall@xxxxxxx>
CommitDate: Sat Sep 7 12:09:49 2019 +0100
xen/arm64: head: Introduce a macro to get a PC-relative address of a symbol
Arm64 provides instructions to load a PC-relative address, but with some
limitations:
- adr is enable to cope with +/-1MB
- adrp is enale to cope with +/-4GB but relative to a 4KB page
address
Because of that, the code requires to use 2 instructions to load any Xen
symbol. To make the code more obvious, introducing a new macro adr_l is
introduced.
The new macro is used to replace a couple of open-coded use in
efi_xen_start.
The macro is copied from Linux 5.2-rc4.
Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
xen/arch/arm/arm64/head.S | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 12a7edfdd2..f8da3c8cc5 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -112,6 +112,18 @@
#endif /* !CONFIG_EARLY_PRINTK */
+/*
+ * Pseudo-op for PC relative adr <reg>, <symbol> where <symbol> is
+ * within the range +/- 4GB of the PC.
+ *
+ * @dst: destination register (64 bit wide)
+ * @sym: name of the symbol
+ */
+.macro adr_l, dst, sym
+ adrp \dst, \sym
+ add \dst, \dst, :lo12:\sym
+.endm
+
/* Load the physical address of a symbol into xb */
.macro load_paddr xb, sym
ldr \xb, =\sym
@@ -817,11 +829,9 @@ ENTRY(efi_xen_start)
* Flush dcache covering current runtime addresses
* of xen text/data. Then flush all of icache.
*/
- adrp x1, _start
- add x1, x1, #:lo12:_start
+ adr_l x1, _start
mov x0, x1
- adrp x2, _end
- add x2, x2, #:lo12:_end
+ adr_l x2, _end
sub x1, x2, x1
bl __flush_dcache_area
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |