1 #ifndef _ASM_X86_CACHEFLUSH_H
2 #define _ASM_X86_CACHEFLUSH_H
6 #include <asm/special_insns.h>
18 #define _PGMT_DEFAULT 0
19 #define _PGMT_WC (1UL << PG_arch_1)
20 #define _PGMT_UC_MINUS (1UL << PG_uncached)
21 #define _PGMT_WB (1UL << PG_uncached | 1UL << PG_arch_1)
22 #define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
23 #define _PGMT_CLEAR_MASK (~_PGMT_MASK)
25 static inline unsigned long get_page_memtype(
struct page *
pg)
27 unsigned long pg_flags = pg->
flags & _PGMT_MASK;
29 if (pg_flags == _PGMT_DEFAULT)
31 else if (pg_flags == _PGMT_WC)
33 else if (pg_flags == _PGMT_UC_MINUS)
39 static inline void set_page_memtype(
struct page *pg,
unsigned long memtype)
41 unsigned long memtype_flags = _PGMT_DEFAULT;
42 unsigned long old_flags;
43 unsigned long new_flags;
47 memtype_flags = _PGMT_WC;
50 memtype_flags = _PGMT_UC_MINUS;
53 memtype_flags = _PGMT_WB;
58 old_flags = pg->
flags;
59 new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
60 }
while (
cmpxchg(&pg->
flags, old_flags, new_flags) != old_flags);
63 static inline unsigned long get_page_memtype(
struct page *pg) {
return -1; }
64 static inline void set_page_memtype(
struct page *pg,
unsigned long memtype) { }
146 #ifdef CONFIG_DEBUG_RODATA
147 void mark_rodata_ro(
void);
149 extern int kernel_set_to_readonly;
150 void set_kernel_text_rw(
void);
151 void set_kernel_text_ro(
void);
153 static inline void set_kernel_text_rw(
void) { }
154 static inline void set_kernel_text_ro(
void) { }
157 #ifdef CONFIG_DEBUG_RODATA_TEST