diff options
Diffstat (limited to 'arch/x86/kernel/traps.c')
| -rw-r--r-- | arch/x86/kernel/traps.c | 64 |
1 files changed, 9 insertions, 55 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index a9e7548e1790..a1d288327ff0 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
| @@ -54,15 +54,14 @@ | |||
| 54 | #include <asm/desc.h> | 54 | #include <asm/desc.h> |
| 55 | #include <asm/i387.h> | 55 | #include <asm/i387.h> |
| 56 | 56 | ||
| 57 | #include <mach_traps.h> | 57 | #include <asm/mach_traps.h> |
| 58 | 58 | ||
| 59 | #ifdef CONFIG_X86_64 | 59 | #ifdef CONFIG_X86_64 |
| 60 | #include <asm/pgalloc.h> | 60 | #include <asm/pgalloc.h> |
| 61 | #include <asm/proto.h> | 61 | #include <asm/proto.h> |
| 62 | #include <asm/pda.h> | ||
| 63 | #else | 62 | #else |
| 64 | #include <asm/processor-flags.h> | 63 | #include <asm/processor-flags.h> |
| 65 | #include <asm/arch_hooks.h> | 64 | #include <asm/setup.h> |
| 66 | #include <asm/traps.h> | 65 | #include <asm/traps.h> |
| 67 | 66 | ||
| 68 | #include "cpu/mcheck/mce.h" | 67 | #include "cpu/mcheck/mce.h" |
| @@ -119,47 +118,6 @@ die_if_kernel(const char *str, struct pt_regs *regs, long err) | |||
| 119 | if (!user_mode_vm(regs)) | 118 | if (!user_mode_vm(regs)) |
| 120 | die(str, regs, err); | 119 | die(str, regs, err); |
| 121 | } | 120 | } |
| 122 | |||
| 123 | /* | ||
| 124 | * Perform the lazy TSS's I/O bitmap copy. If the TSS has an | ||
| 125 | * invalid offset set (the LAZY one) and the faulting thread has | ||
| 126 | * a valid I/O bitmap pointer, we copy the I/O bitmap in the TSS, | ||
| 127 | * we set the offset field correctly and return 1. | ||
| 128 | */ | ||
| 129 | static int lazy_iobitmap_copy(void) | ||
| 130 | { | ||
| 131 | struct thread_struct *thread; | ||
| 132 | struct tss_struct *tss; | ||
| 133 | int cpu; | ||
| 134 | |||
| 135 | cpu = get_cpu(); | ||
| 136 | tss = &per_cpu(init_tss, cpu); | ||
| 137 | thread = ¤t->thread; | ||
| 138 | |||
| 139 | if (tss->x86_tss.io_bitmap_base == INVALID_IO_BITMAP_OFFSET_LAZY && | ||
| 140 | thread->io_bitmap_ptr) { | ||
| 141 | memcpy(tss->io_bitmap, thread->io_bitmap_ptr, | ||
| 142 | thread->io_bitmap_max); | ||
| 143 | /* | ||
| 144 | * If the previously set map was extending to higher ports | ||
| 145 | * than the current one, pad extra space with 0xff (no access). | ||
| 146 | */ | ||
| 147 | if (thread->io_bitmap_max < tss->io_bitmap_max) { | ||
| 148 | memset((char *) tss->io_bitmap + | ||
| 149 | thread->io_bitmap_max, 0xff, | ||
| 150 | tss->io_bitmap_max - thread->io_bitmap_max); | ||
| 151 | } | ||
| 152 | tss->io_bitmap_max = thread->io_bitmap_max; | ||
| 153 | tss->x86_tss.io_bitmap_base = IO_BITMAP_OFFSET; | ||
| 154 | tss->io_bitmap_owner = thread; | ||
| 155 | put_cpu(); | ||
| 156 | |||
| 157 | return 1; | ||
| 158 | } | ||
| 159 | put_cpu(); | ||
| 160 | |||
| 161 | return 0; | ||
| 162 | } | ||
| 163 | #endif | 121 | #endif |
| 164 | 122 | ||
| 165 | static void __kprobes | 123 | static void __kprobes |
| @@ -310,11 +268,6 @@ do_general_protection(struct pt_regs *regs, long error_code) | |||
| 310 | conditional_sti(regs); | 268 | conditional_sti(regs); |
| 311 | 269 | ||
| 312 | #ifdef CONFIG_X86_32 | 270 | #ifdef CONFIG_X86_32 |
| 313 | if (lazy_iobitmap_copy()) { | ||
| 314 | /* restart the faulting instruction */ | ||
| 315 | return; | ||
| 316 | } | ||
| 317 | |||
| 318 | if (regs->flags & X86_VM_MASK) | 271 | if (regs->flags & X86_VM_MASK) |
| 319 | goto gp_in_vm86; | 272 | goto gp_in_vm86; |
| 320 | #endif | 273 | #endif |
| @@ -914,19 +867,20 @@ void math_emulate(struct math_emu_info *info) | |||
| 914 | } | 867 | } |
| 915 | #endif /* CONFIG_MATH_EMULATION */ | 868 | #endif /* CONFIG_MATH_EMULATION */ |
| 916 | 869 | ||
| 917 | dotraplinkage void __kprobes do_device_not_available(struct pt_regs regs) | 870 | dotraplinkage void __kprobes |
| 871 | do_device_not_available(struct pt_regs *regs, long error_code) | ||
| 918 | { | 872 | { |
| 919 | #ifdef CONFIG_X86_32 | 873 | #ifdef CONFIG_X86_32 |
| 920 | if (read_cr0() & X86_CR0_EM) { | 874 | if (read_cr0() & X86_CR0_EM) { |
| 921 | struct math_emu_info info = { }; | 875 | struct math_emu_info info = { }; |
| 922 | 876 | ||
| 923 | conditional_sti(®s); | 877 | conditional_sti(regs); |
| 924 | 878 | ||
| 925 | info.regs = ®s; | 879 | info.regs = regs; |
| 926 | math_emulate(&info); | 880 | math_emulate(&info); |
| 927 | } else { | 881 | } else { |
| 928 | math_state_restore(); /* interrupts still off */ | 882 | math_state_restore(); /* interrupts still off */ |
| 929 | conditional_sti(®s); | 883 | conditional_sti(regs); |
| 930 | } | 884 | } |
| 931 | #else | 885 | #else |
| 932 | math_state_restore(); | 886 | math_state_restore(); |
| @@ -942,7 +896,7 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) | |||
| 942 | info.si_signo = SIGILL; | 896 | info.si_signo = SIGILL; |
| 943 | info.si_errno = 0; | 897 | info.si_errno = 0; |
| 944 | info.si_code = ILL_BADSTK; | 898 | info.si_code = ILL_BADSTK; |
| 945 | info.si_addr = 0; | 899 | info.si_addr = NULL; |
| 946 | if (notify_die(DIE_TRAP, "iret exception", | 900 | if (notify_die(DIE_TRAP, "iret exception", |
| 947 | regs, error_code, 32, SIGILL) == NOTIFY_STOP) | 901 | regs, error_code, 32, SIGILL) == NOTIFY_STOP) |
| 948 | return; | 902 | return; |
| @@ -1026,6 +980,6 @@ void __init trap_init(void) | |||
| 1026 | cpu_init(); | 980 | cpu_init(); |
| 1027 | 981 | ||
| 1028 | #ifdef CONFIG_X86_32 | 982 | #ifdef CONFIG_X86_32 |
| 1029 | trap_init_hook(); | 983 | x86_quirk_trap_init(); |
| 1030 | #endif | 984 | #endif |
| 1031 | } | 985 | } |
