diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:03 -0500 |
commit | 674d67269e79f6697c3480363b28c9b9934fa60c (patch) | |
tree | fd7c3eff64e9f9a55556c99261d9b709b9125a55 /arch/x86/mm/pageattr_64.c | |
parent | 6faa4c53b2f06fd271060761ce27f4f53289175c (diff) |
x86: clean up differences between 64-bit and 32-bit
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr_64.c')
-rw-r--r-- | arch/x86/mm/pageattr_64.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/x86/mm/pageattr_64.c b/arch/x86/mm/pageattr_64.c index 139795029fb6..60cfb687f97c 100644 --- a/arch/x86/mm/pageattr_64.c +++ b/arch/x86/mm/pageattr_64.c | |||
@@ -126,30 +126,36 @@ out_unlock: | |||
126 | static int | 126 | static int |
127 | __change_page_attr(unsigned long address, struct page *page, pgprot_t prot) | 127 | __change_page_attr(unsigned long address, struct page *page, pgprot_t prot) |
128 | { | 128 | { |
129 | pgprot_t ref_prot2, oldprot; | ||
130 | struct page *kpte_page; | 129 | struct page *kpte_page; |
131 | int level, err = 0; | 130 | int level, err = 0; |
132 | pte_t *kpte; | 131 | pte_t *kpte; |
133 | 132 | ||
133 | BUG_ON(PageHighMem(page)); | ||
134 | |||
134 | repeat: | 135 | repeat: |
135 | kpte = lookup_address(address, &level); | 136 | kpte = lookup_address(address, &level); |
136 | if (!kpte) | 137 | if (!kpte) |
137 | return 0; | 138 | return 0; |
138 | 139 | ||
139 | kpte_page = virt_to_page(kpte); | 140 | kpte_page = virt_to_page(kpte); |
140 | oldprot = pte_pgprot(*kpte); | ||
141 | BUG_ON(PageLRU(kpte_page)); | 141 | BUG_ON(PageLRU(kpte_page)); |
142 | BUG_ON(PageCompound(kpte_page)); | 142 | BUG_ON(PageCompound(kpte_page)); |
143 | prot = canon_pgprot(prot); | 143 | |
144 | /* | ||
145 | * Better fail early if someone sets the kernel text to NX. | ||
146 | * Does not cover __inittext | ||
147 | */ | ||
148 | BUG_ON(address >= (unsigned long)&_text && | ||
149 | address < (unsigned long)&_etext && | ||
150 | (pgprot_val(prot) & _PAGE_NX)); | ||
144 | 151 | ||
145 | if (level == 4) { | 152 | if (level == 4) { |
146 | set_pte_atomic(kpte, mk_pte(page, prot)); | 153 | set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot))); |
147 | } else { | 154 | } else { |
148 | err = split_large_page(kpte, address); | 155 | err = split_large_page(kpte, address); |
149 | if (!err) | 156 | if (!err) |
150 | goto repeat; | 157 | goto repeat; |
151 | } | 158 | } |
152 | |||
153 | return err; | 159 | return err; |
154 | } | 160 | } |
155 | 161 | ||