Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, highmem_32.c: Clean up comment x86, pgtable.h: Clean up types x86: Clean up dump_pagetable()
This commit is contained in:
commit
7dfd54a905
|
@ -135,6 +135,11 @@ static inline unsigned long pte_pfn(pte_t pte)
|
||||||
return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
|
return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned long pmd_pfn(pmd_t pmd)
|
||||||
|
{
|
||||||
|
return (pmd_val(pmd) & PTE_PFN_MASK) >> PAGE_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
|
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
|
||||||
|
|
||||||
static inline int pmd_large(pmd_t pte)
|
static inline int pmd_large(pmd_t pte)
|
||||||
|
@ -359,7 +364,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
||||||
* this macro returns the index of the entry in the pmd page which would
|
* this macro returns the index of the entry in the pmd page which would
|
||||||
* control the given virtual address
|
* control the given virtual address
|
||||||
*/
|
*/
|
||||||
static inline unsigned pmd_index(unsigned long address)
|
static inline unsigned long pmd_index(unsigned long address)
|
||||||
{
|
{
|
||||||
return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
|
return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
|
||||||
}
|
}
|
||||||
|
@ -379,7 +384,7 @@ static inline unsigned pmd_index(unsigned long address)
|
||||||
* this function returns the index of the entry in the pte page which would
|
* this function returns the index of the entry in the pte page which would
|
||||||
* control the given virtual address
|
* control the given virtual address
|
||||||
*/
|
*/
|
||||||
static inline unsigned pte_index(unsigned long address)
|
static inline unsigned long pte_index(unsigned long address)
|
||||||
{
|
{
|
||||||
return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
|
return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
|
||||||
}
|
}
|
||||||
|
@ -430,11 +435,6 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
|
||||||
return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
|
return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long pmd_pfn(pmd_t pmd)
|
|
||||||
{
|
|
||||||
return (pmd_val(pmd) & PTE_PFN_MASK) >> PAGE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pud_large(pud_t pud)
|
static inline int pud_large(pud_t pud)
|
||||||
{
|
{
|
||||||
return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
|
return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
|
||||||
|
@ -470,7 +470,7 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd)
|
||||||
#define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)
|
#define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)
|
||||||
|
|
||||||
/* to find an entry in a page-table-directory. */
|
/* to find an entry in a page-table-directory. */
|
||||||
static inline unsigned pud_index(unsigned long address)
|
static inline unsigned long pud_index(unsigned long address)
|
||||||
{
|
{
|
||||||
return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1);
|
return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,26 +285,25 @@ check_v8086_mode(struct pt_regs *regs, unsigned long address,
|
||||||
tsk->thread.screen_bitmap |= 1 << bit;
|
tsk->thread.screen_bitmap |= 1 << bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool low_pfn(unsigned long pfn)
|
||||||
|
{
|
||||||
|
return pfn < max_low_pfn;
|
||||||
|
}
|
||||||
|
|
||||||
static void dump_pagetable(unsigned long address)
|
static void dump_pagetable(unsigned long address)
|
||||||
{
|
{
|
||||||
__typeof__(pte_val(__pte(0))) page;
|
pgd_t *base = __va(read_cr3());
|
||||||
|
pgd_t *pgd = &base[pgd_index(address)];
|
||||||
page = read_cr3();
|
pmd_t *pmd;
|
||||||
page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT];
|
pte_t *pte;
|
||||||
|
|
||||||
#ifdef CONFIG_X86_PAE
|
#ifdef CONFIG_X86_PAE
|
||||||
printk("*pdpt = %016Lx ", page);
|
printk("*pdpt = %016Lx ", pgd_val(*pgd));
|
||||||
if ((page >> PAGE_SHIFT) < max_low_pfn
|
if (!low_pfn(pgd_val(*pgd) >> PAGE_SHIFT) || !pgd_present(*pgd))
|
||||||
&& page & _PAGE_PRESENT) {
|
goto out;
|
||||||
page &= PAGE_MASK;
|
|
||||||
page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT)
|
|
||||||
& (PTRS_PER_PMD - 1)];
|
|
||||||
printk(KERN_CONT "*pde = %016Lx ", page);
|
|
||||||
page &= ~_PAGE_NX;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
printk("*pde = %08lx ", page);
|
|
||||||
#endif
|
#endif
|
||||||
|
pmd = pmd_offset(pud_offset(pgd, address), address);
|
||||||
|
printk(KERN_CONT "*pde = %0*Lx ", sizeof(*pmd) * 2, (u64)pmd_val(*pmd));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must not directly access the pte in the highpte
|
* We must not directly access the pte in the highpte
|
||||||
|
@ -312,16 +311,12 @@ static void dump_pagetable(unsigned long address)
|
||||||
* And let's rather not kmap-atomic the pte, just in case
|
* And let's rather not kmap-atomic the pte, just in case
|
||||||
* it's allocated already:
|
* it's allocated already:
|
||||||
*/
|
*/
|
||||||
if ((page >> PAGE_SHIFT) < max_low_pfn
|
if (!low_pfn(pmd_pfn(*pmd)) || !pmd_present(*pmd) || pmd_large(*pmd))
|
||||||
&& (page & _PAGE_PRESENT)
|
goto out;
|
||||||
&& !(page & _PAGE_PSE)) {
|
|
||||||
|
|
||||||
page &= PAGE_MASK;
|
|
||||||
page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
|
|
||||||
& (PTRS_PER_PTE - 1)];
|
|
||||||
printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
pte = pte_offset_kernel(pmd, address);
|
||||||
|
printk("*pte = %0*Lx ", sizeof(*pte) * 2, (u64)pte_val(*pte));
|
||||||
|
out:
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,16 +445,12 @@ static int bad_address(void *p)
|
||||||
|
|
||||||
static void dump_pagetable(unsigned long address)
|
static void dump_pagetable(unsigned long address)
|
||||||
{
|
{
|
||||||
pgd_t *pgd;
|
pgd_t *base = __va(read_cr3() & PHYSICAL_PAGE_MASK);
|
||||||
|
pgd_t *pgd = base + pgd_index(address);
|
||||||
pud_t *pud;
|
pud_t *pud;
|
||||||
pmd_t *pmd;
|
pmd_t *pmd;
|
||||||
pte_t *pte;
|
pte_t *pte;
|
||||||
|
|
||||||
pgd = (pgd_t *)read_cr3();
|
|
||||||
|
|
||||||
pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
|
|
||||||
|
|
||||||
pgd += pgd_index(address);
|
|
||||||
if (bad_address(pgd))
|
if (bad_address(pgd))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void kunmap(struct page *page)
|
||||||
* no global lock is needed and because the kmap code must perform a global TLB
|
* no global lock is needed and because the kmap code must perform a global TLB
|
||||||
* invalidation when the kmap pool wraps.
|
* invalidation when the kmap pool wraps.
|
||||||
*
|
*
|
||||||
* However when holding an atomic kmap is is not legal to sleep, so atomic
|
* However when holding an atomic kmap it is not legal to sleep, so atomic
|
||||||
* kmaps are appropriate for short, tight code paths only.
|
* kmaps are appropriate for short, tight code paths only.
|
||||||
*/
|
*/
|
||||||
void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
|
void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot)
|
||||||
|
|
Loading…
Reference in New Issue