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 static inline unsigned long __phys_addr_nodebug(unsigned long x
)
16 unsigned long y
= x
- __START_KERNEL_map
;
18 /* use the carry flag to determine if x was < __START_KERNEL_map */
19 x
= y
+ ((x
> y
) ? phys_base
: (__START_KERNEL_map
- PAGE_OFFSET
));
24 #ifdef CONFIG_DEBUG_VIRTUAL
25 extern unsigned long __phys_addr(unsigned long);
26 extern unsigned long __phys_addr_symbol(unsigned long);
28 #define __phys_addr(x) __phys_addr_nodebug(x)
29 #define __phys_addr_symbol(x) \
30 ((unsigned long)(x) - __START_KERNEL_map + phys_base)
33 #define __phys_reloc_hide(x) (x)
36 #define pfn_valid(pfn) ((pfn) < max_pfn)
39 void clear_page_orig(void *page
);
40 void clear_page_rep(void *page
);
41 void clear_page_erms(void *page
);
43 static inline void clear_page(void *page
)
45 alternative_call_2(clear_page_orig
,
46 clear_page_rep
, X86_FEATURE_REP_GOOD
,
47 clear_page_erms
, X86_FEATURE_ERMS
,
50 : "memory", "rax", "rcx");
53 void copy_page(void *to
, void *from
);
55 #endif /* !__ASSEMBLY__ */
57 #ifdef CONFIG_X86_VSYSCALL_EMULATION
58 # define __HAVE_ARCH_GATE_AREA 1
61 #endif /* _ASM_X86_PAGE_64_H */