Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 arch/x86/lguest/boot.c       |    4 ++--
 drivers/lguest/page_tables.c |    9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff -r c0506c353a7c arch/x86/lguest/boot.c
--- a/arch/x86/lguest/boot.c	Tue Aug 19 19:36:56 2008 +1000
+++ b/arch/x86/lguest/boot.c	Mon Aug 25 09:50:02 2008 +1000
@@ -340,8 +340,8 @@ static void lguest_cpuid(unsigned int *a
 		 * kernel mappings (addresses above 0xC0000000 or whatever
 		 * PAGE_OFFSET is set to) haven't changed.  But Linux calls
 		 * flush_tlb_user() for both user and kernel mappings unless
-		 * the Page Global Enable (PGE) feature bit is set. */
-		/* Lets also try with PSE support */
+		 * the Page Global Enable (PGE) feature bit is set.  We also
+		 * turn on Page Size Extention (PSE) which allows 4MB pages. */
 		*dx |= 0x00002008;
 		break;
 	case 0x80000000:
diff -r c0506c353a7c drivers/lguest/page_tables.c
--- a/drivers/lguest/page_tables.c	Tue Aug 19 19:36:56 2008 +1000
+++ b/drivers/lguest/page_tables.c	Mon Aug 25 09:50:02 2008 +1000
@@ -219,9 +219,10 @@ int demand_page(struct lg_cpu *cpu, unsi
 	if (!(pgd_flags(gpgd) & _PAGE_PRESENT))
 		return 0;
 
-	/* If the gpgd is actually pointing to a 4MB page,
-	 * instead of pointing to a pte page, we will back it
-	 * with 4KB pages in the host */
+	/* The Guest can set the PSE bit which means instead of pointing to a
+	 * page of page table entries, this itself is a page table entry to a
+	 * 4MB page.  But it's hard for us to get a 4MB page to use here in the
+	 * Host, so the shadow doesn't use PTE: we make a normal page table. */
 	if (pgd_flags(gpgd) & _PAGE_PSE) {
 		/* Check they're not trying to write to a page the Guest wants
 		 * read-only (bit 2 of errcode == write). */
@@ -248,7 +249,7 @@ int demand_page(struct lg_cpu *cpu, unsi
 					   "out of memory allocating pte page");
 			/* We build a shadow pgd, pointing to the PTE page */
 			set_pgd(spgd, __pgd(__pa(ptepage) |
-			      (pgd_flags(gpgd) & ~_PAGE_PSE &  _PAGE_TABLE)));
+			      (pgd_flags(gpgd) & ~_PAGE_PSE & _PAGE_TABLE)));
 		}
 
 		/* Add the _PAGE_ACCESSED and (for a write) _PAGE_DIRTY flag */
