From d5a6343dd3b50294a103b55085ab1c61a3a3982c Mon Sep 17 00:00:00 2001 From: "Balazs Gerofi bgerofi@riken.jp" Date: Fri, 10 May 2013 12:40:00 +0900 Subject: [PATCH] [Bug 15] get_pte malfunction in case of 2MiB page size: FIX --- arch/x86/kernel/memory.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/memory.c b/arch/x86/kernel/memory.c index 884e9698..34bcedd2 100644 --- a/arch/x86/kernel/memory.c +++ b/arch/x86/kernel/memory.c @@ -260,21 +260,15 @@ pte_t *get_pte(struct page_table *pt, void *virt, int attr) pt = newpt; } - /* TODO: PTATTR_LARGEPAGE + /* PTATTR_LARGEPAGE */ if (attr & PTATTR_LARGEPAGE) { - if (pt->entry[l2idx] & PFL2_PRESENT) { - if ((pt->entry[l2idx] & PAGE_MASK) != phys) { - return -EBUSY; - } else { - return 0; - } - } else { - pt->entry[l2idx] = phys | attr_to_l2attr(attr) - | PFL2_SIZE; - return 0; - } + return &(pt->entry[l2idx]); + } + + /* Requested regular page, but large is allocated? */ + if (pt->entry[l2idx] & PFL2_SIZE) { + return NULL; } - */ if (pt->entry[l2idx] & PFL2_PRESENT) { pt = phys_to_virt(pt->entry[l2idx] & PAGE_MASK);