From: Jack Lange <jarusl@cs.northwestern.edu>
Date: Fri, 31 Oct 2008 23:12:11 +0000 (-0500)
Subject: added to string function for page_type enumerator
X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=436d82be19d03d68da09711b3a77a185698f15a3;p=palacios.releases.git

added to string function for page_type enumerator
---

diff --git a/palacios/include/palacios/vmm_paging.h b/palacios/include/palacios/vmm_paging.h
index a4f520e..b2e0a65 100644
--- a/palacios/include/palacios/vmm_paging.h
+++ b/palacios/include/palacios/vmm_paging.h
@@ -557,6 +557,8 @@ pml4e64_t * create_passthrough_pts_64(struct guest_info * info);
 
 
 
+const uchar_t * v3_page_type_to_str(page_type_t type);
+
 
 //#include <palacios/vm_guest.h>
 
diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c
index c6db0c0..edcab77 100644
--- a/palacios/src/palacios/vmm_paging.c
+++ b/palacios/src/palacios/vmm_paging.c
@@ -1833,3 +1833,53 @@ int v3_walk_host_pt_64(v3_reg_t host_cr3,
   }
   return 0;
 }
+
+
+
+static const uchar_t PAGE_4KB_STR[] = "4KB_PAGE";
+static const uchar_t PAGE_2MB_STR[] = "2MB_PAGE";
+static const uchar_t PAGE_4MB_STR[] = "4MB_PAGE";
+static const uchar_t PAGE_1GB_STR[] = "1GB_PAGE";
+static const uchar_t PAGE_PT32_STR[] = "32 Bit PT";
+static const uchar_t PAGE_PD32_STR[] = "32 Bit PD";
+static const uchar_t PAGE_PDP32PAE_STR[] = "32 Bit PAE PDP";
+static const uchar_t PAGE_PD32PAE_STR[] = "32 Bit PAE PD";
+static const uchar_t PAGE_PT32PAE_STR[] = "32 Bit PAE PT";
+static const uchar_t PAGE_PML464_STR[] = "64 Bit PML4";
+static const uchar_t PAGE_PDP64_STR[] = "64 Bit PDP";
+static const uchar_t PAGE_PD64_STR[] = "64 Bit PD";
+static const uchar_t PAGE_PT64_STR[] = "64 Bit PT";
+
+
+const uchar_t * v3_page_type_to_str(page_type_t type) {
+  switch (type) {
+  case PAGE_4KB:
+    return PAGE_4KB_STR;
+  case PAGE_2MB:
+    return PAGE_2MB_STR;
+  case PAGE_4MB:
+    return PAGE_4MB_STR;
+  case PAGE_1GB:
+    return PAGE_1GB_STR;
+  case PAGE_PT32:
+    return PAGE_PT32_STR;
+  case PAGE_PD32:
+    return PAGE_PD32_STR;
+  case PAGE_PDP32PAE:
+    return PAGE_PDP32PAE_STR;
+  case PAGE_PD32PAE:
+    return PAGE_PD32PAE_STR;
+  case PAGE_PT32PAE:
+    return PAGE_PT32PAE_STR;
+  case PAGE_PML464:
+    return PAGE_PML464_STR;
+  case PAGE_PDP64:
+    return PAGE_PDP64_STR;
+  case PAGE_PD64:
+    return PAGE_PD64_STR;
+  case PAGE_PT64:
+    return PAGE_PT64_STR;
+  default:
+    return NULL;
+  }
+}