diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-01-30 07:33:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:12 -0500 |
commit | f2857ce92023409df1544737d5b3499b4630a183 (patch) | |
tree | df2c5bd9ce155950c0f48c1126b2fdf2db4b64d4 /arch/x86/mm/fault_32.c | |
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/fault_32.c')
-rw-r--r-- | arch/x86/mm/fault_32.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index b4d19c2d4f05..36cb67e02b04 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, | |||
81 | unsigned char *max_instr; | 81 | unsigned char *max_instr; |
82 | 82 | ||
83 | #ifdef CONFIG_X86_32 | 83 | #ifdef CONFIG_X86_32 |
84 | unsigned long limit; | ||
85 | if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && | 84 | if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && |
86 | boot_cpu_data.x86 >= 6)) { | 85 | boot_cpu_data.x86 >= 6)) { |
87 | /* Catch an obscure case of prefetch inside an NX page. */ | 86 | /* 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, | |||
90 | } else { | 89 | } else { |
91 | return 0; | 90 | return 0; |
92 | } | 91 | } |
93 | instr = (unsigned char *)get_segment_eip(regs, &limit); | ||
94 | #else | 92 | #else |
95 | /* If it was a exec fault ignore */ | 93 | /* If it was a exec fault ignore */ |
96 | if (error_code & PF_INSTR) | 94 | if (error_code & PF_INSTR) |
97 | return 0; | 95 | return 0; |
98 | instr = (unsigned char __user *)convert_ip_to_linear(current, regs); | ||
99 | #endif | 96 | #endif |
100 | 97 | ||
98 | instr = (unsigned char *)convert_ip_to_linear(current, regs); | ||
101 | max_instr = instr + 15; | 99 | max_instr = instr + 15; |
102 | 100 | ||
103 | #ifdef CONFIG_X86_64 | ||
104 | if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) | 101 | if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) |
105 | return 0; | 102 | return 0; |
106 | #endif | ||
107 | 103 | ||
108 | while (scan_more && instr < max_instr) { | 104 | while (scan_more && instr < max_instr) { |
109 | unsigned char opcode; | 105 | unsigned char opcode; |
110 | unsigned char instr_hi; | 106 | unsigned char instr_hi; |
111 | unsigned char instr_lo; | 107 | unsigned char instr_lo; |
112 | 108 | ||
113 | #ifdef CONFIG_X86_32 | ||
114 | if (instr > (unsigned char *)limit) | ||
115 | break; | ||
116 | #endif | ||
117 | if (probe_kernel_address(instr, opcode)) | 109 | if (probe_kernel_address(instr, opcode)) |
118 | break; | 110 | break; |
119 | 111 | ||
@@ -155,10 +147,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, | |||
155 | case 0x00: | 147 | case 0x00: |
156 | /* Prefetch instruction is 0x0F0D or 0x0F18 */ | 148 | /* Prefetch instruction is 0x0F0D or 0x0F18 */ |
157 | scan_more = 0; | 149 | scan_more = 0; |
158 | #ifdef CONFIG_X86_32 | 150 | |
159 | if (instr > (unsigned char *)limit) | ||
160 | break; | ||
161 | #endif | ||
162 | if (probe_kernel_address(instr, opcode)) | 151 | if (probe_kernel_address(instr, opcode)) |
163 | break; | 152 | break; |
164 | prefetch = (instr_lo == 0xF) && | 153 | prefetch = (instr_lo == 0xF) && |