From: Jeremy Fitzhardinge <jeremy@goop.org>
To: the arch/x86 maintainers <x86@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] x86: implement set_pte_vaddr
Date: Tue, 17 Jun 2008 11:41:59 -0700 [thread overview]
Message-ID: <48580577.2040505@goop.org> (raw)
Re-name set_pte_pfn() to set_pte_vaddr(), taking a pte_t rather than
pfn/flags, and expose it. This allows the pte to constructed in
arbitrary ways, rather than just via __pte(), which may be necessary
in a virtual environment.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
---
arch/x86/mm/init_64.c | 9 ++++-----
arch/x86/mm/pgtable.c | 2 +-
arch/x86/mm/pgtable_32.c | 6 +++---
include/asm-x86/pgtable.h | 3 +++
4 files changed, 11 insertions(+), 9 deletions(-)
===================================================================
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -136,15 +136,15 @@ static __init void *spp_getpage(void)
return ptr;
}
-static void
-set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
+void
+set_pte_vaddr(unsigned long vaddr, pte_t new_pte)
{
pgd_t *pgd;
pud_t *pud;
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);
if (pgd_none(*pgd)) {
@@ -171,7 +171,6 @@ set_pte_phys(unsigned long vaddr, unsign
return;
}
}
- new_pte = pfn_pte(phys >> PAGE_SHIFT, prot);
pte = pte_offset_kernel(pmd, vaddr);
if (!pte_none(*pte) && pte_val(new_pte) &&
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
===================================================================
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -285,6 +285,6 @@ void __set_fixmap (enum fixed_addresses
BUG();
return;
}
- set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
+ set_pte_vaddr(address, pfn_pte(phys >> PAGE_SHIFT, flags));
fixmaps_set++;
}
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
===================================================================
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -71,7 +71,7 @@ void show_mem(void)
* Associate a virtual page frame with a given physical page 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;
pud_t *pud;
@@ -94,8 +94,8 @@ static void set_pte_pfn(unsigned long va
return;
}
pte = pte_offset_kernel(pmd, vaddr);
- if (pgprot_val(flags))
- set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags));
+ if (pte_val(pteval))
+ set_pte_present(&init_mm, vaddr, pte, pteval);
else
pte_clear(&init_mm, vaddr, pte);
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
===================================================================
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -313,6 +313,9 @@ int phys_mem_access_prot_allowed(struct
unsigned long size, pgprot_t *vma_prot);
#endif
+/* Install a pte for a particular vaddr in kernel space. */
+void set_pte_vaddr(unsigned long vaddr, pte_t pte);
+
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#else /* !CONFIG_PARAVIRT */
reply other threads:[~2008-06-17 18:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48580577.2040505@goop.org \
--to=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.