[Lguest] [PATCH]use existing helper function in gpgd_addr()

Morosan Catalin morosancatalin at gmail.com
Fri Sep 7 02:52:38 EST 2007


Hi,

this is a small patch that replaces an instruction with an existing helper
function.
The same helper function is used in spgd_addr().
If there's a reason not to use the helper function please explain why.
Also, if there are any problems in the way I submitted the patch, please
point them out.


Use existing helper function in gpgd_addr().

Signed-off-by: Catalin Morosan <morosancatalin at gmail.com>

---
 diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index b7a924a..85daf86 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -107,7 +107,7 @@ static spte_t *spte_addr(struct lguest *lg, spgd_t spgd,
unsigned long vaddr)
  * page tables.  Hence they return a Guest address. */
 static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr)
 {
-       unsigned int index = vaddr >> (PAGE_SHIFT + PTES_PER_PAGE_SHIFT);
+       unsigned int index = vaddr_to_pgd_index(vaddr);
        return lg->pgdirs[lg->pgdidx].cr3 + index * sizeof(gpgd_t);
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/lguest/attachments/20070906/c9de6c9d/attachment.htm>


More information about the Lguest mailing list