path: root/drivers/lguest
diff options
authorAndy Lutomirski <>2014-10-24 15:58:07 -0700
committerIngo Molnar <>2015-02-04 12:10:41 +0100
commit375074cc736ab1d89a708c0a8d7baa4a70d5d476 (patch)
treee7ceb81f6fc54814fc57716a79f8d232f5e6afb8 /drivers/lguest
parent0967160ad615985c7c35443156ea9aecc60c37b8 (diff)
x86: Clean up cr4 manipulation
CR4 manipulation was split, seemingly at random, between direct (write_cr4) and using a helper (set/clear_in_cr4). Unfortunately, the set_in_cr4 and clear_in_cr4 helpers also poke at the boot code, which only a small subset of users actually wanted. This patch replaces all cr4 access in functions that don't leave cr4 exactly the way they found it with new helpers cr4_set_bits, cr4_clear_bits, and cr4_set_bits_and_update_boot. Signed-off-by: Andy Lutomirski <> Reviewed-by: Thomas Gleixner <> Signed-off-by: Peter Zijlstra (Intel) <> Cc: Andrea Arcangeli <> Cc: Vince Weaver <> Cc: "hillf.zj" <> Cc: Valdis Kletnieks <> Cc: Paul Mackerras <> Cc: Arnaldo Carvalho de Melo <> Cc: Kees Cook <> Cc: Linus Torvalds <> Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'drivers/lguest')
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 922a1acbf652..6adfd7ba4c97 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -47,6 +47,7 @@
#include <asm/lguest.h>
#include <asm/uaccess.h>
#include <asm/i387.h>
+#include <asm/tlbflush.h>
#include "../lg.h"
static int cpu_had_pge;
@@ -452,9 +453,9 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
static void adjust_pge(void *on)
if (on)
- write_cr4(read_cr4() | X86_CR4_PGE);
+ cr4_set_bits(X86_CR4_PGE);
- write_cr4(read_cr4() & ~X86_CR4_PGE);
+ cr4_clear_bits(X86_CR4_PGE);