diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2008-06-25 00:19:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:11:09 -0400 |
commit | 0814e0bace537b7024b09187346b99401e6281be (patch) | |
tree | 649a0a3e48e9fdef2c3ad3c96392936cc262a798 | |
parent | 4f30cb0262847392d8d006042f24bd90abd24f9d (diff) |
x86, 64-bit: split set_pte_vaddr()
We will need to set a pte on l3_user_pgt. Extract set_pte_vaddr_pud()
from set_pte_vaddr(), that will accept the l3 page table as parameter.
This change should be a no-op for existing code.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/mm/init_64.c | 31 | ||||
-rw-r--r-- | include/asm-x86/pgtable_64.h | 3 |
2 files changed, 23 insertions, 11 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index e62cbdd4e2d9..5c3305e05078 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -144,22 +144,13 @@ static __init void *spp_getpage(void) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | void | 146 | void |
147 | set_pte_vaddr(unsigned long vaddr, pte_t new_pte) | 147 | set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte) |
148 | { | 148 | { |
149 | pgd_t *pgd; | ||
150 | pud_t *pud; | 149 | pud_t *pud; |
151 | pmd_t *pmd; | 150 | pmd_t *pmd; |
152 | pte_t *pte; | 151 | pte_t *pte; |
153 | 152 | ||
154 | pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(new_pte)); | 153 | pud = pud_page + pud_index(vaddr); |
155 | |||
156 | pgd = pgd_offset_k(vaddr); | ||
157 | if (pgd_none(*pgd)) { | ||
158 | printk(KERN_ERR | ||
159 | "PGD FIXMAP MISSING, it should be setup in head.S!\n"); | ||
160 | return; | ||
161 | } | ||
162 | pud = pud_offset(pgd, vaddr); | ||
163 | if (pud_none(*pud)) { | 154 | if (pud_none(*pud)) { |
164 | pmd = (pmd_t *) spp_getpage(); | 155 | pmd = (pmd_t *) spp_getpage(); |
165 | pud_populate(&init_mm, pud, pmd); | 156 | pud_populate(&init_mm, pud, pmd); |
@@ -192,6 +183,24 @@ set_pte_vaddr(unsigned long vaddr, pte_t new_pte) | |||
192 | __flush_tlb_one(vaddr); | 183 | __flush_tlb_one(vaddr); |
193 | } | 184 | } |
194 | 185 | ||
186 | void | ||
187 | set_pte_vaddr(unsigned long vaddr, pte_t pteval) | ||
188 | { | ||
189 | pgd_t *pgd; | ||
190 | pud_t *pud_page; | ||
191 | |||
192 | pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(pteval)); | ||
193 | |||
194 | pgd = pgd_offset_k(vaddr); | ||
195 | if (pgd_none(*pgd)) { | ||
196 | printk(KERN_ERR | ||
197 | "PGD FIXMAP MISSING, it should be setup in head.S!\n"); | ||
198 | return; | ||
199 | } | ||
200 | pud_page = (pud_t*)pgd_page_vaddr(*pgd); | ||
201 | set_pte_vaddr_pud(pud_page, vaddr, pteval); | ||
202 | } | ||
203 | |||
195 | /* | 204 | /* |
196 | * The head.S code sets up the kernel high mapping: | 205 | * The head.S code sets up the kernel high mapping: |
197 | * | 206 | * |
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index 9a9350abe4ef..fa7208b483ca 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -70,6 +70,9 @@ extern void paging_init(void); | |||
70 | 70 | ||
71 | struct mm_struct; | 71 | struct mm_struct; |
72 | 72 | ||
73 | void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte); | ||
74 | |||
75 | |||
73 | static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, | 76 | static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, |
74 | pte_t *ptep) | 77 | pte_t *ptep) |
75 | { | 78 | { |