diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-01-30 13:33:12 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 13:33:12 +0100 |
commit | f2857ce92023409df1544737d5b3499b4630a183 (patch) | |
tree | df2c5bd9ce155950c0f48c1126b2fdf2db4b64d4 /arch/x86/mm | |
parent | 37cd9cf3dafed82f7cf905785883300f6ff7c818 (diff) |
x86: remove last user of get_segment_eip
is_prefetch was the last user of get_segment_eip and only on
X86_32. This function returned the faulting instruction's
address and set the upper segment limit.
Instead, use the convert_ip_to_linear helper and rely on
probe_kernel_address to do the segment checks which was
already done everywhere the segment limit was being checked
on X86_32.
Remove get_segment_eip as well.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/fault_32.c | 15 | ||||
-rw-r--r-- | arch/x86/mm/fault_64.c | 15 |
2 files changed, 4 insertions, 26 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index b4d19c2d4f0..36cb67e02b0 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c @@ -81,7 +81,6 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, unsigned char *max_instr; #ifdef CONFIG_X86_32 - unsigned long limit; if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && boot_cpu_data.x86 >= 6)) { /* Catch an obscure case of prefetch inside an NX page. */ @@ -90,30 +89,23 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, } else { return 0; } - instr = (unsigned char *)get_segment_eip(regs, &limit); #else /* If it was a exec fault ignore */ if (error_code & PF_INSTR) return 0; - instr = (unsigned char __user *)convert_ip_to_linear(current, regs); #endif + instr = (unsigned char *)convert_ip_to_linear(current, regs); max_instr = instr + 15; -#ifdef CONFIG_X86_64 if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) return 0; -#endif while (scan_more && instr < max_instr) { unsigned char opcode; unsigned char instr_hi; unsigned char instr_lo; -#ifdef CONFIG_X86_32 - if (instr > (unsigned char *)limit) - break; -#endif if (probe_kernel_address(instr, opcode)) break; @@ -155,10 +147,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, case 0x00: /* Prefetch instruction is 0x0F0D or 0x0F18 */ scan_more = 0; -#ifdef CONFIG_X86_32 - if (instr > (unsigned char *)limit) - break; -#endif + if (probe_kernel_address(instr, opcode)) break; prefetch = (instr_lo == 0xF) && diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c index d519b41f196..80f8436ac8b 100644 --- a/arch/x86/mm/fault_64.c +++ b/arch/x86/mm/fault_64.c @@ -84,7 +84,6 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, unsigned char *max_instr; #ifdef CONFIG_X86_32 - unsigned long limit; if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && boot_cpu_data.x86 >= 6)) { /* Catch an obscure case of prefetch inside an NX page. */ @@ -93,30 +92,23 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, } else { return 0; } - instr = (unsigned char *)get_segment_eip(regs, &limit); #else /* If it was a exec fault ignore */ if (error_code & PF_INSTR) return 0; - instr = (unsigned char __user *)convert_ip_to_linear(current, regs); #endif + instr = (unsigned char *)convert_ip_to_linear(current, regs); max_instr = instr + 15; -#ifdef CONFIG_X86_64 if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) return 0; -#endif while (scan_more && instr < max_instr) { unsigned char opcode; unsigned char instr_hi; unsigned char instr_lo; -#ifdef CONFIG_X86_32 - if (instr > (unsigned char *)limit) - break; -#endif if (probe_kernel_address(instr, opcode)) break; @@ -158,10 +150,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, case 0x00: /* Prefetch instruction is 0x0F0D or 0x0F18 */ scan_more = 0; -#ifdef CONFIG_X86_32 - if (instr > (unsigned char *)limit) - break; -#endif + if (probe_kernel_address(instr, opcode)) break; prefetch = (instr_lo == 0xF) && |