aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/fault_64.c
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-01-30 07:33:12 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:12 -0500
commitf2857ce92023409df1544737d5b3499b4630a183 (patch)
treedf2c5bd9ce155950c0f48c1126b2fdf2db4b64d4 /arch/x86/mm/fault_64.c
parent37cd9cf3dafed82f7cf905785883300f6ff7c818 (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/fault_64.c')
-rw-r--r--arch/x86/mm/fault_64.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index d519b41f1962..80f8436ac8b2 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,
84 unsigned char *max_instr; 84 unsigned char *max_instr;
85 85
86#ifdef CONFIG_X86_32 86#ifdef CONFIG_X86_32
87 unsigned long limit;
88 if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && 87 if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
89 boot_cpu_data.x86 >= 6)) { 88 boot_cpu_data.x86 >= 6)) {
90 /* Catch an obscure case of prefetch inside an NX page. */ 89 /* 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,
93 } else { 92 } else {
94 return 0; 93 return 0;
95 } 94 }
96 instr = (unsigned char *)get_segment_eip(regs, &limit);
97#else 95#else
98 /* If it was a exec fault ignore */ 96 /* If it was a exec fault ignore */
99 if (error_code & PF_INSTR) 97 if (error_code & PF_INSTR)
100 return 0; 98 return 0;
101 instr = (unsigned char __user *)convert_ip_to_linear(current, regs);
102#endif 99#endif
103 100
101 instr = (unsigned char *)convert_ip_to_linear(current, regs);
104 max_instr = instr + 15; 102 max_instr = instr + 15;
105 103
106#ifdef CONFIG_X86_64
107 if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) 104 if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE)
108 return 0; 105 return 0;
109#endif
110 106
111 while (scan_more && instr < max_instr) { 107 while (scan_more && instr < max_instr) {
112 unsigned char opcode; 108 unsigned char opcode;
113 unsigned char instr_hi; 109 unsigned char instr_hi;
114 unsigned char instr_lo; 110 unsigned char instr_lo;
115 111
116#ifdef CONFIG_X86_32
117 if (instr > (unsigned char *)limit)
118 break;
119#endif
120 if (probe_kernel_address(instr, opcode)) 112 if (probe_kernel_address(instr, opcode))
121 break; 113 break;
122 114
@@ -158,10 +150,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr,
158 case 0x00: 150 case 0x00:
159 /* Prefetch instruction is 0x0F0D or 0x0F18 */ 151 /* Prefetch instruction is 0x0F0D or 0x0F18 */
160 scan_more = 0; 152 scan_more = 0;
161#ifdef CONFIG_X86_32 153
162 if (instr > (unsigned char *)limit)
163 break;
164#endif
165 if (probe_kernel_address(instr, opcode)) 154 if (probe_kernel_address(instr, opcode))
166 break; 155 break;
167 prefetch = (instr_lo == 0xF) && 156 prefetch = (instr_lo == 0xF) &&