aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/Kconfig13
-rw-r--r--arch/i386/Makefile1
-rw-r--r--arch/i386/kernel/apm.c2
-rw-r--r--arch/i386/kernel/head.S8
-rw-r--r--arch/i386/kernel/io_apic.c1
-rw-r--r--arch/i386/kernel/nmi.c8
-rw-r--r--arch/i386/kernel/process.c73
-rw-r--r--arch/i386/kernel/ptrace.c17
-rw-r--r--arch/i386/kernel/traps.c3
-rw-r--r--arch/i386/video/Makefile1
-rw-r--r--arch/i386/video/fbdev.c32
11 files changed, 102 insertions, 57 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index b1b2b30b1b8e..c7c9c2a15fab 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1212,21 +1212,26 @@ source "drivers/Kconfig"
1212 1212
1213source "fs/Kconfig" 1213source "fs/Kconfig"
1214 1214
1215menu "Instrumentation Support" 1215menuconfig INSTRUMENTATION
1216 bool "Instrumentation Support"
1216 depends on EXPERIMENTAL 1217 depends on EXPERIMENTAL
1218 default y
1219
1220if INSTRUMENTATION
1217 1221
1218source "arch/i386/oprofile/Kconfig" 1222source "arch/i386/oprofile/Kconfig"
1219 1223
1220config KPROBES 1224config KPROBES
1221 bool "Kprobes (EXPERIMENTAL)" 1225 bool "Kprobes"
1222 depends on KALLSYMS && EXPERIMENTAL && MODULES 1226 depends on KALLSYMS && MODULES
1223 help 1227 help
1224 Kprobes allows you to trap at almost any kernel address and 1228 Kprobes allows you to trap at almost any kernel address and
1225 execute a callback function. register_kprobe() establishes 1229 execute a callback function. register_kprobe() establishes
1226 a probepoint and specifies the callback. Kprobes is useful 1230 a probepoint and specifies the callback. Kprobes is useful
1227 for kernel debugging, non-intrusive instrumentation and testing. 1231 for kernel debugging, non-intrusive instrumentation and testing.
1228 If in doubt, say "N". 1232 If in doubt, say "N".
1229endmenu 1233
1234endif # INSTRUMENTATION
1230 1235
1231source "arch/i386/Kconfig.debug" 1236source "arch/i386/Kconfig.debug"
1232 1237
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index bd28f9f9b4b7..181cc29a7c4f 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -108,6 +108,7 @@ drivers-$(CONFIG_PCI) += arch/i386/pci/
108# must be linked after kernel/ 108# must be linked after kernel/
109drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/ 109drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/
110drivers-$(CONFIG_PM) += arch/i386/power/ 110drivers-$(CONFIG_PM) += arch/i386/power/
111drivers-$(CONFIG_FB) += arch/i386/video/
111 112
112CFLAGS += $(mflags-y) 113CFLAGS += $(mflags-y)
113AFLAGS += $(mflags-y) 114AFLAGS += $(mflags-y)
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 4112afe712b9..47001d50a083 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -222,6 +222,7 @@
222#include <linux/capability.h> 222#include <linux/capability.h>
223#include <linux/device.h> 223#include <linux/device.h>
224#include <linux/kernel.h> 224#include <linux/kernel.h>
225#include <linux/freezer.h>
225#include <linux/smp.h> 226#include <linux/smp.h>
226#include <linux/dmi.h> 227#include <linux/dmi.h>
227#include <linux/suspend.h> 228#include <linux/suspend.h>
@@ -2311,7 +2312,6 @@ static int __init apm_init(void)
2311 remove_proc_entry("apm", NULL); 2312 remove_proc_entry("apm", NULL);
2312 return err; 2313 return err;
2313 } 2314 }
2314 kapmd_task->flags |= PF_NOFREEZE;
2315 wake_up_process(kapmd_task); 2315 wake_up_process(kapmd_task);
2316 2316
2317 if (num_online_cpus() > 1 && !smp ) { 2317 if (num_online_cpus() > 1 && !smp ) {
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index f74dfc419b56..82714668d43b 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -168,6 +168,12 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
168.section .init.text,"ax",@progbits 168.section .init.text,"ax",@progbits
169#endif 169#endif
170 170
171 /* Do an early initialization of the fixmap area */
172 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
173 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
174 addl $0x007, %eax /* 0x007 = PRESENT+RW+USER */
175 movl %eax, 4092(%edx)
176
171#ifdef CONFIG_SMP 177#ifdef CONFIG_SMP
172ENTRY(startup_32_smp) 178ENTRY(startup_32_smp)
173 cld 179 cld
@@ -507,6 +513,8 @@ ENTRY(_stext)
507.section ".bss.page_aligned","w" 513.section ".bss.page_aligned","w"
508ENTRY(swapper_pg_dir) 514ENTRY(swapper_pg_dir)
509 .fill 1024,4,0 515 .fill 1024,4,0
516ENTRY(swapper_pg_pmd)
517 .fill 1024,4,0
510ENTRY(empty_zero_page) 518ENTRY(empty_zero_page)
511 .fill 4096,1,0 519 .fill 4096,1,0
512 520
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 7f8b7af2b95f..21db8f56c9a1 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -667,6 +667,7 @@ static int balanced_irq(void *unused)
667 set_pending_irq(i, cpumask_of_cpu(0)); 667 set_pending_irq(i, cpumask_of_cpu(0));
668 } 668 }
669 669
670 set_freezable();
670 for ( ; ; ) { 671 for ( ; ; ) {
671 time_remaining = schedule_timeout_interruptible(time_remaining); 672 time_remaining = schedule_timeout_interruptible(time_remaining);
672 try_to_freeze(); 673 try_to_freeze();
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index fba121f7973f..03b7f5584d71 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -295,7 +295,7 @@ static unsigned int
295 last_irq_sums [NR_CPUS], 295 last_irq_sums [NR_CPUS],
296 alert_counter [NR_CPUS]; 296 alert_counter [NR_CPUS];
297 297
298void touch_nmi_watchdog (void) 298void touch_nmi_watchdog(void)
299{ 299{
300 if (nmi_watchdog > 0) { 300 if (nmi_watchdog > 0) {
301 unsigned cpu; 301 unsigned cpu;
@@ -304,8 +304,10 @@ void touch_nmi_watchdog (void)
304 * Just reset the alert counters, (other CPUs might be 304 * Just reset the alert counters, (other CPUs might be
305 * spinning on locks we hold): 305 * spinning on locks we hold):
306 */ 306 */
307 for_each_present_cpu (cpu) 307 for_each_present_cpu(cpu) {
308 alert_counter[cpu] = 0; 308 if (alert_counter[cpu])
309 alert_counter[cpu] = 0;
310 }
309 } 311 }
310 312
311 /* 313 /*
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 06dfa65ad180..6c49acb96982 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -538,8 +538,31 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
538 return 1; 538 return 1;
539} 539}
540 540
541static noinline void __switch_to_xtra(struct task_struct *next_p, 541#ifdef CONFIG_SECCOMP
542 struct tss_struct *tss) 542void hard_disable_TSC(void)
543{
544 write_cr4(read_cr4() | X86_CR4_TSD);
545}
546void disable_TSC(void)
547{
548 preempt_disable();
549 if (!test_and_set_thread_flag(TIF_NOTSC))
550 /*
551 * Must flip the CPU state synchronously with
552 * TIF_NOTSC in the current running context.
553 */
554 hard_disable_TSC();
555 preempt_enable();
556}
557void hard_enable_TSC(void)
558{
559 write_cr4(read_cr4() & ~X86_CR4_TSD);
560}
561#endif /* CONFIG_SECCOMP */
562
563static noinline void
564__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
565 struct tss_struct *tss)
543{ 566{
544 struct thread_struct *next; 567 struct thread_struct *next;
545 568
@@ -555,6 +578,17 @@ static noinline void __switch_to_xtra(struct task_struct *next_p,
555 set_debugreg(next->debugreg[7], 7); 578 set_debugreg(next->debugreg[7], 7);
556 } 579 }
557 580
581#ifdef CONFIG_SECCOMP
582 if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^
583 test_tsk_thread_flag(next_p, TIF_NOTSC)) {
584 /* prev and next are different */
585 if (test_tsk_thread_flag(next_p, TIF_NOTSC))
586 hard_disable_TSC();
587 else
588 hard_enable_TSC();
589 }
590#endif
591
558 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) { 592 if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) {
559 /* 593 /*
560 * Disable the bitmap via an invalid offset. We still cache 594 * Disable the bitmap via an invalid offset. We still cache
@@ -586,33 +620,6 @@ static noinline void __switch_to_xtra(struct task_struct *next_p,
586} 620}
587 621
588/* 622/*
589 * This function selects if the context switch from prev to next
590 * has to tweak the TSC disable bit in the cr4.
591 */
592static inline void disable_tsc(struct task_struct *prev_p,
593 struct task_struct *next_p)
594{
595 struct thread_info *prev, *next;
596
597 /*
598 * gcc should eliminate the ->thread_info dereference if
599 * has_secure_computing returns 0 at compile time (SECCOMP=n).
600 */
601 prev = task_thread_info(prev_p);
602 next = task_thread_info(next_p);
603
604 if (has_secure_computing(prev) || has_secure_computing(next)) {
605 /* slow path here */
606 if (has_secure_computing(prev) &&
607 !has_secure_computing(next)) {
608 write_cr4(read_cr4() & ~X86_CR4_TSD);
609 } else if (!has_secure_computing(prev) &&
610 has_secure_computing(next))
611 write_cr4(read_cr4() | X86_CR4_TSD);
612 }
613}
614
615/*
616 * switch_to(x,yn) should switch tasks from x to y. 623 * switch_to(x,yn) should switch tasks from x to y.
617 * 624 *
618 * We fsave/fwait so that an exception goes off at the right time 625 * We fsave/fwait so that an exception goes off at the right time
@@ -689,11 +696,9 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
689 /* 696 /*
690 * Now maybe handle debug registers and/or IO bitmaps 697 * Now maybe handle debug registers and/or IO bitmaps
691 */ 698 */
692 if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW) 699 if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV ||
693 || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP))) 700 task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
694 __switch_to_xtra(next_p, tss); 701 __switch_to_xtra(prev_p, next_p, tss);
695
696 disable_tsc(prev_p, next_p);
697 702
698 /* 703 /*
699 * Leave lazy mode, flushing any hypercalls made here. 704 * Leave lazy mode, flushing any hypercalls made here.
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index 0c0ceec5de00..1c075f58d1f9 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -358,17 +358,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
358 switch (request) { 358 switch (request) {
359 /* when I and D space are separate, these will need to be fixed. */ 359 /* when I and D space are separate, these will need to be fixed. */
360 case PTRACE_PEEKTEXT: /* read word at location addr. */ 360 case PTRACE_PEEKTEXT: /* read word at location addr. */
361 case PTRACE_PEEKDATA: { 361 case PTRACE_PEEKDATA:
362 unsigned long tmp; 362 ret = generic_ptrace_peekdata(child, addr, data);
363 int copied;
364
365 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
366 ret = -EIO;
367 if (copied != sizeof(tmp))
368 break;
369 ret = put_user(tmp, datap);
370 break; 363 break;
371 }
372 364
373 /* read the word at location addr in the USER area. */ 365 /* read the word at location addr in the USER area. */
374 case PTRACE_PEEKUSR: { 366 case PTRACE_PEEKUSR: {
@@ -395,10 +387,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
395 /* when I and D space are separate, this will have to be fixed. */ 387 /* when I and D space are separate, this will have to be fixed. */
396 case PTRACE_POKETEXT: /* write the word at location addr. */ 388 case PTRACE_POKETEXT: /* write the word at location addr. */
397 case PTRACE_POKEDATA: 389 case PTRACE_POKEDATA:
398 ret = 0; 390 ret = generic_ptrace_pokedata(child, addr, data);
399 if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data))
400 break;
401 ret = -EIO;
402 break; 391 break;
403 392
404 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 393 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 90da0575fcff..18c1c285836d 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -390,7 +390,7 @@ void die(const char * str, struct pt_regs * regs, long err)
390 unsigned long esp; 390 unsigned long esp;
391 unsigned short ss; 391 unsigned short ss;
392 392
393 report_bug(regs->eip); 393 report_bug(regs->eip, regs);
394 394
395 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 395 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
396#ifdef CONFIG_PREEMPT 396#ifdef CONFIG_PREEMPT
@@ -433,6 +433,7 @@ void die(const char * str, struct pt_regs * regs, long err)
433 433
434 bust_spinlocks(0); 434 bust_spinlocks(0);
435 die.lock_owner = -1; 435 die.lock_owner = -1;
436 add_taint(TAINT_DIE);
436 spin_unlock_irqrestore(&die.lock, flags); 437 spin_unlock_irqrestore(&die.lock, flags);
437 438
438 if (!regs) 439 if (!regs)
diff --git a/arch/i386/video/Makefile b/arch/i386/video/Makefile
new file mode 100644
index 000000000000..2c447c94adcc
--- /dev/null
+++ b/arch/i386/video/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_FB) += fbdev.o
diff --git a/arch/i386/video/fbdev.c b/arch/i386/video/fbdev.c
new file mode 100644
index 000000000000..48fb38d7d2c0
--- /dev/null
+++ b/arch/i386/video/fbdev.c
@@ -0,0 +1,32 @@
1/*
2 * arch/i386/video/fbdev.c - i386 Framebuffer
3 *
4 * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 *
10 */
11#include <linux/fb.h>
12#include <linux/pci.h>
13
14int fb_is_primary_device(struct fb_info *info)
15{
16 struct device *device = info->device;
17 struct pci_dev *pci_dev = NULL;
18 struct resource *res = NULL;
19 int retval = 0;
20
21 if (device)
22 pci_dev = to_pci_dev(device);
23
24 if (pci_dev)
25 res = &pci_dev->resource[PCI_ROM_RESOURCE];
26
27 if (res && res->flags & IORESOURCE_ROM_SHADOW)
28 retval = 1;
29
30 return retval;
31}
32EXPORT_SYMBOL(fb_is_primary_device);