Commit d4ba27b9 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Consolidate pgd_cache calculations.

Do it in one spot, a macro named get_pgd_cache(), instead of
three different places.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 733bc5b7
...@@ -333,9 +333,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -333,9 +333,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
current->mm->start_stack = current->mm->start_stack =
(unsigned long) create_aout32_tables((char __user *)bprm->p, bprm); (unsigned long) create_aout32_tables((char __user *)bprm->p, bprm);
if (!(orig_thr_flags & _TIF_32BIT)) { if (!(orig_thr_flags & _TIF_32BIT)) {
unsigned long pgd_cache; unsigned long pgd_cache = get_pgd_cache(current->mm->pgd);
pgd_cache = ((unsigned long)pgd_val(current->mm->pgd[0]))<<11;
__asm__ __volatile__("stxa\t%0, [%1] %2\n\t" __asm__ __volatile__("stxa\t%0, [%1] %2\n\t"
"membar #Sync" "membar #Sync"
: /* no outputs */ : /* no outputs */
......
...@@ -440,7 +440,7 @@ void flush_thread(void) ...@@ -440,7 +440,7 @@ void flush_thread(void)
pmd_t *page = pmd_alloc_one(mm, 0); pmd_t *page = pmd_alloc_one(mm, 0);
pud_set(pud0, page); pud_set(pud0, page);
} }
pgd_cache = ((unsigned long) pud_val(*pud0)) << 11UL; pgd_cache = get_pgd_cache(pgd0);
} }
__asm__ __volatile__("stxa %0, [%1] %2\n\t" __asm__ __volatile__("stxa %0, [%1] %2\n\t"
"membar #Sync" "membar #Sync"
......
...@@ -83,8 +83,7 @@ do { \ ...@@ -83,8 +83,7 @@ do { \
paddr = __pa((__mm)->pgd); \ paddr = __pa((__mm)->pgd); \
pgd_cache = 0UL; \ pgd_cache = 0UL; \
if ((__tsk)->thread_info->flags & _TIF_32BIT) \ if ((__tsk)->thread_info->flags & _TIF_32BIT) \
pgd_cache = \ pgd_cache = get_pgd_cache((__mm)->pgd); \
((unsigned long)pgd_val((__mm)->pgd[0])) << 11UL; \
__asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \ __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \
"mov %3, %%g4\n\t" \ "mov %3, %%g4\n\t" \
"mov %0, %%g7\n\t" \ "mov %0, %%g7\n\t" \
......
...@@ -312,6 +312,11 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot) ...@@ -312,6 +312,11 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
/* to find an entry in a kernel page-table-directory */ /* to find an entry in a kernel page-table-directory */
#define pgd_offset_k(address) pgd_offset(&init_mm, address) #define pgd_offset_k(address) pgd_offset(&init_mm, address)
/* extract the pgd cache used for optimizing the tlb miss
* slow path when executing 32-bit compat processes
*/
#define get_pgd_cache(pgd) ((unsigned long) pgd_val(*pgd) << 11)
/* Find an entry in the second-level page table.. */ /* Find an entry in the second-level page table.. */
#define pmd_offset(pudp, address) \ #define pmd_offset(pudp, address) \
((pmd_t *) pud_page(*(pudp)) + \ ((pmd_t *) pud_page(*(pudp)) + \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment