x86: implement set_pte_vaddr
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Родитель
7c7e6e07e2
Коммит
d494a96125
|
@ -135,15 +135,15 @@ static __init void *spp_getpage(void)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
|
set_pte_vaddr(unsigned long vaddr, pte_t new_pte)
|
||||||
{
|
{
|
||||||
pgd_t *pgd;
|
pgd_t *pgd;
|
||||||
pud_t *pud;
|
pud_t *pud;
|
||||||
pmd_t *pmd;
|
pmd_t *pmd;
|
||||||
pte_t *pte, new_pte;
|
pte_t *pte;
|
||||||
|
|
||||||
pr_debug("set_pte_phys %lx to %lx\n", vaddr, phys);
|
pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(new_pte));
|
||||||
|
|
||||||
pgd = pgd_offset_k(vaddr);
|
pgd = pgd_offset_k(vaddr);
|
||||||
if (pgd_none(*pgd)) {
|
if (pgd_none(*pgd)) {
|
||||||
|
@ -170,7 +170,6 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new_pte = pfn_pte(phys >> PAGE_SHIFT, prot);
|
|
||||||
|
|
||||||
pte = pte_offset_kernel(pmd, vaddr);
|
pte = pte_offset_kernel(pmd, vaddr);
|
||||||
if (!pte_none(*pte) && pte_val(new_pte) &&
|
if (!pte_none(*pte) && pte_val(new_pte) &&
|
||||||
|
|
|
@ -285,6 +285,6 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
|
||||||
BUG();
|
BUG();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
|
set_pte_vaddr(address, pfn_pte(phys >> PAGE_SHIFT, flags));
|
||||||
fixmaps_set++;
|
fixmaps_set++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ void show_mem(void)
|
||||||
* Associate a virtual page frame with a given physical page frame
|
* Associate a virtual page frame with a given physical page frame
|
||||||
* and protection flags for that frame.
|
* and protection flags for that frame.
|
||||||
*/
|
*/
|
||||||
static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
|
void set_pte_vaddr(unsigned long vaddr, pte_t pteval)
|
||||||
{
|
{
|
||||||
pgd_t *pgd;
|
pgd_t *pgd;
|
||||||
pud_t *pud;
|
pud_t *pud;
|
||||||
|
@ -94,8 +94,8 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pte = pte_offset_kernel(pmd, vaddr);
|
pte = pte_offset_kernel(pmd, vaddr);
|
||||||
if (pgprot_val(flags))
|
if (pte_val(pteval))
|
||||||
set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags));
|
set_pte_present(&init_mm, vaddr, pte, pteval);
|
||||||
else
|
else
|
||||||
pte_clear(&init_mm, vaddr, pte);
|
pte_clear(&init_mm, vaddr, pte);
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
|
||||||
unsigned long size, pgprot_t *vma_prot);
|
unsigned long size, pgprot_t *vma_prot);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Install a pte for a particular vaddr in kernel space. */
|
||||||
|
void set_pte_vaddr(unsigned long vaddr, pte_t pte);
|
||||||
|
|
||||||
#ifdef CONFIG_PARAVIRT
|
#ifdef CONFIG_PARAVIRT
|
||||||
#include <asm/paravirt.h>
|
#include <asm/paravirt.h>
|
||||||
#else /* !CONFIG_PARAVIRT */
|
#else /* !CONFIG_PARAVIRT */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче