diff options
Diffstat (limited to 'arch/sh/mm/init.c')
-rw-r--r-- | arch/sh/mm/init.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 8ea27ca4b700..d1a979eab656 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -80,6 +80,7 @@ void show_mem(void) | |||
80 | static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) | 80 | static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) |
81 | { | 81 | { |
82 | pgd_t *pgd; | 82 | pgd_t *pgd; |
83 | pud_t *pud; | ||
83 | pmd_t *pmd; | 84 | pmd_t *pmd; |
84 | pte_t *pte; | 85 | pte_t *pte; |
85 | 86 | ||
@@ -89,7 +90,17 @@ static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) | |||
89 | return; | 90 | return; |
90 | } | 91 | } |
91 | 92 | ||
92 | pmd = pmd_offset(pgd, addr); | 93 | pud = pud_offset(pgd, addr); |
94 | if (pud_none(*pud)) { | ||
95 | pmd = (pmd_t *)get_zeroed_page(GFP_ATOMIC); | ||
96 | set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER)); | ||
97 | if (pmd != pmd_offset(pud, 0)) { | ||
98 | pud_ERROR(*pud); | ||
99 | return; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | pmd = pmd_offset(pud, addr); | ||
93 | if (pmd_none(*pmd)) { | 104 | if (pmd_none(*pmd)) { |
94 | pte = (pte_t *)get_zeroed_page(GFP_ATOMIC); | 105 | pte = (pte_t *)get_zeroed_page(GFP_ATOMIC); |
95 | set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER)); | 106 | set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER)); |