aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChuck Ebbert <76306.1226@compuserve.com>2006-06-23 05:04:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:58 -0400
commit19964fecf25c17f865dec07ae242b1a40ea93f16 (patch)
treee3eae33af9583dd6a7f88f54b2e9e0f5ecd0b74d /arch
parent110cb1d2e343443c4a4b5f7e081928aa4da90f93 (diff)
[PATCH] i386: fix get_segment_eip() with vm86 segments
We need to check for vm86 mode first before looking at selector privilege bits. Segment limit is always base + 64k and only the low 16 bits of EIP are significant in vm86 mode. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Cc: Andi Kleen <ak@muc.de> Cc: Zachary Amsden <zach@vmware.com> Cc: Rohit Seth <rohitseth@google.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/mm/fault.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index f38085ff3c3d..bd6fe96cc16d 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -77,12 +77,15 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
77 unsigned seg = regs->xcs & 0xffff; 77 unsigned seg = regs->xcs & 0xffff;
78 u32 seg_ar, seg_limit, base, *desc; 78 u32 seg_ar, seg_limit, base, *desc;
79 79
80 /* Unlikely, but must come before segment checks. */
81 if (unlikely(regs->eflags & VM_MASK)) {
82 base = seg << 4;
83 *eip_limit = base + 0xffff;
84 return base + (eip & 0xffff);
85 }
86
80 /* The standard kernel/user address space limit. */ 87 /* The standard kernel/user address space limit. */
81 *eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg; 88 *eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg;
82
83 /* Unlikely, but must come before segment checks. */
84 if (unlikely((regs->eflags & VM_MASK) != 0))
85 return eip + (seg << 4);
86 89
87 /* By far the most common cases. */ 90 /* By far the most common cases. */
88 if (likely(seg == __USER_CS || seg == __KERNEL_CS)) 91 if (likely(seg == __USER_CS || seg == __KERNEL_CS))