[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 3/3] plat/kvm: set write protect flag in CR0



Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 30.05.19 22:52, Florian Schmidt wrote:
The last patch introduced read-only pages into the page table. However,
unless the WP flag is set in CR0, this information is ignored in
supervisor (i.e., kernel) mode. So set it at boot time to enable write
protection of pages.

Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
  plat/common/include/x86/cpu_defs.h | 1 +
  plat/kvm/x86/entry64.S             | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/plat/common/include/x86/cpu_defs.h 
b/plat/common/include/x86/cpu_defs.h
index e968a832..107f0f0a 100644
--- a/plat/common/include/x86/cpu_defs.h
+++ b/plat/common/include/x86/cpu_defs.h
@@ -60,6 +60,7 @@
  #define X86_CR0_EM              (1 << 2)    /* Emulation */
  #define X86_CR0_TS              (1 << 3)    /* Task Switched */
  #define X86_CR0_NE              (1 << 5)    /* Numeric Exception */
+#define X86_CR0_WP              (1 << 16)   /* Write Protect */
  #define X86_CR0_PG              (1 << 31)   /* Paging */
/*
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index 828cd1bc..274ab0b3 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -184,7 +184,7 @@ ENTRY(_libkvmplat_start64)
        /* FPU and SSE are part of base x86-64, so no need to check for their
         * availability before enabling and initializing. */
        andl $(~(X86_CR0_EM | X86_CR0_TS)), %esi
-       orl $(X86_CR0_MP | X86_CR0_NE), %esi
+       orl $(X86_CR0_MP | X86_CR0_NE | X86_CR0_WP), %esi
        movq %rsi, %cr0
        fninit
  #if __SSE__


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.