1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_PAGE_64_H
3 #define _ASM_X86_PAGE_64_H
5 #include <asm/page_64_types.h>
8 #include <asm/alternative.h>
10 /* duplicated to the one in bootmem.h */
11 extern unsigned long max_pfn
;
12 extern unsigned long phys_base
;
14 extern unsigned long page_offset_base
;
15 extern unsigned long vmalloc_base
;
16 extern unsigned long vmemmap_base
;
18 static inline unsigned long __phys_addr_nodebug(unsigned long x
)
20 unsigned long y
= x
- __START_KERNEL_map
;
22 /* use the carry flag to determine if x was < __START_KERNEL_map */
23 x
= y
+ ((x
> y
) ? phys_base
: (__START_KERNEL_map
- PAGE_OFFSET
));
28 #ifdef CONFIG_DEBUG_VIRTUAL
29 extern unsigned long __phys_addr(unsigned long);
30 extern unsigned long __phys_addr_symbol(unsigned long);
32 #define __phys_addr(x) __phys_addr_nodebug(x)
33 #define __phys_addr_symbol(x) \
34 ((unsigned long)(x) - __START_KERNEL_map + phys_base)
37 #define __phys_reloc_hide(x) (x)
40 #define pfn_valid(pfn) ((pfn) < max_pfn)
43 void clear_page_orig(void *page
);
44 void clear_page_rep(void *page
);
45 void clear_page_erms(void *page
);
47 static inline void clear_page(void *page
)
49 alternative_call_2(clear_page_orig
,
50 clear_page_rep
, X86_FEATURE_REP_GOOD
,
51 clear_page_erms
, X86_FEATURE_ERMS
,
54 : "cc", "memory", "rax", "rcx");
57 void copy_page(void *to
, void *from
);
59 #endif /* !__ASSEMBLY__ */
61 #ifdef CONFIG_X86_VSYSCALL_EMULATION
62 # define __HAVE_ARCH_GATE_AREA 1
65 #endif /* _ASM_X86_PAGE_64_H */