File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,26 @@ extern u32 __kvm_get_mdcr_el2(void);
81
81
82
82
extern char __smccc_workaround_1_smc [__SMCCC_WORKAROUND_1_SMC_SZ ];
83
83
84
+ /*
85
+ * Obtain the PC-relative address of a kernel symbol
86
+ * s: symbol
87
+ *
88
+ * The goal of this macro is to return a symbol's address based on a
89
+ * PC-relative computation, as opposed to a loading the VA from a
90
+ * constant pool or something similar. This works well for HYP, as an
91
+ * absolute VA is guaranteed to be wrong. Only use this if trying to
92
+ * obtain the address of a symbol (i.e. not something you obtained by
93
+ * following a pointer).
94
+ */
95
+ #define hyp_symbol_addr (s ) \
96
+ ({ \
97
+ typeof(s) *addr; \
98
+ asm("adrp %0, %1\n" \
99
+ "add %0, %0, :lo12:%1\n" \
100
+ : "=r" (addr) : "S" (&s)); \
101
+ addr; \
102
+ })
103
+
84
104
/*
85
105
* Home-grown __this_cpu_{ptr,read} variants that always work at HYP,
86
106
* provided that sym is really a *symbol* and not a pointer obtained from
Original file line number Diff line number Diff line change @@ -107,26 +107,6 @@ static __always_inline unsigned long __kern_hyp_va(unsigned long v)
107
107
108
108
#define kern_hyp_va (v ) ((typeof(v))(__kern_hyp_va((unsigned long)(v))))
109
109
110
- /*
111
- * Obtain the PC-relative address of a kernel symbol
112
- * s: symbol
113
- *
114
- * The goal of this macro is to return a symbol's address based on a
115
- * PC-relative computation, as opposed to a loading the VA from a
116
- * constant pool or something similar. This works well for HYP, as an
117
- * absolute VA is guaranteed to be wrong. Only use this if trying to
118
- * obtain the address of a symbol (i.e. not something you obtained by
119
- * following a pointer).
120
- */
121
- #define hyp_symbol_addr (s ) \
122
- ({ \
123
- typeof(s) *addr; \
124
- asm("adrp %0, %1\n" \
125
- "add %0, %0, :lo12:%1\n" \
126
- : "=r" (addr) : "S" (&s)); \
127
- addr; \
128
- })
129
-
130
110
/*
131
111
* We currently support using a VM-specified IPA size. For backward
132
112
* compatibility, the default IPA size is fixed to 40bits.
You can’t perform that action at this time.
0 commit comments