aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-20 16:12:18 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-20 18:09:41 -0500
commit8c938f9fae887f6e180bf802aa1c33cf74712aff (patch)
tree3912cb11487815aa870e579ffd76f0b3fbde89a3
parent107a03678cac0dd6cf7095f81442a4fa477e4700 (diff)
x86, mm: fault.c, factor out the vm86 fault check
Impact: cleanup Instead of an ugly, open-coded, #ifdef-ed vm86 related legacy check in do_page_fault(), put it into the check_v8086_mode() helper function and merge it with an existing #ifdef. Also, simplify the code flow a tiny bit in the helper. No code changed: arch/x86/mm/fault.o: text data bss dec hex filename 2711 12 12 2735 aaf fault.o.before 2711 12 12 2735 aaf fault.o.after Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/mm/fault.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 72973c7682ba..7dc0615c3cfe 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -328,14 +328,41 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
328 328
329 return pmd_k; 329 return pmd_k;
330} 330}
331#endif
332 331
333#ifdef CONFIG_X86_64 332/*
333 * Did it hit the DOS screen memory VA from vm86 mode?
334 */
335static inline void
336check_v8086_mode(struct pt_regs *regs, unsigned long address,
337 struct task_struct *tsk)
338{
339 unsigned long bit;
340
341 if (!v8086_mode(regs))
342 return;
343
344 bit = (address - 0xA0000) >> PAGE_SHIFT;
345 if (bit < 32)
346 tsk->thread.screen_bitmap |= 1 << bit;
347}
348
349#else /* CONFIG_X86_64: */
350
334static const char errata93_warning[] = 351static const char errata93_warning[] =
335KERN_ERR "******* Your BIOS seems to not contain a fix for K8 errata #93\n" 352KERN_ERR "******* Your BIOS seems to not contain a fix for K8 errata #93\n"
336KERN_ERR "******* Working around it, but it may cause SEGVs or burn power.\n" 353KERN_ERR "******* Working around it, but it may cause SEGVs or burn power.\n"
337KERN_ERR "******* Please consider a BIOS update.\n" 354KERN_ERR "******* Please consider a BIOS update.\n"
338KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n"; 355KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n";
356
357/*
358 * No vm86 mode in 64-bit mode:
359 */
360static inline void
361check_v8086_mode(struct pt_regs *regs, unsigned long address,
362 struct task_struct *tsk)
363{
364}
365
339#endif 366#endif
340 367
341/* 368/*
@@ -1091,16 +1118,8 @@ good_area:
1091 else 1118 else
1092 tsk->min_flt++; 1119 tsk->min_flt++;
1093 1120
1094#ifdef CONFIG_X86_32 1121 check_v8086_mode(regs, address, tsk);
1095 /* 1122
1096 * Did it hit the DOS screen memory VA from vm86 mode?
1097 */
1098 if (v8086_mode(regs)) {
1099 unsigned long bit = (address - 0xA0000) >> PAGE_SHIFT;
1100 if (bit < 32)
1101 tsk->thread.screen_bitmap |= 1 << bit;
1102 }
1103#endif
1104 up_read(&mm->mmap_sem); 1123 up_read(&mm->mmap_sem);
1105} 1124}
1106 1125