* [RFC][PATCH 7/7] kvm: qemu: Enable EPT support for real mode
@ 2008-02-01 8:26 Yang, Sheng
0 siblings, 0 replies; only message in thread
From: Yang, Sheng @ 2008-02-01 8:26 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]
From de2bedf0890c95828b07ba3d2d98025fd39050a1 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Fri, 1 Feb 2008 07:33:13 +0800
Subject: [PATCH] kvm: qemu: Enable EPT support for real mode
The patch allocated one page from 0xcf000 (the last page of vga bios region),
took it as the guest identity mapped page table in real mode. Then we can
support EPT in real mode by using the address as guest CR3.
Signed-off-by: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
qemu/hw/pc.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 0e0d051..f3fa49c 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -758,6 +758,9 @@ static void pc_init1(ram_addr_t ram_size, int
vga_ram_size,
int index;
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BlockDriverState *fd[MAX_FD];
+#ifdef USE_KVM
+ uint32_t *table_items;
+#endif
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
@@ -851,6 +854,17 @@ static void pc_init1(ram_addr_t ram_size, int
vga_ram_size,
exit(1);
}
+#ifdef USE_KVM
+ if (kvm_allowed) {
+ /* set up identity map for EPT at the last page of VGA BIOS region.
+ * 0xe7 = _PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED |
+ * _PAGE_DIRTY | _PAGE_PSE */
+ table_items = (void *)(phys_ram_base + vga_bios_offset + 0xf000);
+ for (i = 0; i < 1024; i++)
+ table_items[i] = (i << 22) + 0xe7;
+ }
+#endif
+
/* above 4giga memory allocation */
if (above_4g_mem_size > 0) {
ram_addr = qemu_ram_alloc(above_4g_mem_size);
--
debian.1.5.3.7.1-dirty
[-- Attachment #2: 0001-kvm-qemu-Enable-EPT-support-for-real-mode.patch --]
[-- Type: text/x-diff, Size: 1746 bytes --]
From de2bedf0890c95828b07ba3d2d98025fd39050a1 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Fri, 1 Feb 2008 07:33:13 +0800
Subject: [PATCH] kvm: qemu: Enable EPT support for real mode
The patch allocated one page from 0xcf000 (the last page of vga bios region),
took it as the guest identity mapped page table in real mode. Then we can
support EPT in real mode by using the address as guest CR3.
Signed-off-by: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
qemu/hw/pc.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 0e0d051..f3fa49c 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -758,6 +758,9 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
int index;
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BlockDriverState *fd[MAX_FD];
+#ifdef USE_KVM
+ uint32_t *table_items;
+#endif
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
@@ -851,6 +854,17 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
exit(1);
}
+#ifdef USE_KVM
+ if (kvm_allowed) {
+ /* set up identity map for EPT at the last page of VGA BIOS region.
+ * 0xe7 = _PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED |
+ * _PAGE_DIRTY | _PAGE_PSE */
+ table_items = (void *)(phys_ram_base + vga_bios_offset + 0xf000);
+ for (i = 0; i < 1024; i++)
+ table_items[i] = (i << 22) + 0xe7;
+ }
+#endif
+
/* above 4giga memory allocation */
if (above_4g_mem_size > 0) {
ram_addr = qemu_ram_alloc(above_4g_mem_size);
--
debian.1.5.3.7.1-dirty
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-01 8:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 8:26 [RFC][PATCH 7/7] kvm: qemu: Enable EPT support for real mode Yang, Sheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox