aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include/asm/memory.h')
-rw-r--r--arch/arm/include/asm/memory.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index d9b96c65e594..6748d6295a1a 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -172,9 +172,14 @@
172 * so that all we need to do is modify the 8-bit constant field. 172 * so that all we need to do is modify the 8-bit constant field.
173 */ 173 */
174#define __PV_BITS_31_24 0x81000000 174#define __PV_BITS_31_24 0x81000000
175#define __PV_BITS_7_0 0x81
175 176
176extern phys_addr_t (*arch_virt_to_idmap) (unsigned long x); 177extern phys_addr_t (*arch_virt_to_idmap) (unsigned long x);
177extern unsigned long __pv_phys_offset; 178extern u64 __pv_phys_offset;
179extern u64 __pv_offset;
180extern void fixup_pv_table(const void *, unsigned long);
181extern const void *__pv_table_begin, *__pv_table_end;
182
178#define PHYS_OFFSET __pv_phys_offset 183#define PHYS_OFFSET __pv_phys_offset
179 184
180#define __pv_stub(from,to,instr,type) \ 185#define __pv_stub(from,to,instr,type) \
@@ -186,10 +191,36 @@ extern unsigned long __pv_phys_offset;
186 : "=r" (to) \ 191 : "=r" (to) \
187 : "r" (from), "I" (type)) 192 : "r" (from), "I" (type))
188 193
194#define __pv_stub_mov_hi(t) \
195 __asm__ volatile("@ __pv_stub_mov\n" \
196 "1: mov %R0, %1\n" \
197 " .pushsection .pv_table,\"a\"\n" \
198 " .long 1b\n" \
199 " .popsection\n" \
200 : "=r" (t) \
201 : "I" (__PV_BITS_7_0))
202
203#define __pv_add_carry_stub(x, y) \
204 __asm__ volatile("@ __pv_add_carry_stub\n" \
205 "1: adds %Q0, %1, %2\n" \
206 " adc %R0, %R0, #0\n" \
207 " .pushsection .pv_table,\"a\"\n" \
208 " .long 1b\n" \
209 " .popsection\n" \
210 : "+r" (y) \
211 : "r" (x), "I" (__PV_BITS_31_24) \
212 : "cc")
213
189static inline phys_addr_t __virt_to_phys(unsigned long x) 214static inline phys_addr_t __virt_to_phys(unsigned long x)
190{ 215{
191 unsigned long t; 216 phys_addr_t t;
192 __pv_stub(x, t, "add", __PV_BITS_31_24); 217
218 if (sizeof(phys_addr_t) == 4) {
219 __pv_stub(x, t, "add", __PV_BITS_31_24);
220 } else {
221 __pv_stub_mov_hi(t);
222 __pv_add_carry_stub(x, t);
223 }
193 return t; 224 return t;
194} 225}
195 226