diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-03-30 02:47:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-03-30 02:50:06 -0400 |
commit | 186e54cbe1145f4d11e32fe10e7e20a11f1b27dd (patch) | |
tree | 9b6cf3667a3ea90e0cec0ea7119688ba76c55a71 /arch/x86/kernel | |
parent | 99dd5497e5be4fe4194cad181d45fd6569a930db (diff) | |
parent | 4bde23f8751f388867766b0a62ed1ef8b7e01561 (diff) |
Merge branch 'linus' into x86/urgent
Merge reason: Needed for include file dependencies.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
41 files changed, 450 insertions, 164 deletions
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index f50e7fb2a201..d2b7f27781bc 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <acpi/processor.h> | 14 | #include <acpi/processor.h> |
15 | #include <asm/acpi.h> | 15 | #include <asm/acpi.h> |
16 | #include <asm/mwait.h> | 16 | #include <asm/mwait.h> |
17 | #include <asm/special_insns.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Initialize bm_flags based on the CPU cache properties | 20 | * Initialize bm_flags based on the CPU cache properties |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 5d56931a15b3..459e78cbf61e 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -231,7 +231,6 @@ | |||
231 | #include <linux/syscore_ops.h> | 231 | #include <linux/syscore_ops.h> |
232 | #include <linux/i8253.h> | 232 | #include <linux/i8253.h> |
233 | 233 | ||
234 | #include <asm/system.h> | ||
235 | #include <asm/uaccess.h> | 234 | #include <asm/uaccess.h> |
236 | #include <asm/desc.h> | 235 | #include <asm/desc.h> |
237 | #include <asm/olpc.h> | 236 | #include <asm/olpc.h> |
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index 834e897b1e25..1b4754f82ba7 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -1,6 +1,12 @@ | |||
1 | #include <asm/ia32.h> | 1 | #include <asm/ia32.h> |
2 | 2 | ||
3 | #define __SYSCALL_64(nr, sym, compat) [nr] = 1, | 3 | #define __SYSCALL_64(nr, sym, compat) [nr] = 1, |
4 | #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1, | ||
5 | #ifdef CONFIG_X86_X32_ABI | ||
6 | # define __SYSCALL_X32(nr, sym, compat) [nr] = 1, | ||
7 | #else | ||
8 | # define __SYSCALL_X32(nr, sym, compat) /* nothing */ | ||
9 | #endif | ||
4 | static char syscalls_64[] = { | 10 | static char syscalls_64[] = { |
5 | #include <asm/syscalls_64.h> | 11 | #include <asm/syscalls_64.h> |
6 | }; | 12 | }; |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b24032355a76..67e258362a3d 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/archrandom.h> | 18 | #include <asm/archrandom.h> |
19 | #include <asm/hypervisor.h> | 19 | #include <asm/hypervisor.h> |
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/debugreg.h> | ||
21 | #include <asm/sections.h> | 22 | #include <asm/sections.h> |
22 | #include <linux/topology.h> | 23 | #include <linux/topology.h> |
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c index 5c0e6533d9bc..2d5454cd2c4f 100644 --- a/arch/x86/kernel/cpu/mcheck/p5.c +++ b/arch/x86/kernel/cpu/mcheck/p5.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/smp.h> | 9 | #include <linux/smp.h> |
10 | 10 | ||
11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
12 | #include <asm/system.h> | ||
13 | #include <asm/mce.h> | 12 | #include <asm/mce.h> |
14 | #include <asm/msr.h> | 13 | #include <asm/msr.h> |
15 | 14 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 67bb17a37a0a..47a1870279aa 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/cpu.h> | 25 | #include <linux/cpu.h> |
26 | 26 | ||
27 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
28 | #include <asm/system.h> | ||
29 | #include <asm/apic.h> | 28 | #include <asm/apic.h> |
30 | #include <asm/idle.h> | 29 | #include <asm/idle.h> |
31 | #include <asm/mce.h> | 30 | #include <asm/mce.h> |
diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c index 54060f565974..2d7998fb628c 100644 --- a/arch/x86/kernel/cpu/mcheck/winchip.c +++ b/arch/x86/kernel/cpu/mcheck/winchip.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | 9 | ||
10 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
11 | #include <asm/system.h> | ||
12 | #include <asm/mce.h> | 11 | #include <asm/mce.h> |
13 | #include <asm/msr.h> | 12 | #include <asm/msr.h> |
14 | 13 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 97b26356e9ee..75772ae6c65f 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <asm/processor-flags.h> | 12 | #include <asm/processor-flags.h> |
13 | #include <asm/cpufeature.h> | 13 | #include <asm/cpufeature.h> |
14 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
15 | #include <asm/system.h> | ||
16 | #include <asm/mtrr.h> | 15 | #include <asm/mtrr.h> |
17 | #include <asm/msr.h> | 16 | #include <asm/msr.h> |
18 | #include <asm/pat.h> | 17 | #include <asm/pat.h> |
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 79289632cb27..a041e094b8b9 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c | |||
@@ -167,6 +167,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) | |||
167 | { | 167 | { |
168 | int err = 0; | 168 | int err = 0; |
169 | mtrr_type type; | 169 | mtrr_type type; |
170 | unsigned long base; | ||
170 | unsigned long size; | 171 | unsigned long size; |
171 | struct mtrr_sentry sentry; | 172 | struct mtrr_sentry sentry; |
172 | struct mtrr_gentry gentry; | 173 | struct mtrr_gentry gentry; |
@@ -267,14 +268,14 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) | |||
267 | #endif | 268 | #endif |
268 | if (gentry.regnum >= num_var_ranges) | 269 | if (gentry.regnum >= num_var_ranges) |
269 | return -EINVAL; | 270 | return -EINVAL; |
270 | mtrr_if->get(gentry.regnum, &gentry.base, &size, &type); | 271 | mtrr_if->get(gentry.regnum, &base, &size, &type); |
271 | 272 | ||
272 | /* Hide entries that go above 4GB */ | 273 | /* Hide entries that go above 4GB */ |
273 | if (gentry.base + size - 1 >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT)) | 274 | if (base + size - 1 >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT)) |
274 | || size >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT))) | 275 | || size >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT))) |
275 | gentry.base = gentry.size = gentry.type = 0; | 276 | gentry.base = gentry.size = gentry.type = 0; |
276 | else { | 277 | else { |
277 | gentry.base <<= PAGE_SHIFT; | 278 | gentry.base = base << PAGE_SHIFT; |
278 | gentry.size = size << PAGE_SHIFT; | 279 | gentry.size = size << PAGE_SHIFT; |
279 | gentry.type = type; | 280 | gentry.type = type; |
280 | } | 281 | } |
@@ -321,11 +322,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) | |||
321 | #endif | 322 | #endif |
322 | if (gentry.regnum >= num_var_ranges) | 323 | if (gentry.regnum >= num_var_ranges) |
323 | return -EINVAL; | 324 | return -EINVAL; |
324 | mtrr_if->get(gentry.regnum, &gentry.base, &size, &type); | 325 | mtrr_if->get(gentry.regnum, &base, &size, &type); |
325 | /* Hide entries that would overflow */ | 326 | /* Hide entries that would overflow */ |
326 | if (size != (__typeof__(gentry.size))size) | 327 | if (size != (__typeof__(gentry.size))size) |
327 | gentry.base = gentry.size = gentry.type = 0; | 328 | gentry.base = gentry.size = gentry.type = 0; |
328 | else { | 329 | else { |
330 | gentry.base = base; | ||
329 | gentry.size = size; | 331 | gentry.size = size; |
330 | gentry.type = type; | 332 | gentry.type = type; |
331 | } | 333 | } |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 0a18d16cb58d..40883ffe2da9 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <asm/apic.h> | 29 | #include <asm/apic.h> |
30 | #include <asm/stacktrace.h> | 30 | #include <asm/stacktrace.h> |
31 | #include <asm/nmi.h> | 31 | #include <asm/nmi.h> |
32 | #include <asm/compat.h> | ||
33 | #include <asm/smp.h> | 32 | #include <asm/smp.h> |
34 | #include <asm/alternative.h> | 33 | #include <asm/alternative.h> |
35 | #include <asm/timer.h> | 34 | #include <asm/timer.h> |
@@ -643,14 +642,14 @@ static bool __perf_sched_find_counter(struct perf_sched *sched) | |||
643 | /* Prefer fixed purpose counters */ | 642 | /* Prefer fixed purpose counters */ |
644 | if (x86_pmu.num_counters_fixed) { | 643 | if (x86_pmu.num_counters_fixed) { |
645 | idx = X86_PMC_IDX_FIXED; | 644 | idx = X86_PMC_IDX_FIXED; |
646 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) { | 645 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_MAX) { |
647 | if (!__test_and_set_bit(idx, sched->state.used)) | 646 | if (!__test_and_set_bit(idx, sched->state.used)) |
648 | goto done; | 647 | goto done; |
649 | } | 648 | } |
650 | } | 649 | } |
651 | /* Grab the first unused counter starting with idx */ | 650 | /* Grab the first unused counter starting with idx */ |
652 | idx = sched->state.counter; | 651 | idx = sched->state.counter; |
653 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) { | 652 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_FIXED) { |
654 | if (!__test_and_set_bit(idx, sched->state.used)) | 653 | if (!__test_and_set_bit(idx, sched->state.used)) |
655 | goto done; | 654 | goto done; |
656 | } | 655 | } |
@@ -1748,6 +1747,9 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs) | |||
1748 | } | 1747 | } |
1749 | 1748 | ||
1750 | #ifdef CONFIG_COMPAT | 1749 | #ifdef CONFIG_COMPAT |
1750 | |||
1751 | #include <asm/compat.h> | ||
1752 | |||
1751 | static inline int | 1753 | static inline int |
1752 | perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) | 1754 | perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) |
1753 | { | 1755 | { |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index a524353d93f2..39472dd2323f 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <asm/processor.h> | 44 | #include <asm/processor.h> |
45 | #include <asm/msr.h> | 45 | #include <asm/msr.h> |
46 | #include <asm/system.h> | ||
47 | 46 | ||
48 | static struct class *cpuid_class; | 47 | static struct class *cpuid_class; |
49 | 48 | ||
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 90bf130f09bc..1b81839b6c88 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -268,7 +268,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) | |||
268 | #endif | 268 | #endif |
269 | printk("\n"); | 269 | printk("\n"); |
270 | if (notify_die(DIE_OOPS, str, regs, err, | 270 | if (notify_die(DIE_OOPS, str, regs, err, |
271 | current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) | 271 | current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP) |
272 | return 1; | 272 | return 1; |
273 | 273 | ||
274 | show_registers(regs); | 274 | show_registers(regs); |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 734ebd1d3caa..cdc79b5cfcd9 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -481,7 +481,12 @@ GLOBAL(system_call_after_swapgs) | |||
481 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) | 481 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
482 | jnz tracesys | 482 | jnz tracesys |
483 | system_call_fastpath: | 483 | system_call_fastpath: |
484 | #if __SYSCALL_MASK == ~0 | ||
484 | cmpq $__NR_syscall_max,%rax | 485 | cmpq $__NR_syscall_max,%rax |
486 | #else | ||
487 | andl $__SYSCALL_MASK,%eax | ||
488 | cmpl $__NR_syscall_max,%eax | ||
489 | #endif | ||
485 | ja badsys | 490 | ja badsys |
486 | movq %r10,%rcx | 491 | movq %r10,%rcx |
487 | call *sys_call_table(,%rax,8) # XXX: rip relative | 492 | call *sys_call_table(,%rax,8) # XXX: rip relative |
@@ -595,7 +600,12 @@ tracesys: | |||
595 | */ | 600 | */ |
596 | LOAD_ARGS ARGOFFSET, 1 | 601 | LOAD_ARGS ARGOFFSET, 1 |
597 | RESTORE_REST | 602 | RESTORE_REST |
603 | #if __SYSCALL_MASK == ~0 | ||
598 | cmpq $__NR_syscall_max,%rax | 604 | cmpq $__NR_syscall_max,%rax |
605 | #else | ||
606 | andl $__SYSCALL_MASK,%eax | ||
607 | cmpl $__NR_syscall_max,%eax | ||
608 | #endif | ||
599 | ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */ | 609 | ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */ |
600 | movq %r10,%rcx /* fixup for C */ | 610 | movq %r10,%rcx /* fixup for C */ |
601 | call *sys_call_table(,%rax,8) | 611 | call *sys_call_table(,%rax,8) |
@@ -735,6 +745,40 @@ ENTRY(stub_rt_sigreturn) | |||
735 | CFI_ENDPROC | 745 | CFI_ENDPROC |
736 | END(stub_rt_sigreturn) | 746 | END(stub_rt_sigreturn) |
737 | 747 | ||
748 | #ifdef CONFIG_X86_X32_ABI | ||
749 | PTREGSCALL stub_x32_sigaltstack, sys32_sigaltstack, %rdx | ||
750 | |||
751 | ENTRY(stub_x32_rt_sigreturn) | ||
752 | CFI_STARTPROC | ||
753 | addq $8, %rsp | ||
754 | PARTIAL_FRAME 0 | ||
755 | SAVE_REST | ||
756 | movq %rsp,%rdi | ||
757 | FIXUP_TOP_OF_STACK %r11 | ||
758 | call sys32_x32_rt_sigreturn | ||
759 | movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer | ||
760 | RESTORE_REST | ||
761 | jmp int_ret_from_sys_call | ||
762 | CFI_ENDPROC | ||
763 | END(stub_x32_rt_sigreturn) | ||
764 | |||
765 | ENTRY(stub_x32_execve) | ||
766 | CFI_STARTPROC | ||
767 | addq $8, %rsp | ||
768 | PARTIAL_FRAME 0 | ||
769 | SAVE_REST | ||
770 | FIXUP_TOP_OF_STACK %r11 | ||
771 | movq %rsp, %rcx | ||
772 | call sys32_execve | ||
773 | RESTORE_TOP_OF_STACK %r11 | ||
774 | movq %rax,RAX(%rsp) | ||
775 | RESTORE_REST | ||
776 | jmp int_ret_from_sys_call | ||
777 | CFI_ENDPROC | ||
778 | END(stub_x32_execve) | ||
779 | |||
780 | #endif | ||
781 | |||
738 | /* | 782 | /* |
739 | * Build the entry stubs and pointer table with some assembler magic. | 783 | * Build the entry stubs and pointer table with some assembler magic. |
740 | * We pack 7 stubs into a single 32-byte chunk, which will fit in a | 784 | * We pack 7 stubs into a single 32-byte chunk, which will fit in a |
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 610485223bdb..36d1853e91af 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | 16 | ||
17 | #include <linux/atomic.h> | 17 | #include <linux/atomic.h> |
18 | #include <asm/system.h> | ||
19 | #include <asm/timer.h> | 18 | #include <asm/timer.h> |
20 | #include <asm/hw_irq.h> | 19 | #include <asm/hw_irq.h> |
21 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 313fb5cddbce..252981afd6c4 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | 17 | ||
18 | #include <linux/atomic.h> | 18 | #include <linux/atomic.h> |
19 | #include <asm/system.h> | ||
20 | #include <asm/timer.h> | 19 | #include <asm/timer.h> |
21 | #include <asm/hw_irq.h> | 20 | #include <asm/hw_irq.h> |
22 | #include <asm/pgtable.h> | 21 | #include <asm/pgtable.h> |
@@ -61,7 +60,7 @@ static irqreturn_t math_error_irq(int cpl, void *dev_id) | |||
61 | outb(0, 0xF0); | 60 | outb(0, 0xF0); |
62 | if (ignore_fpu_irq || !boot_cpu_data.hard_math) | 61 | if (ignore_fpu_irq || !boot_cpu_data.hard_math) |
63 | return IRQ_NONE; | 62 | return IRQ_NONE; |
64 | math_error(get_irq_regs(), 0, 16); | 63 | math_error(get_irq_regs(), 0, X86_TRAP_MF); |
65 | return IRQ_HANDLED; | 64 | return IRQ_HANDLED; |
66 | } | 65 | } |
67 | 66 | ||
@@ -306,10 +305,10 @@ void __init native_init_IRQ(void) | |||
306 | * us. (some of these will be overridden and become | 305 | * us. (some of these will be overridden and become |
307 | * 'special' SMP interrupts) | 306 | * 'special' SMP interrupts) |
308 | */ | 307 | */ |
309 | for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { | 308 | i = FIRST_EXTERNAL_VECTOR; |
309 | for_each_clear_bit_from(i, used_vectors, NR_VECTORS) { | ||
310 | /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ | 310 | /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ |
311 | if (!test_bit(i, used_vectors)) | 311 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); |
312 | set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]); | ||
313 | } | 312 | } |
314 | 313 | ||
315 | if (!acpi_ioapic && !of_ioapic) | 314 | if (!acpi_ioapic && !of_ioapic) |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index faba5771acad..db6720edfdd0 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | #include <asm/debugreg.h> | 47 | #include <asm/debugreg.h> |
48 | #include <asm/apicdef.h> | 48 | #include <asm/apicdef.h> |
49 | #include <asm/system.h> | ||
50 | #include <asm/apic.h> | 49 | #include <asm/apic.h> |
51 | #include <asm/nmi.h> | 50 | #include <asm/nmi.h> |
52 | 51 | ||
@@ -67,8 +66,6 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = | |||
67 | { "ss", 4, offsetof(struct pt_regs, ss) }, | 66 | { "ss", 4, offsetof(struct pt_regs, ss) }, |
68 | { "ds", 4, offsetof(struct pt_regs, ds) }, | 67 | { "ds", 4, offsetof(struct pt_regs, ds) }, |
69 | { "es", 4, offsetof(struct pt_regs, es) }, | 68 | { "es", 4, offsetof(struct pt_regs, es) }, |
70 | { "fs", 4, -1 }, | ||
71 | { "gs", 4, -1 }, | ||
72 | #else | 69 | #else |
73 | { "ax", 8, offsetof(struct pt_regs, ax) }, | 70 | { "ax", 8, offsetof(struct pt_regs, ax) }, |
74 | { "bx", 8, offsetof(struct pt_regs, bx) }, | 71 | { "bx", 8, offsetof(struct pt_regs, bx) }, |
@@ -90,7 +87,11 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = | |||
90 | { "flags", 4, offsetof(struct pt_regs, flags) }, | 87 | { "flags", 4, offsetof(struct pt_regs, flags) }, |
91 | { "cs", 4, offsetof(struct pt_regs, cs) }, | 88 | { "cs", 4, offsetof(struct pt_regs, cs) }, |
92 | { "ss", 4, offsetof(struct pt_regs, ss) }, | 89 | { "ss", 4, offsetof(struct pt_regs, ss) }, |
90 | { "ds", 4, -1 }, | ||
91 | { "es", 4, -1 }, | ||
93 | #endif | 92 | #endif |
93 | { "fs", 4, -1 }, | ||
94 | { "gs", 4, -1 }, | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) | 97 | int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 44842d756b29..f8492da65bfc 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -136,6 +136,15 @@ int kvm_register_clock(char *txt) | |||
136 | return ret; | 136 | return ret; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void kvm_save_sched_clock_state(void) | ||
140 | { | ||
141 | } | ||
142 | |||
143 | static void kvm_restore_sched_clock_state(void) | ||
144 | { | ||
145 | kvm_register_clock("primary cpu clock, resume"); | ||
146 | } | ||
147 | |||
139 | #ifdef CONFIG_X86_LOCAL_APIC | 148 | #ifdef CONFIG_X86_LOCAL_APIC |
140 | static void __cpuinit kvm_setup_secondary_clock(void) | 149 | static void __cpuinit kvm_setup_secondary_clock(void) |
141 | { | 150 | { |
@@ -144,8 +153,6 @@ static void __cpuinit kvm_setup_secondary_clock(void) | |||
144 | * we shouldn't fail. | 153 | * we shouldn't fail. |
145 | */ | 154 | */ |
146 | WARN_ON(kvm_register_clock("secondary cpu clock")); | 155 | WARN_ON(kvm_register_clock("secondary cpu clock")); |
147 | /* ok, done with our trickery, call native */ | ||
148 | setup_secondary_APIC_clock(); | ||
149 | } | 156 | } |
150 | #endif | 157 | #endif |
151 | 158 | ||
@@ -194,9 +201,11 @@ void __init kvmclock_init(void) | |||
194 | x86_platform.get_wallclock = kvm_get_wallclock; | 201 | x86_platform.get_wallclock = kvm_get_wallclock; |
195 | x86_platform.set_wallclock = kvm_set_wallclock; | 202 | x86_platform.set_wallclock = kvm_set_wallclock; |
196 | #ifdef CONFIG_X86_LOCAL_APIC | 203 | #ifdef CONFIG_X86_LOCAL_APIC |
197 | x86_cpuinit.setup_percpu_clockev = | 204 | x86_cpuinit.early_percpu_clock_init = |
198 | kvm_setup_secondary_clock; | 205 | kvm_setup_secondary_clock; |
199 | #endif | 206 | #endif |
207 | x86_platform.save_sched_clock_state = kvm_save_sched_clock_state; | ||
208 | x86_platform.restore_sched_clock_state = kvm_restore_sched_clock_state; | ||
200 | machine_ops.shutdown = kvm_shutdown; | 209 | machine_ops.shutdown = kvm_shutdown; |
201 | #ifdef CONFIG_KEXEC | 210 | #ifdef CONFIG_KEXEC |
202 | machine_ops.crash_shutdown = kvm_crash_shutdown; | 211 | machine_ops.crash_shutdown = kvm_crash_shutdown; |
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index ea697263b373..ebc987398923 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | 17 | ||
18 | #include <asm/system.h> | ||
19 | #include <asm/ldt.h> | 18 | #include <asm/ldt.h> |
20 | #include <asm/desc.h> | 19 | #include <asm/desc.h> |
21 | #include <asm/mmu_context.h> | 20 | #include <asm/mmu_context.h> |
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index a3fa43ba5d3b..5b19e4d78b00 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <asm/apic.h> | 23 | #include <asm/apic.h> |
24 | #include <asm/cpufeature.h> | 24 | #include <asm/cpufeature.h> |
25 | #include <asm/desc.h> | 25 | #include <asm/desc.h> |
26 | #include <asm/system.h> | ||
27 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
28 | #include <asm/debugreg.h> | 27 | #include <asm/debugreg.h> |
29 | 28 | ||
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c index 177183cbb6ae..7eb1e2b97827 100644 --- a/arch/x86/kernel/mca_32.c +++ b/arch/x86/kernel/mca_32.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/mca.h> | 43 | #include <linux/mca.h> |
44 | #include <linux/kprobes.h> | 44 | #include <linux/kprobes.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <asm/system.h> | ||
47 | #include <asm/io.h> | 46 | #include <asm/io.h> |
48 | #include <linux/proc_fs.h> | 47 | #include <linux/proc_fs.h> |
49 | #include <linux/mman.h> | 48 | #include <linux/mman.h> |
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 925179f871de..f21fd94ac897 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/gfp.h> | 26 | #include <linux/gfp.h> |
27 | #include <linux/jump_label.h> | 27 | #include <linux/jump_label.h> |
28 | 28 | ||
29 | #include <asm/system.h> | ||
30 | #include <asm/page.h> | 29 | #include <asm/page.h> |
31 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
32 | 31 | ||
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 96356762a51d..eb113693f043 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
42 | #include <asm/msr.h> | 42 | #include <asm/msr.h> |
43 | #include <asm/system.h> | ||
44 | 43 | ||
45 | static struct class *msr_class; | 44 | static struct class *msr_class; |
46 | 45 | ||
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index ada2f99388dd..ab137605e694 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <asm/bug.h> | 27 | #include <asm/bug.h> |
28 | #include <asm/paravirt.h> | 28 | #include <asm/paravirt.h> |
29 | #include <asm/debugreg.h> | ||
29 | #include <asm/desc.h> | 30 | #include <asm/desc.h> |
30 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
31 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
@@ -37,6 +38,7 @@ | |||
37 | #include <asm/apic.h> | 38 | #include <asm/apic.h> |
38 | #include <asm/tlbflush.h> | 39 | #include <asm/tlbflush.h> |
39 | #include <asm/timer.h> | 40 | #include <asm/timer.h> |
41 | #include <asm/special_insns.h> | ||
40 | 42 | ||
41 | /* nop stub */ | 43 | /* nop stub */ |
42 | void _paravirt_nop(void) | 44 | void _paravirt_nop(void) |
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 726494b58345..6ac5782f4d6b 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <asm/calgary.h> | 42 | #include <asm/calgary.h> |
43 | #include <asm/tce.h> | 43 | #include <asm/tce.h> |
44 | #include <asm/pci-direct.h> | 44 | #include <asm/pci-direct.h> |
45 | #include <asm/system.h> | ||
46 | #include <asm/dma.h> | 45 | #include <asm/dma.h> |
47 | #include <asm/rio.h> | 46 | #include <asm/rio.h> |
48 | #include <asm/bios_ebda.h> | 47 | #include <asm/bios_ebda.h> |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 1c4d769e21ea..28e5e06fcba4 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -262,10 +262,11 @@ rootfs_initcall(pci_iommu_init); | |||
262 | 262 | ||
263 | static __devinit void via_no_dac(struct pci_dev *dev) | 263 | static __devinit void via_no_dac(struct pci_dev *dev) |
264 | { | 264 | { |
265 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) { | 265 | if (forbid_dac == 0) { |
266 | dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n"); | 266 | dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n"); |
267 | forbid_dac = 1; | 267 | forbid_dac = 1; |
268 | } | 268 | } |
269 | } | 269 | } |
270 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac); | 270 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, |
271 | PCI_CLASS_BRIDGE_PCI, 8, via_no_dac); | ||
271 | #endif | 272 | #endif |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 29309c42b9e5..a33afaa5ddb7 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <trace/events/power.h> | 18 | #include <trace/events/power.h> |
19 | #include <linux/hw_breakpoint.h> | 19 | #include <linux/hw_breakpoint.h> |
20 | #include <asm/cpu.h> | 20 | #include <asm/cpu.h> |
21 | #include <asm/system.h> | ||
22 | #include <asm/apic.h> | 21 | #include <asm/apic.h> |
23 | #include <asm/syscalls.h> | 22 | #include <asm/syscalls.h> |
24 | #include <asm/idle.h> | 23 | #include <asm/idle.h> |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index ea207c245aa4..ae6847303e26 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/kdebug.h> | 38 | #include <linux/kdebug.h> |
39 | 39 | ||
40 | #include <asm/pgtable.h> | 40 | #include <asm/pgtable.h> |
41 | #include <asm/system.h> | ||
42 | #include <asm/ldt.h> | 41 | #include <asm/ldt.h> |
43 | #include <asm/processor.h> | 42 | #include <asm/processor.h> |
44 | #include <asm/i387.h> | 43 | #include <asm/i387.h> |
@@ -55,6 +54,7 @@ | |||
55 | #include <asm/idle.h> | 54 | #include <asm/idle.h> |
56 | #include <asm/syscalls.h> | 55 | #include <asm/syscalls.h> |
57 | #include <asm/debugreg.h> | 56 | #include <asm/debugreg.h> |
57 | #include <asm/switch_to.h> | ||
58 | 58 | ||
59 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); | 59 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); |
60 | 60 | ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index ce5e34f2beca..733ca39f367e 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/ftrace.h> | 37 | #include <linux/ftrace.h> |
38 | 38 | ||
39 | #include <asm/pgtable.h> | 39 | #include <asm/pgtable.h> |
40 | #include <asm/system.h> | ||
41 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
42 | #include <asm/i387.h> | 41 | #include <asm/i387.h> |
43 | #include <asm/fpu-internal.h> | 42 | #include <asm/fpu-internal.h> |
@@ -49,6 +48,7 @@ | |||
49 | #include <asm/idle.h> | 48 | #include <asm/idle.h> |
50 | #include <asm/syscalls.h> | 49 | #include <asm/syscalls.h> |
51 | #include <asm/debugreg.h> | 50 | #include <asm/debugreg.h> |
51 | #include <asm/switch_to.h> | ||
52 | 52 | ||
53 | asmlinkage extern void ret_from_fork(void); | 53 | asmlinkage extern void ret_from_fork(void); |
54 | 54 | ||
@@ -258,7 +258,9 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) | |||
258 | void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp) | 258 | void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp) |
259 | { | 259 | { |
260 | start_thread_common(regs, new_ip, new_sp, | 260 | start_thread_common(regs, new_ip, new_sp, |
261 | __USER32_CS, __USER32_DS, __USER32_DS); | 261 | test_thread_flag(TIF_X32) |
262 | ? __USER_CS : __USER32_CS, | ||
263 | __USER_DS, __USER_DS); | ||
262 | } | 264 | } |
263 | #endif | 265 | #endif |
264 | 266 | ||
@@ -381,6 +383,8 @@ void set_personality_64bit(void) | |||
381 | 383 | ||
382 | /* Make sure to be in 64bit mode */ | 384 | /* Make sure to be in 64bit mode */ |
383 | clear_thread_flag(TIF_IA32); | 385 | clear_thread_flag(TIF_IA32); |
386 | clear_thread_flag(TIF_ADDR32); | ||
387 | clear_thread_flag(TIF_X32); | ||
384 | 388 | ||
385 | /* Ensure the corresponding mm is not marked. */ | 389 | /* Ensure the corresponding mm is not marked. */ |
386 | if (current->mm) | 390 | if (current->mm) |
@@ -393,20 +397,31 @@ void set_personality_64bit(void) | |||
393 | current->personality &= ~READ_IMPLIES_EXEC; | 397 | current->personality &= ~READ_IMPLIES_EXEC; |
394 | } | 398 | } |
395 | 399 | ||
396 | void set_personality_ia32(void) | 400 | void set_personality_ia32(bool x32) |
397 | { | 401 | { |
398 | /* inherit personality from parent */ | 402 | /* inherit personality from parent */ |
399 | 403 | ||
400 | /* Make sure to be in 32bit mode */ | 404 | /* Make sure to be in 32bit mode */ |
401 | set_thread_flag(TIF_IA32); | 405 | set_thread_flag(TIF_ADDR32); |
402 | current->personality |= force_personality32; | ||
403 | 406 | ||
404 | /* Mark the associated mm as containing 32-bit tasks. */ | 407 | /* Mark the associated mm as containing 32-bit tasks. */ |
405 | if (current->mm) | 408 | if (current->mm) |
406 | current->mm->context.ia32_compat = 1; | 409 | current->mm->context.ia32_compat = 1; |
407 | 410 | ||
408 | /* Prepare the first "return" to user space */ | 411 | if (x32) { |
409 | current_thread_info()->status |= TS_COMPAT; | 412 | clear_thread_flag(TIF_IA32); |
413 | set_thread_flag(TIF_X32); | ||
414 | current->personality &= ~READ_IMPLIES_EXEC; | ||
415 | /* is_compat_task() uses the presence of the x32 | ||
416 | syscall bit flag to determine compat status */ | ||
417 | current_thread_info()->status &= ~TS_COMPAT; | ||
418 | } else { | ||
419 | set_thread_flag(TIF_IA32); | ||
420 | clear_thread_flag(TIF_X32); | ||
421 | current->personality |= force_personality32; | ||
422 | /* Prepare the first "return" to user space */ | ||
423 | current_thread_info()->status |= TS_COMPAT; | ||
424 | } | ||
410 | } | 425 | } |
411 | 426 | ||
412 | unsigned long get_wchan(struct task_struct *p) | 427 | unsigned long get_wchan(struct task_struct *p) |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 78f05e438be5..685845cf16e0 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
27 | #include <asm/system.h> | ||
28 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
29 | #include <asm/i387.h> | 28 | #include <asm/i387.h> |
30 | #include <asm/fpu-internal.h> | 29 | #include <asm/fpu-internal.h> |
@@ -34,6 +33,7 @@ | |||
34 | #include <asm/prctl.h> | 33 | #include <asm/prctl.h> |
35 | #include <asm/proto.h> | 34 | #include <asm/proto.h> |
36 | #include <asm/hw_breakpoint.h> | 35 | #include <asm/hw_breakpoint.h> |
36 | #include <asm/traps.h> | ||
37 | 37 | ||
38 | #include "tls.h" | 38 | #include "tls.h" |
39 | 39 | ||
@@ -1131,6 +1131,100 @@ static int genregs32_set(struct task_struct *target, | |||
1131 | return ret; | 1131 | return ret; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | #ifdef CONFIG_X86_X32_ABI | ||
1135 | static long x32_arch_ptrace(struct task_struct *child, | ||
1136 | compat_long_t request, compat_ulong_t caddr, | ||
1137 | compat_ulong_t cdata) | ||
1138 | { | ||
1139 | unsigned long addr = caddr; | ||
1140 | unsigned long data = cdata; | ||
1141 | void __user *datap = compat_ptr(data); | ||
1142 | int ret; | ||
1143 | |||
1144 | switch (request) { | ||
1145 | /* Read 32bits at location addr in the USER area. Only allow | ||
1146 | to return the lower 32bits of segment and debug registers. */ | ||
1147 | case PTRACE_PEEKUSR: { | ||
1148 | u32 tmp; | ||
1149 | |||
1150 | ret = -EIO; | ||
1151 | if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user) || | ||
1152 | addr < offsetof(struct user_regs_struct, cs)) | ||
1153 | break; | ||
1154 | |||
1155 | tmp = 0; /* Default return condition */ | ||
1156 | if (addr < sizeof(struct user_regs_struct)) | ||
1157 | tmp = getreg(child, addr); | ||
1158 | else if (addr >= offsetof(struct user, u_debugreg[0]) && | ||
1159 | addr <= offsetof(struct user, u_debugreg[7])) { | ||
1160 | addr -= offsetof(struct user, u_debugreg[0]); | ||
1161 | tmp = ptrace_get_debugreg(child, addr / sizeof(data)); | ||
1162 | } | ||
1163 | ret = put_user(tmp, (__u32 __user *)datap); | ||
1164 | break; | ||
1165 | } | ||
1166 | |||
1167 | /* Write the word at location addr in the USER area. Only allow | ||
1168 | to update segment and debug registers with the upper 32bits | ||
1169 | zero-extended. */ | ||
1170 | case PTRACE_POKEUSR: | ||
1171 | ret = -EIO; | ||
1172 | if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user) || | ||
1173 | addr < offsetof(struct user_regs_struct, cs)) | ||
1174 | break; | ||
1175 | |||
1176 | if (addr < sizeof(struct user_regs_struct)) | ||
1177 | ret = putreg(child, addr, data); | ||
1178 | else if (addr >= offsetof(struct user, u_debugreg[0]) && | ||
1179 | addr <= offsetof(struct user, u_debugreg[7])) { | ||
1180 | addr -= offsetof(struct user, u_debugreg[0]); | ||
1181 | ret = ptrace_set_debugreg(child, | ||
1182 | addr / sizeof(data), data); | ||
1183 | } | ||
1184 | break; | ||
1185 | |||
1186 | case PTRACE_GETREGS: /* Get all gp regs from the child. */ | ||
1187 | return copy_regset_to_user(child, | ||
1188 | task_user_regset_view(current), | ||
1189 | REGSET_GENERAL, | ||
1190 | 0, sizeof(struct user_regs_struct), | ||
1191 | datap); | ||
1192 | |||
1193 | case PTRACE_SETREGS: /* Set all gp regs in the child. */ | ||
1194 | return copy_regset_from_user(child, | ||
1195 | task_user_regset_view(current), | ||
1196 | REGSET_GENERAL, | ||
1197 | 0, sizeof(struct user_regs_struct), | ||
1198 | datap); | ||
1199 | |||
1200 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ | ||
1201 | return copy_regset_to_user(child, | ||
1202 | task_user_regset_view(current), | ||
1203 | REGSET_FP, | ||
1204 | 0, sizeof(struct user_i387_struct), | ||
1205 | datap); | ||
1206 | |||
1207 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ | ||
1208 | return copy_regset_from_user(child, | ||
1209 | task_user_regset_view(current), | ||
1210 | REGSET_FP, | ||
1211 | 0, sizeof(struct user_i387_struct), | ||
1212 | datap); | ||
1213 | |||
1214 | /* normal 64bit interface to access TLS data. | ||
1215 | Works just like arch_prctl, except that the arguments | ||
1216 | are reversed. */ | ||
1217 | case PTRACE_ARCH_PRCTL: | ||
1218 | return do_arch_prctl(child, data, addr); | ||
1219 | |||
1220 | default: | ||
1221 | return compat_ptrace_request(child, request, addr, data); | ||
1222 | } | ||
1223 | |||
1224 | return ret; | ||
1225 | } | ||
1226 | #endif | ||
1227 | |||
1134 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | 1228 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
1135 | compat_ulong_t caddr, compat_ulong_t cdata) | 1229 | compat_ulong_t caddr, compat_ulong_t cdata) |
1136 | { | 1230 | { |
@@ -1140,6 +1234,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
1140 | int ret; | 1234 | int ret; |
1141 | __u32 val; | 1235 | __u32 val; |
1142 | 1236 | ||
1237 | #ifdef CONFIG_X86_X32_ABI | ||
1238 | if (!is_ia32_task()) | ||
1239 | return x32_arch_ptrace(child, request, caddr, cdata); | ||
1240 | #endif | ||
1241 | |||
1143 | switch (request) { | 1242 | switch (request) { |
1144 | case PTRACE_PEEKUSR: | 1243 | case PTRACE_PEEKUSR: |
1145 | ret = getreg32(child, addr, &val); | 1244 | ret = getreg32(child, addr, &val); |
@@ -1327,7 +1426,7 @@ static void fill_sigtrap_info(struct task_struct *tsk, | |||
1327 | int error_code, int si_code, | 1426 | int error_code, int si_code, |
1328 | struct siginfo *info) | 1427 | struct siginfo *info) |
1329 | { | 1428 | { |
1330 | tsk->thread.trap_no = 1; | 1429 | tsk->thread.trap_nr = X86_TRAP_DB; |
1331 | tsk->thread.error_code = error_code; | 1430 | tsk->thread.error_code = error_code; |
1332 | 1431 | ||
1333 | memset(info, 0, sizeof(*info)); | 1432 | memset(info, 0, sizeof(*info)); |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 88638883176a..1a2901562059 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -90,7 +90,6 @@ | |||
90 | #include <asm/processor.h> | 90 | #include <asm/processor.h> |
91 | #include <asm/bugs.h> | 91 | #include <asm/bugs.h> |
92 | 92 | ||
93 | #include <asm/system.h> | ||
94 | #include <asm/vsyscall.h> | 93 | #include <asm/vsyscall.h> |
95 | #include <asm/cpu.h> | 94 | #include <asm/cpu.h> |
96 | #include <asm/desc.h> | 95 | #include <asm/desc.h> |
@@ -509,15 +508,6 @@ static void __init memblock_x86_reserve_range_setup_data(void) | |||
509 | 508 | ||
510 | #ifdef CONFIG_KEXEC | 509 | #ifdef CONFIG_KEXEC |
511 | 510 | ||
512 | static inline unsigned long long get_total_mem(void) | ||
513 | { | ||
514 | unsigned long long total; | ||
515 | |||
516 | total = max_pfn - min_low_pfn; | ||
517 | |||
518 | return total << PAGE_SHIFT; | ||
519 | } | ||
520 | |||
521 | /* | 511 | /* |
522 | * Keep the crash kernel below this limit. On 32 bits earlier kernels | 512 | * Keep the crash kernel below this limit. On 32 bits earlier kernels |
523 | * would limit the kernel to the low 512 MiB due to mapping restrictions. | 513 | * would limit the kernel to the low 512 MiB due to mapping restrictions. |
@@ -536,7 +526,7 @@ static void __init reserve_crashkernel(void) | |||
536 | unsigned long long crash_size, crash_base; | 526 | unsigned long long crash_size, crash_base; |
537 | int ret; | 527 | int ret; |
538 | 528 | ||
539 | total_mem = get_total_mem(); | 529 | total_mem = memblock_phys_mem_size(); |
540 | 530 | ||
541 | ret = parse_crashkernel(boot_command_line, total_mem, | 531 | ret = parse_crashkernel(boot_command_line, total_mem, |
542 | &crash_size, &crash_base); | 532 | &crash_size, &crash_base); |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 25edcfc9ba5b..115eac431483 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -10,10 +10,8 @@ | |||
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/signal.h> | ||
14 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
15 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
16 | #include <linux/ptrace.h> | ||
17 | #include <linux/tracehook.h> | 15 | #include <linux/tracehook.h> |
18 | #include <linux/unistd.h> | 16 | #include <linux/unistd.h> |
19 | #include <linux/stddef.h> | 17 | #include <linux/stddef.h> |
@@ -27,10 +25,12 @@ | |||
27 | #include <asm/fpu-internal.h> | 25 | #include <asm/fpu-internal.h> |
28 | #include <asm/vdso.h> | 26 | #include <asm/vdso.h> |
29 | #include <asm/mce.h> | 27 | #include <asm/mce.h> |
28 | #include <asm/sighandling.h> | ||
30 | 29 | ||
31 | #ifdef CONFIG_X86_64 | 30 | #ifdef CONFIG_X86_64 |
32 | #include <asm/proto.h> | 31 | #include <asm/proto.h> |
33 | #include <asm/ia32_unistd.h> | 32 | #include <asm/ia32_unistd.h> |
33 | #include <asm/sys_ia32.h> | ||
34 | #endif /* CONFIG_X86_64 */ | 34 | #endif /* CONFIG_X86_64 */ |
35 | 35 | ||
36 | #include <asm/syscall.h> | 36 | #include <asm/syscall.h> |
@@ -38,13 +38,6 @@ | |||
38 | 38 | ||
39 | #include <asm/sigframe.h> | 39 | #include <asm/sigframe.h> |
40 | 40 | ||
41 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
42 | |||
43 | #define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ | ||
44 | X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \ | ||
45 | X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \ | ||
46 | X86_EFLAGS_CF) | ||
47 | |||
48 | #ifdef CONFIG_X86_32 | 41 | #ifdef CONFIG_X86_32 |
49 | # define FIX_EFLAGS (__FIX_EFLAGS | X86_EFLAGS_RF) | 42 | # define FIX_EFLAGS (__FIX_EFLAGS | X86_EFLAGS_RF) |
50 | #else | 43 | #else |
@@ -69,9 +62,8 @@ | |||
69 | regs->seg = GET_SEG(seg) | 3; \ | 62 | regs->seg = GET_SEG(seg) | 3; \ |
70 | } while (0) | 63 | } while (0) |
71 | 64 | ||
72 | static int | 65 | int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, |
73 | restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | 66 | unsigned long *pax) |
74 | unsigned long *pax) | ||
75 | { | 67 | { |
76 | void __user *buf; | 68 | void __user *buf; |
77 | unsigned int tmpflags; | 69 | unsigned int tmpflags; |
@@ -126,9 +118,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
126 | return err; | 118 | return err; |
127 | } | 119 | } |
128 | 120 | ||
129 | static int | 121 | int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, |
130 | setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | 122 | struct pt_regs *regs, unsigned long mask) |
131 | struct pt_regs *regs, unsigned long mask) | ||
132 | { | 123 | { |
133 | int err = 0; | 124 | int err = 0; |
134 | 125 | ||
@@ -160,7 +151,7 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | |||
160 | put_user_ex(regs->r15, &sc->r15); | 151 | put_user_ex(regs->r15, &sc->r15); |
161 | #endif /* CONFIG_X86_64 */ | 152 | #endif /* CONFIG_X86_64 */ |
162 | 153 | ||
163 | put_user_ex(current->thread.trap_no, &sc->trapno); | 154 | put_user_ex(current->thread.trap_nr, &sc->trapno); |
164 | put_user_ex(current->thread.error_code, &sc->err); | 155 | put_user_ex(current->thread.error_code, &sc->err); |
165 | put_user_ex(regs->ip, &sc->ip); | 156 | put_user_ex(regs->ip, &sc->ip); |
166 | #ifdef CONFIG_X86_32 | 157 | #ifdef CONFIG_X86_32 |
@@ -643,6 +634,16 @@ static int signr_convert(int sig) | |||
643 | #define is_ia32 0 | 634 | #define is_ia32 0 |
644 | #endif /* CONFIG_IA32_EMULATION */ | 635 | #endif /* CONFIG_IA32_EMULATION */ |
645 | 636 | ||
637 | #ifdef CONFIG_X86_X32_ABI | ||
638 | #define is_x32 test_thread_flag(TIF_X32) | ||
639 | |||
640 | static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, | ||
641 | siginfo_t *info, compat_sigset_t *set, | ||
642 | struct pt_regs *regs); | ||
643 | #else /* !CONFIG_X86_X32_ABI */ | ||
644 | #define is_x32 0 | ||
645 | #endif /* CONFIG_X86_X32_ABI */ | ||
646 | |||
646 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 647 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
647 | sigset_t *set, struct pt_regs *regs); | 648 | sigset_t *set, struct pt_regs *regs); |
648 | int ia32_setup_frame(int sig, struct k_sigaction *ka, | 649 | int ia32_setup_frame(int sig, struct k_sigaction *ka, |
@@ -667,8 +668,14 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
667 | ret = ia32_setup_rt_frame(usig, ka, info, set, regs); | 668 | ret = ia32_setup_rt_frame(usig, ka, info, set, regs); |
668 | else | 669 | else |
669 | ret = ia32_setup_frame(usig, ka, set, regs); | 670 | ret = ia32_setup_frame(usig, ka, set, regs); |
670 | } else | 671 | #ifdef CONFIG_X86_X32_ABI |
672 | } else if (is_x32) { | ||
673 | ret = x32_setup_rt_frame(usig, ka, info, | ||
674 | (compat_sigset_t *)set, regs); | ||
675 | #endif | ||
676 | } else { | ||
671 | ret = __setup_rt_frame(sig, ka, info, set, regs); | 677 | ret = __setup_rt_frame(sig, ka, info, set, regs); |
678 | } | ||
672 | 679 | ||
673 | if (ret) { | 680 | if (ret) { |
674 | force_sigsegv(sig, current); | 681 | force_sigsegv(sig, current); |
@@ -851,3 +858,102 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where) | |||
851 | 858 | ||
852 | force_sig(SIGSEGV, me); | 859 | force_sig(SIGSEGV, me); |
853 | } | 860 | } |
861 | |||
862 | #ifdef CONFIG_X86_X32_ABI | ||
863 | static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, | ||
864 | siginfo_t *info, compat_sigset_t *set, | ||
865 | struct pt_regs *regs) | ||
866 | { | ||
867 | struct rt_sigframe_x32 __user *frame; | ||
868 | void __user *restorer; | ||
869 | int err = 0; | ||
870 | void __user *fpstate = NULL; | ||
871 | |||
872 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | ||
873 | |||
874 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | ||
875 | return -EFAULT; | ||
876 | |||
877 | if (ka->sa.sa_flags & SA_SIGINFO) { | ||
878 | if (copy_siginfo_to_user32(&frame->info, info)) | ||
879 | return -EFAULT; | ||
880 | } | ||
881 | |||
882 | put_user_try { | ||
883 | /* Create the ucontext. */ | ||
884 | if (cpu_has_xsave) | ||
885 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
886 | else | ||
887 | put_user_ex(0, &frame->uc.uc_flags); | ||
888 | put_user_ex(0, &frame->uc.uc_link); | ||
889 | put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | ||
890 | put_user_ex(sas_ss_flags(regs->sp), | ||
891 | &frame->uc.uc_stack.ss_flags); | ||
892 | put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
893 | put_user_ex(0, &frame->uc.uc__pad0); | ||
894 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | ||
895 | regs, set->sig[0]); | ||
896 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
897 | |||
898 | if (ka->sa.sa_flags & SA_RESTORER) { | ||
899 | restorer = ka->sa.sa_restorer; | ||
900 | } else { | ||
901 | /* could use a vstub here */ | ||
902 | restorer = NULL; | ||
903 | err |= -EFAULT; | ||
904 | } | ||
905 | put_user_ex(restorer, &frame->pretcode); | ||
906 | } put_user_catch(err); | ||
907 | |||
908 | if (err) | ||
909 | return -EFAULT; | ||
910 | |||
911 | /* Set up registers for signal handler */ | ||
912 | regs->sp = (unsigned long) frame; | ||
913 | regs->ip = (unsigned long) ka->sa.sa_handler; | ||
914 | |||
915 | /* We use the x32 calling convention here... */ | ||
916 | regs->di = sig; | ||
917 | regs->si = (unsigned long) &frame->info; | ||
918 | regs->dx = (unsigned long) &frame->uc; | ||
919 | |||
920 | loadsegment(ds, __USER_DS); | ||
921 | loadsegment(es, __USER_DS); | ||
922 | |||
923 | regs->cs = __USER_CS; | ||
924 | regs->ss = __USER_DS; | ||
925 | |||
926 | return 0; | ||
927 | } | ||
928 | |||
929 | asmlinkage long sys32_x32_rt_sigreturn(struct pt_regs *regs) | ||
930 | { | ||
931 | struct rt_sigframe_x32 __user *frame; | ||
932 | sigset_t set; | ||
933 | unsigned long ax; | ||
934 | struct pt_regs tregs; | ||
935 | |||
936 | frame = (struct rt_sigframe_x32 __user *)(regs->sp - 8); | ||
937 | |||
938 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | ||
939 | goto badframe; | ||
940 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | ||
941 | goto badframe; | ||
942 | |||
943 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
944 | set_current_blocked(&set); | ||
945 | |||
946 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) | ||
947 | goto badframe; | ||
948 | |||
949 | tregs = *regs; | ||
950 | if (sys32_sigaltstack(&frame->uc.uc_stack, NULL, &tregs) == -EFAULT) | ||
951 | goto badframe; | ||
952 | |||
953 | return ax; | ||
954 | |||
955 | badframe: | ||
956 | signal_fault(regs, frame, "x32 rt_sigreturn"); | ||
957 | return 0; | ||
958 | } | ||
959 | #endif | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index e578a79a3093..ce13315d48fb 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -219,14 +219,9 @@ static void __cpuinit smp_callin(void) | |||
219 | * Update loops_per_jiffy in cpu_data. Previous call to | 219 | * Update loops_per_jiffy in cpu_data. Previous call to |
220 | * smp_store_cpu_info() stored a value that is close but not as | 220 | * smp_store_cpu_info() stored a value that is close but not as |
221 | * accurate as the value just calculated. | 221 | * accurate as the value just calculated. |
222 | * | ||
223 | * Need to enable IRQs because it can take longer and then | ||
224 | * the NMI watchdog might kill us. | ||
225 | */ | 222 | */ |
226 | local_irq_enable(); | ||
227 | calibrate_delay(); | 223 | calibrate_delay(); |
228 | cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy; | 224 | cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy; |
229 | local_irq_disable(); | ||
230 | pr_debug("Stack at about %p\n", &cpuid); | 225 | pr_debug("Stack at about %p\n", &cpuid); |
231 | 226 | ||
232 | /* | 227 | /* |
@@ -255,6 +250,7 @@ notrace static void __cpuinit start_secondary(void *unused) | |||
255 | * most necessary things. | 250 | * most necessary things. |
256 | */ | 251 | */ |
257 | cpu_init(); | 252 | cpu_init(); |
253 | x86_cpuinit.early_percpu_clock_init(); | ||
258 | preempt_disable(); | 254 | preempt_disable(); |
259 | smp_callin(); | 255 | smp_callin(); |
260 | 256 | ||
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index ef59642ff1bf..b4d3c3927dd8 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -98,7 +98,7 @@ out: | |||
98 | static void find_start_end(unsigned long flags, unsigned long *begin, | 98 | static void find_start_end(unsigned long flags, unsigned long *begin, |
99 | unsigned long *end) | 99 | unsigned long *end) |
100 | { | 100 | { |
101 | if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) { | 101 | if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT)) { |
102 | unsigned long new_begin; | 102 | unsigned long new_begin; |
103 | /* This is usually used needed to map code in small | 103 | /* This is usually used needed to map code in small |
104 | model, so it needs to be in the first 31bit. Limit | 104 | model, so it needs to be in the first 31bit. Limit |
@@ -144,7 +144,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
144 | (!vma || addr + len <= vma->vm_start)) | 144 | (!vma || addr + len <= vma->vm_start)) |
145 | return addr; | 145 | return addr; |
146 | } | 146 | } |
147 | if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32)) | 147 | if (((flags & MAP_32BIT) || test_thread_flag(TIF_ADDR32)) |
148 | && len <= mm->cached_hole_size) { | 148 | && len <= mm->cached_hole_size) { |
149 | mm->cached_hole_size = 0; | 149 | mm->cached_hole_size = 0; |
150 | mm->free_area_cache = begin; | 150 | mm->free_area_cache = begin; |
@@ -205,7 +205,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
205 | return addr; | 205 | return addr; |
206 | 206 | ||
207 | /* for MAP_32BIT mappings we force the legact mmap base */ | 207 | /* for MAP_32BIT mappings we force the legact mmap base */ |
208 | if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) | 208 | if (!test_thread_flag(TIF_ADDR32) && (flags & MAP_32BIT)) |
209 | goto bottomup; | 209 | goto bottomup; |
210 | 210 | ||
211 | /* requesting a specific address */ | 211 | /* requesting a specific address */ |
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c index 7ac7943be02c..5c7f8c20da74 100644 --- a/arch/x86/kernel/syscall_64.c +++ b/arch/x86/kernel/syscall_64.c | |||
@@ -5,6 +5,14 @@ | |||
5 | #include <linux/cache.h> | 5 | #include <linux/cache.h> |
6 | #include <asm/asm-offsets.h> | 6 | #include <asm/asm-offsets.h> |
7 | 7 | ||
8 | #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat) | ||
9 | |||
10 | #ifdef CONFIG_X86_X32_ABI | ||
11 | # define __SYSCALL_X32(nr, sym, compat) __SYSCALL_64(nr, sym, compat) | ||
12 | #else | ||
13 | # define __SYSCALL_X32(nr, sym, compat) /* nothing */ | ||
14 | #endif | ||
15 | |||
8 | #define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ; | 16 | #define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ; |
9 | #include <asm/syscalls_64.h> | 17 | #include <asm/syscalls_64.h> |
10 | #undef __SYSCALL_64 | 18 | #undef __SYSCALL_64 |
diff --git a/arch/x86/kernel/tce_64.c b/arch/x86/kernel/tce_64.c index 9e540fee7009..ab40954e113e 100644 --- a/arch/x86/kernel/tce_64.c +++ b/arch/x86/kernel/tce_64.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/tce.h> | 34 | #include <asm/tce.h> |
35 | #include <asm/calgary.h> | 35 | #include <asm/calgary.h> |
36 | #include <asm/proto.h> | 36 | #include <asm/proto.h> |
37 | #include <asm/cacheflush.h> | ||
37 | 38 | ||
38 | /* flush a tce at 'tceaddr' to main memory */ | 39 | /* flush a tce at 'tceaddr' to main memory */ |
39 | static inline void flush_tce(void* tceaddr) | 40 | static inline void flush_tce(void* tceaddr) |
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c index bcfec2d23769..9d9d2f9e77a5 100644 --- a/arch/x86/kernel/tls.c +++ b/arch/x86/kernel/tls.c | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
8 | #include <asm/desc.h> | 8 | #include <asm/desc.h> |
9 | #include <asm/system.h> | ||
10 | #include <asm/ldt.h> | 9 | #include <asm/ldt.h> |
11 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
12 | #include <asm/proto.h> | 11 | #include <asm/proto.h> |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index ec61d4c1b93b..ff9281f16029 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <asm/processor.h> | 50 | #include <asm/processor.h> |
51 | #include <asm/debugreg.h> | 51 | #include <asm/debugreg.h> |
52 | #include <linux/atomic.h> | 52 | #include <linux/atomic.h> |
53 | #include <asm/system.h> | ||
54 | #include <asm/traps.h> | 53 | #include <asm/traps.h> |
55 | #include <asm/desc.h> | 54 | #include <asm/desc.h> |
56 | #include <asm/i387.h> | 55 | #include <asm/i387.h> |
@@ -120,7 +119,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, | |||
120 | * traps 0, 1, 3, 4, and 5 should be forwarded to vm86. | 119 | * traps 0, 1, 3, 4, and 5 should be forwarded to vm86. |
121 | * On nmi (interrupt 2), do_trap should not be called. | 120 | * On nmi (interrupt 2), do_trap should not be called. |
122 | */ | 121 | */ |
123 | if (trapnr < 6) | 122 | if (trapnr < X86_TRAP_UD) |
124 | goto vm86_trap; | 123 | goto vm86_trap; |
125 | goto trap_signal; | 124 | goto trap_signal; |
126 | } | 125 | } |
@@ -133,7 +132,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs, | |||
133 | trap_signal: | 132 | trap_signal: |
134 | #endif | 133 | #endif |
135 | /* | 134 | /* |
136 | * We want error_code and trap_no set for userspace faults and | 135 | * We want error_code and trap_nr set for userspace faults and |
137 | * kernelspace faults which result in die(), but not | 136 | * kernelspace faults which result in die(), but not |
138 | * kernelspace faults which are fixed up. die() gives the | 137 | * kernelspace faults which are fixed up. die() gives the |
139 | * process no chance to handle the signal and notice the | 138 | * process no chance to handle the signal and notice the |
@@ -142,7 +141,7 @@ trap_signal: | |||
142 | * delivered, faults. See also do_general_protection below. | 141 | * delivered, faults. See also do_general_protection below. |
143 | */ | 142 | */ |
144 | tsk->thread.error_code = error_code; | 143 | tsk->thread.error_code = error_code; |
145 | tsk->thread.trap_no = trapnr; | 144 | tsk->thread.trap_nr = trapnr; |
146 | 145 | ||
147 | #ifdef CONFIG_X86_64 | 146 | #ifdef CONFIG_X86_64 |
148 | if (show_unhandled_signals && unhandled_signal(tsk, signr) && | 147 | if (show_unhandled_signals && unhandled_signal(tsk, signr) && |
@@ -165,7 +164,7 @@ trap_signal: | |||
165 | kernel_trap: | 164 | kernel_trap: |
166 | if (!fixup_exception(regs)) { | 165 | if (!fixup_exception(regs)) { |
167 | tsk->thread.error_code = error_code; | 166 | tsk->thread.error_code = error_code; |
168 | tsk->thread.trap_no = trapnr; | 167 | tsk->thread.trap_nr = trapnr; |
169 | die(str, regs, error_code); | 168 | die(str, regs, error_code); |
170 | } | 169 | } |
171 | return; | 170 | return; |
@@ -204,27 +203,31 @@ dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ | |||
204 | do_trap(trapnr, signr, str, regs, error_code, &info); \ | 203 | do_trap(trapnr, signr, str, regs, error_code, &info); \ |
205 | } | 204 | } |
206 | 205 | ||
207 | DO_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip) | 206 | DO_ERROR_INFO(X86_TRAP_DE, SIGFPE, "divide error", divide_error, FPE_INTDIV, |
208 | DO_ERROR(4, SIGSEGV, "overflow", overflow) | 207 | regs->ip) |
209 | DO_ERROR(5, SIGSEGV, "bounds", bounds) | 208 | DO_ERROR(X86_TRAP_OF, SIGSEGV, "overflow", overflow) |
210 | DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip) | 209 | DO_ERROR(X86_TRAP_BR, SIGSEGV, "bounds", bounds) |
211 | DO_ERROR(9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) | 210 | DO_ERROR_INFO(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, |
212 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | 211 | regs->ip) |
213 | DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | 212 | DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun", |
213 | coprocessor_segment_overrun) | ||
214 | DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) | ||
215 | DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) | ||
214 | #ifdef CONFIG_X86_32 | 216 | #ifdef CONFIG_X86_32 |
215 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) | 217 | DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) |
216 | #endif | 218 | #endif |
217 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) | 219 | DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check, |
220 | BUS_ADRALN, 0) | ||
218 | 221 | ||
219 | #ifdef CONFIG_X86_64 | 222 | #ifdef CONFIG_X86_64 |
220 | /* Runs on IST stack */ | 223 | /* Runs on IST stack */ |
221 | dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) | 224 | dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) |
222 | { | 225 | { |
223 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, | 226 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, |
224 | 12, SIGBUS) == NOTIFY_STOP) | 227 | X86_TRAP_SS, SIGBUS) == NOTIFY_STOP) |
225 | return; | 228 | return; |
226 | preempt_conditional_sti(regs); | 229 | preempt_conditional_sti(regs); |
227 | do_trap(12, SIGBUS, "stack segment", regs, error_code, NULL); | 230 | do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); |
228 | preempt_conditional_cli(regs); | 231 | preempt_conditional_cli(regs); |
229 | } | 232 | } |
230 | 233 | ||
@@ -234,10 +237,10 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) | |||
234 | struct task_struct *tsk = current; | 237 | struct task_struct *tsk = current; |
235 | 238 | ||
236 | /* Return not checked because double check cannot be ignored */ | 239 | /* Return not checked because double check cannot be ignored */ |
237 | notify_die(DIE_TRAP, str, regs, error_code, 8, SIGSEGV); | 240 | notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); |
238 | 241 | ||
239 | tsk->thread.error_code = error_code; | 242 | tsk->thread.error_code = error_code; |
240 | tsk->thread.trap_no = 8; | 243 | tsk->thread.trap_nr = X86_TRAP_DF; |
241 | 244 | ||
242 | /* | 245 | /* |
243 | * This is always a kernel trap and never fixable (and thus must | 246 | * This is always a kernel trap and never fixable (and thus must |
@@ -265,7 +268,7 @@ do_general_protection(struct pt_regs *regs, long error_code) | |||
265 | goto gp_in_kernel; | 268 | goto gp_in_kernel; |
266 | 269 | ||
267 | tsk->thread.error_code = error_code; | 270 | tsk->thread.error_code = error_code; |
268 | tsk->thread.trap_no = 13; | 271 | tsk->thread.trap_nr = X86_TRAP_GP; |
269 | 272 | ||
270 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 273 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && |
271 | printk_ratelimit()) { | 274 | printk_ratelimit()) { |
@@ -292,9 +295,9 @@ gp_in_kernel: | |||
292 | return; | 295 | return; |
293 | 296 | ||
294 | tsk->thread.error_code = error_code; | 297 | tsk->thread.error_code = error_code; |
295 | tsk->thread.trap_no = 13; | 298 | tsk->thread.trap_nr = X86_TRAP_GP; |
296 | if (notify_die(DIE_GPF, "general protection fault", regs, | 299 | if (notify_die(DIE_GPF, "general protection fault", regs, error_code, |
297 | error_code, 13, SIGSEGV) == NOTIFY_STOP) | 300 | X86_TRAP_GP, SIGSEGV) == NOTIFY_STOP) |
298 | return; | 301 | return; |
299 | die("general protection fault", regs, error_code); | 302 | die("general protection fault", regs, error_code); |
300 | } | 303 | } |
@@ -303,13 +306,13 @@ gp_in_kernel: | |||
303 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) | 306 | dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) |
304 | { | 307 | { |
305 | #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP | 308 | #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP |
306 | if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | 309 | if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, |
307 | == NOTIFY_STOP) | 310 | SIGTRAP) == NOTIFY_STOP) |
308 | return; | 311 | return; |
309 | #endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ | 312 | #endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ |
310 | 313 | ||
311 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) | 314 | if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, |
312 | == NOTIFY_STOP) | 315 | SIGTRAP) == NOTIFY_STOP) |
313 | return; | 316 | return; |
314 | 317 | ||
315 | /* | 318 | /* |
@@ -318,7 +321,7 @@ dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) | |||
318 | */ | 321 | */ |
319 | debug_stack_usage_inc(); | 322 | debug_stack_usage_inc(); |
320 | preempt_conditional_sti(regs); | 323 | preempt_conditional_sti(regs); |
321 | do_trap(3, SIGTRAP, "int3", regs, error_code, NULL); | 324 | do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL); |
322 | preempt_conditional_cli(regs); | 325 | preempt_conditional_cli(regs); |
323 | debug_stack_usage_dec(); | 326 | debug_stack_usage_dec(); |
324 | } | 327 | } |
@@ -423,8 +426,8 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) | |||
423 | preempt_conditional_sti(regs); | 426 | preempt_conditional_sti(regs); |
424 | 427 | ||
425 | if (regs->flags & X86_VM_MASK) { | 428 | if (regs->flags & X86_VM_MASK) { |
426 | handle_vm86_trap((struct kernel_vm86_regs *) regs, | 429 | handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, |
427 | error_code, 1); | 430 | X86_TRAP_DB); |
428 | preempt_conditional_cli(regs); | 431 | preempt_conditional_cli(regs); |
429 | debug_stack_usage_dec(); | 432 | debug_stack_usage_dec(); |
430 | return; | 433 | return; |
@@ -461,7 +464,8 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr) | |||
461 | struct task_struct *task = current; | 464 | struct task_struct *task = current; |
462 | siginfo_t info; | 465 | siginfo_t info; |
463 | unsigned short err; | 466 | unsigned short err; |
464 | char *str = (trapnr == 16) ? "fpu exception" : "simd exception"; | 467 | char *str = (trapnr == X86_TRAP_MF) ? "fpu exception" : |
468 | "simd exception"; | ||
465 | 469 | ||
466 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, SIGFPE) == NOTIFY_STOP) | 470 | if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, SIGFPE) == NOTIFY_STOP) |
467 | return; | 471 | return; |
@@ -471,7 +475,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr) | |||
471 | { | 475 | { |
472 | if (!fixup_exception(regs)) { | 476 | if (!fixup_exception(regs)) { |
473 | task->thread.error_code = error_code; | 477 | task->thread.error_code = error_code; |
474 | task->thread.trap_no = trapnr; | 478 | task->thread.trap_nr = trapnr; |
475 | die(str, regs, error_code); | 479 | die(str, regs, error_code); |
476 | } | 480 | } |
477 | return; | 481 | return; |
@@ -481,12 +485,12 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr) | |||
481 | * Save the info for the exception handler and clear the error. | 485 | * Save the info for the exception handler and clear the error. |
482 | */ | 486 | */ |
483 | save_init_fpu(task); | 487 | save_init_fpu(task); |
484 | task->thread.trap_no = trapnr; | 488 | task->thread.trap_nr = trapnr; |
485 | task->thread.error_code = error_code; | 489 | task->thread.error_code = error_code; |
486 | info.si_signo = SIGFPE; | 490 | info.si_signo = SIGFPE; |
487 | info.si_errno = 0; | 491 | info.si_errno = 0; |
488 | info.si_addr = (void __user *)regs->ip; | 492 | info.si_addr = (void __user *)regs->ip; |
489 | if (trapnr == 16) { | 493 | if (trapnr == X86_TRAP_MF) { |
490 | unsigned short cwd, swd; | 494 | unsigned short cwd, swd; |
491 | /* | 495 | /* |
492 | * (~cwd & swd) will mask out exceptions that are not set to unmasked | 496 | * (~cwd & swd) will mask out exceptions that are not set to unmasked |
@@ -530,10 +534,11 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr) | |||
530 | info.si_code = FPE_FLTRES; | 534 | info.si_code = FPE_FLTRES; |
531 | } else { | 535 | } else { |
532 | /* | 536 | /* |
533 | * If we're using IRQ 13, or supposedly even some trap 16 | 537 | * If we're using IRQ 13, or supposedly even some trap |
534 | * implementations, it's possible we get a spurious trap... | 538 | * X86_TRAP_MF implementations, it's possible |
539 | * we get a spurious trap, which is not an error. | ||
535 | */ | 540 | */ |
536 | return; /* Spurious trap, no error */ | 541 | return; |
537 | } | 542 | } |
538 | force_sig_info(SIGFPE, &info, task); | 543 | force_sig_info(SIGFPE, &info, task); |
539 | } | 544 | } |
@@ -544,13 +549,13 @@ dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) | |||
544 | ignore_fpu_irq = 1; | 549 | ignore_fpu_irq = 1; |
545 | #endif | 550 | #endif |
546 | 551 | ||
547 | math_error(regs, error_code, 16); | 552 | math_error(regs, error_code, X86_TRAP_MF); |
548 | } | 553 | } |
549 | 554 | ||
550 | dotraplinkage void | 555 | dotraplinkage void |
551 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) | 556 | do_simd_coprocessor_error(struct pt_regs *regs, long error_code) |
552 | { | 557 | { |
553 | math_error(regs, error_code, 19); | 558 | math_error(regs, error_code, X86_TRAP_XF); |
554 | } | 559 | } |
555 | 560 | ||
556 | dotraplinkage void | 561 | dotraplinkage void |
@@ -644,20 +649,21 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) | |||
644 | info.si_errno = 0; | 649 | info.si_errno = 0; |
645 | info.si_code = ILL_BADSTK; | 650 | info.si_code = ILL_BADSTK; |
646 | info.si_addr = NULL; | 651 | info.si_addr = NULL; |
647 | if (notify_die(DIE_TRAP, "iret exception", | 652 | if (notify_die(DIE_TRAP, "iret exception", regs, error_code, |
648 | regs, error_code, 32, SIGILL) == NOTIFY_STOP) | 653 | X86_TRAP_IRET, SIGILL) == NOTIFY_STOP) |
649 | return; | 654 | return; |
650 | do_trap(32, SIGILL, "iret exception", regs, error_code, &info); | 655 | do_trap(X86_TRAP_IRET, SIGILL, "iret exception", regs, error_code, |
656 | &info); | ||
651 | } | 657 | } |
652 | #endif | 658 | #endif |
653 | 659 | ||
654 | /* Set of traps needed for early debugging. */ | 660 | /* Set of traps needed for early debugging. */ |
655 | void __init early_trap_init(void) | 661 | void __init early_trap_init(void) |
656 | { | 662 | { |
657 | set_intr_gate_ist(1, &debug, DEBUG_STACK); | 663 | set_intr_gate_ist(X86_TRAP_DB, &debug, DEBUG_STACK); |
658 | /* int3 can be called from all */ | 664 | /* int3 can be called from all */ |
659 | set_system_intr_gate_ist(3, &int3, DEBUG_STACK); | 665 | set_system_intr_gate_ist(X86_TRAP_BP, &int3, DEBUG_STACK); |
660 | set_intr_gate(14, &page_fault); | 666 | set_intr_gate(X86_TRAP_PF, &page_fault); |
661 | load_idt(&idt_descr); | 667 | load_idt(&idt_descr); |
662 | } | 668 | } |
663 | 669 | ||
@@ -673,30 +679,30 @@ void __init trap_init(void) | |||
673 | early_iounmap(p, 4); | 679 | early_iounmap(p, 4); |
674 | #endif | 680 | #endif |
675 | 681 | ||
676 | set_intr_gate(0, ÷_error); | 682 | set_intr_gate(X86_TRAP_DE, ÷_error); |
677 | set_intr_gate_ist(2, &nmi, NMI_STACK); | 683 | set_intr_gate_ist(X86_TRAP_NMI, &nmi, NMI_STACK); |
678 | /* int4 can be called from all */ | 684 | /* int4 can be called from all */ |
679 | set_system_intr_gate(4, &overflow); | 685 | set_system_intr_gate(X86_TRAP_OF, &overflow); |
680 | set_intr_gate(5, &bounds); | 686 | set_intr_gate(X86_TRAP_BR, &bounds); |
681 | set_intr_gate(6, &invalid_op); | 687 | set_intr_gate(X86_TRAP_UD, &invalid_op); |
682 | set_intr_gate(7, &device_not_available); | 688 | set_intr_gate(X86_TRAP_NM, &device_not_available); |
683 | #ifdef CONFIG_X86_32 | 689 | #ifdef CONFIG_X86_32 |
684 | set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS); | 690 | set_task_gate(X86_TRAP_DF, GDT_ENTRY_DOUBLEFAULT_TSS); |
685 | #else | 691 | #else |
686 | set_intr_gate_ist(8, &double_fault, DOUBLEFAULT_STACK); | 692 | set_intr_gate_ist(X86_TRAP_DF, &double_fault, DOUBLEFAULT_STACK); |
687 | #endif | 693 | #endif |
688 | set_intr_gate(9, &coprocessor_segment_overrun); | 694 | set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun); |
689 | set_intr_gate(10, &invalid_TSS); | 695 | set_intr_gate(X86_TRAP_TS, &invalid_TSS); |
690 | set_intr_gate(11, &segment_not_present); | 696 | set_intr_gate(X86_TRAP_NP, &segment_not_present); |
691 | set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK); | 697 | set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); |
692 | set_intr_gate(13, &general_protection); | 698 | set_intr_gate(X86_TRAP_GP, &general_protection); |
693 | set_intr_gate(15, &spurious_interrupt_bug); | 699 | set_intr_gate(X86_TRAP_SPURIOUS, &spurious_interrupt_bug); |
694 | set_intr_gate(16, &coprocessor_error); | 700 | set_intr_gate(X86_TRAP_MF, &coprocessor_error); |
695 | set_intr_gate(17, &alignment_check); | 701 | set_intr_gate(X86_TRAP_AC, &alignment_check); |
696 | #ifdef CONFIG_X86_MCE | 702 | #ifdef CONFIG_X86_MCE |
697 | set_intr_gate_ist(18, &machine_check, MCE_STACK); | 703 | set_intr_gate_ist(X86_TRAP_MC, &machine_check, MCE_STACK); |
698 | #endif | 704 | #endif |
699 | set_intr_gate(19, &simd_coprocessor_error); | 705 | set_intr_gate(X86_TRAP_XF, &simd_coprocessor_error); |
700 | 706 | ||
701 | /* Reserve all the builtin and the syscall vector: */ | 707 | /* Reserve all the builtin and the syscall vector: */ |
702 | for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) | 708 | for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) |
@@ -721,7 +727,7 @@ void __init trap_init(void) | |||
721 | 727 | ||
722 | #ifdef CONFIG_X86_64 | 728 | #ifdef CONFIG_X86_64 |
723 | memcpy(&nmi_idt_table, &idt_table, IDT_ENTRIES * 16); | 729 | memcpy(&nmi_idt_table, &idt_table, IDT_ENTRIES * 16); |
724 | set_nmi_gate(1, &debug); | 730 | set_nmi_gate(X86_TRAP_DB, &debug); |
725 | set_nmi_gate(3, &int3); | 731 | set_nmi_gate(X86_TRAP_BP, &int3); |
726 | #endif | 732 | #endif |
727 | } | 733 | } |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 183c5925a9fe..fc0a147e3727 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -630,7 +630,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | |||
630 | 630 | ||
631 | static unsigned long long cyc2ns_suspend; | 631 | static unsigned long long cyc2ns_suspend; |
632 | 632 | ||
633 | void save_sched_clock_state(void) | 633 | void tsc_save_sched_clock_state(void) |
634 | { | 634 | { |
635 | if (!sched_clock_stable) | 635 | if (!sched_clock_stable) |
636 | return; | 636 | return; |
@@ -646,7 +646,7 @@ void save_sched_clock_state(void) | |||
646 | * that sched_clock() continues from the point where it was left off during | 646 | * that sched_clock() continues from the point where it was left off during |
647 | * suspend. | 647 | * suspend. |
648 | */ | 648 | */ |
649 | void restore_sched_clock_state(void) | 649 | void tsc_restore_sched_clock_state(void) |
650 | { | 650 | { |
651 | unsigned long long offset; | 651 | unsigned long long offset; |
652 | unsigned long flags; | 652 | unsigned long flags; |
@@ -933,6 +933,16 @@ static int __init init_tsc_clocksource(void) | |||
933 | clocksource_tsc.rating = 0; | 933 | clocksource_tsc.rating = 0; |
934 | clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; | 934 | clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; |
935 | } | 935 | } |
936 | |||
937 | /* | ||
938 | * Trust the results of the earlier calibration on systems | ||
939 | * exporting a reliable TSC. | ||
940 | */ | ||
941 | if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) { | ||
942 | clocksource_register_khz(&clocksource_tsc, tsc_khz); | ||
943 | return 0; | ||
944 | } | ||
945 | |||
936 | schedule_delayed_work(&tsc_irqwork, 0); | 946 | schedule_delayed_work(&tsc_irqwork, 0); |
937 | return 0; | 947 | return 0; |
938 | } | 948 | } |
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 328cb37bb827..255f58ae71e8 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -569,7 +569,7 @@ int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno) | |||
569 | } | 569 | } |
570 | if (trapno != 1) | 570 | if (trapno != 1) |
571 | return 1; /* we let this handle by the calling routine */ | 571 | return 1; /* we let this handle by the calling routine */ |
572 | current->thread.trap_no = trapno; | 572 | current->thread.trap_nr = trapno; |
573 | current->thread.error_code = error_code; | 573 | current->thread.error_code = error_code; |
574 | force_sig(SIGTRAP, current); | 574 | force_sig(SIGTRAP, current); |
575 | return 0; | 575 | return 0; |
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index b07ba9393564..f386dc49f988 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c | |||
@@ -52,10 +52,7 @@ | |||
52 | #include "vsyscall_trace.h" | 52 | #include "vsyscall_trace.h" |
53 | 53 | ||
54 | DEFINE_VVAR(int, vgetcpu_mode); | 54 | DEFINE_VVAR(int, vgetcpu_mode); |
55 | DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) = | 55 | DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data); |
56 | { | ||
57 | .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock), | ||
58 | }; | ||
59 | 56 | ||
60 | static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE; | 57 | static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE; |
61 | 58 | ||
@@ -80,20 +77,15 @@ early_param("vsyscall", vsyscall_setup); | |||
80 | 77 | ||
81 | void update_vsyscall_tz(void) | 78 | void update_vsyscall_tz(void) |
82 | { | 79 | { |
83 | unsigned long flags; | ||
84 | |||
85 | write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); | ||
86 | /* sys_tz has changed */ | ||
87 | vsyscall_gtod_data.sys_tz = sys_tz; | 80 | vsyscall_gtod_data.sys_tz = sys_tz; |
88 | write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); | ||
89 | } | 81 | } |
90 | 82 | ||
91 | void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, | 83 | void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, |
92 | struct clocksource *clock, u32 mult) | 84 | struct clocksource *clock, u32 mult) |
93 | { | 85 | { |
94 | unsigned long flags; | 86 | struct timespec monotonic; |
95 | 87 | ||
96 | write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); | 88 | write_seqcount_begin(&vsyscall_gtod_data.seq); |
97 | 89 | ||
98 | /* copy vsyscall data */ | 90 | /* copy vsyscall data */ |
99 | vsyscall_gtod_data.clock.vclock_mode = clock->archdata.vclock_mode; | 91 | vsyscall_gtod_data.clock.vclock_mode = clock->archdata.vclock_mode; |
@@ -101,12 +93,19 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, | |||
101 | vsyscall_gtod_data.clock.mask = clock->mask; | 93 | vsyscall_gtod_data.clock.mask = clock->mask; |
102 | vsyscall_gtod_data.clock.mult = mult; | 94 | vsyscall_gtod_data.clock.mult = mult; |
103 | vsyscall_gtod_data.clock.shift = clock->shift; | 95 | vsyscall_gtod_data.clock.shift = clock->shift; |
96 | |||
104 | vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; | 97 | vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; |
105 | vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; | 98 | vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; |
106 | vsyscall_gtod_data.wall_to_monotonic = *wtm; | 99 | |
100 | monotonic = timespec_add(*wall_time, *wtm); | ||
101 | vsyscall_gtod_data.monotonic_time_sec = monotonic.tv_sec; | ||
102 | vsyscall_gtod_data.monotonic_time_nsec = monotonic.tv_nsec; | ||
103 | |||
107 | vsyscall_gtod_data.wall_time_coarse = __current_kernel_time(); | 104 | vsyscall_gtod_data.wall_time_coarse = __current_kernel_time(); |
105 | vsyscall_gtod_data.monotonic_time_coarse = | ||
106 | timespec_add(vsyscall_gtod_data.wall_time_coarse, *wtm); | ||
108 | 107 | ||
109 | write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); | 108 | write_seqcount_end(&vsyscall_gtod_data.seq); |
110 | } | 109 | } |
111 | 110 | ||
112 | static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, | 111 | static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, |
@@ -153,7 +152,7 @@ static bool write_ok_or_segv(unsigned long ptr, size_t size) | |||
153 | 152 | ||
154 | thread->error_code = 6; /* user fault, no page, write */ | 153 | thread->error_code = 6; /* user fault, no page, write */ |
155 | thread->cr2 = ptr; | 154 | thread->cr2 = ptr; |
156 | thread->trap_no = 14; | 155 | thread->trap_nr = X86_TRAP_PF; |
157 | 156 | ||
158 | memset(&info, 0, sizeof(info)); | 157 | memset(&info, 0, sizeof(info)); |
159 | info.si_signo = SIGSEGV; | 158 | info.si_signo = SIGSEGV; |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 947a06ccc673..e9f265fd79ae 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -91,6 +91,7 @@ struct x86_init_ops x86_init __initdata = { | |||
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { | 93 | struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { |
94 | .early_percpu_clock_init = x86_init_noop, | ||
94 | .setup_percpu_clockev = setup_secondary_APIC_clock, | 95 | .setup_percpu_clockev = setup_secondary_APIC_clock, |
95 | .fixup_cpu_id = x86_default_fixup_cpu_id, | 96 | .fixup_cpu_id = x86_default_fixup_cpu_id, |
96 | }; | 97 | }; |
@@ -107,7 +108,9 @@ struct x86_platform_ops x86_platform = { | |||
107 | .is_untracked_pat_range = is_ISA_range, | 108 | .is_untracked_pat_range = is_ISA_range, |
108 | .nmi_init = default_nmi_init, | 109 | .nmi_init = default_nmi_init, |
109 | .get_nmi_reason = default_get_nmi_reason, | 110 | .get_nmi_reason = default_get_nmi_reason, |
110 | .i8042_detect = default_i8042_detect | 111 | .i8042_detect = default_i8042_detect, |
112 | .save_sched_clock_state = tsc_save_sched_clock_state, | ||
113 | .restore_sched_clock_state = tsc_restore_sched_clock_state, | ||
111 | }; | 114 | }; |
112 | 115 | ||
113 | EXPORT_SYMBOL_GPL(x86_platform); | 116 | EXPORT_SYMBOL_GPL(x86_platform); |