diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:54:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:54:49 -0400 |
commit | d1a76187a5be4f89c6cb19d800cb5fb7aac735c5 (patch) | |
tree | 2fac3ffbfffc7560eeef8364b541d0d7a0057920 /arch/um | |
parent | c7e78cff6b7518212247fb20b1dc6411540dc9af (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into core/locking
Conflicts:
arch/um/include/asm/system.h
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig.char | 4 | ||||
-rw-r--r-- | arch/um/Kconfig.common | 77 | ||||
-rw-r--r-- | arch/um/Kconfig.rest | 42 | ||||
-rw-r--r-- | arch/um/Kconfig.um (renamed from arch/um/Kconfig) | 120 | ||||
-rw-r--r-- | arch/um/Kconfig.x86 (renamed from arch/um/Kconfig.i386) | 43 | ||||
-rw-r--r-- | arch/um/Kconfig.x86_64 | 42 | ||||
-rw-r--r-- | arch/um/Makefile | 93 | ||||
-rw-r--r-- | arch/um/Makefile-os-Linux | 1 | ||||
-rw-r--r-- | arch/um/drivers/Makefile | 1 | ||||
-rw-r--r-- | arch/um/drivers/line.c | 2 | ||||
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 19 | ||||
-rw-r--r-- | arch/um/include/asm/a.out-core.h | 27 | ||||
-rw-r--r-- | arch/um/include/asm/apic.h | 4 | ||||
-rw-r--r-- | arch/um/include/asm/auxvec.h | 4 | ||||
-rw-r--r-- | arch/um/include/asm/bugs.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/cache.h | 17 | ||||
-rw-r--r-- | arch/um/include/asm/checksum.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/common.lds.S | 130 | ||||
-rw-r--r-- | arch/um/include/asm/cputime.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/current.h | 13 | ||||
-rw-r--r-- | arch/um/include/asm/delay.h | 20 | ||||
-rw-r--r-- | arch/um/include/asm/desc.h | 16 | ||||
-rw-r--r-- | arch/um/include/asm/device.h | 7 | ||||
-rw-r--r-- | arch/um/include/asm/dma-mapping.h | 128 | ||||
-rw-r--r-- | arch/um/include/asm/dma.h | 10 | ||||
-rw-r--r-- | arch/um/include/asm/emergency-restart.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/fixmap.h | 99 | ||||
-rw-r--r-- | arch/um/include/asm/futex.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/hardirq.h | 25 | ||||
-rw-r--r-- | arch/um/include/asm/hw_irq.h | 7 | ||||
-rw-r--r-- | arch/um/include/asm/io.h | 57 | ||||
-rw-r--r-- | arch/um/include/asm/irq.h | 23 | ||||
-rw-r--r-- | arch/um/include/asm/irq_regs.h | 1 | ||||
-rw-r--r-- | arch/um/include/asm/irq_vectors.h | 20 | ||||
-rw-r--r-- | arch/um/include/asm/irqflags.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/kdebug.h | 1 | ||||
-rw-r--r-- | arch/um/include/asm/kmap_types.h | 29 | ||||
-rw-r--r-- | arch/um/include/asm/mmu.h | 22 | ||||
-rw-r--r-- | arch/um/include/asm/mmu_context.h | 54 | ||||
-rw-r--r-- | arch/um/include/asm/mutex.h | 9 | ||||
-rw-r--r-- | arch/um/include/asm/page.h | 122 | ||||
-rw-r--r-- | arch/um/include/asm/page_offset.h | 1 | ||||
-rw-r--r-- | arch/um/include/asm/param.h | 20 | ||||
-rw-r--r-- | arch/um/include/asm/pci.h | 7 | ||||
-rw-r--r-- | arch/um/include/asm/pda.h | 31 | ||||
-rw-r--r-- | arch/um/include/asm/pgalloc.h | 72 | ||||
-rw-r--r-- | arch/um/include/asm/pgtable-2level.h | 53 | ||||
-rw-r--r-- | arch/um/include/asm/pgtable-3level.h | 146 | ||||
-rw-r--r-- | arch/um/include/asm/pgtable.h | 366 | ||||
-rw-r--r-- | arch/um/include/asm/processor-generic.h | 136 | ||||
-rw-r--r-- | arch/um/include/asm/ptrace-generic.h | 55 | ||||
-rw-r--r-- | arch/um/include/asm/required-features.h | 9 | ||||
-rw-r--r-- | arch/um/include/asm/sections.h | 7 | ||||
-rw-r--r-- | arch/um/include/asm/segment.h | 10 | ||||
-rw-r--r-- | arch/um/include/asm/setup.h | 10 | ||||
-rw-r--r-- | arch/um/include/asm/smp.h | 33 | ||||
-rw-r--r-- | arch/um/include/asm/suspend.h | 4 | ||||
-rw-r--r-- | arch/um/include/asm/system.h | 35 | ||||
-rw-r--r-- | arch/um/include/asm/thread_info.h | 83 | ||||
-rw-r--r-- | arch/um/include/asm/timex.h | 13 | ||||
-rw-r--r-- | arch/um/include/asm/tlb.h | 127 | ||||
-rw-r--r-- | arch/um/include/asm/tlbflush.h | 31 | ||||
-rw-r--r-- | arch/um/include/asm/topology.h | 6 | ||||
-rw-r--r-- | arch/um/include/asm/uaccess.h | 99 | ||||
-rw-r--r-- | arch/um/include/asm/xor.h | 6 | ||||
-rw-r--r-- | arch/um/include/shared/aio.h (renamed from arch/um/include/aio.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/arch.h (renamed from arch/um/include/arch.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/as-layout.h (renamed from arch/um/include/as-layout.h) | 1 | ||||
-rw-r--r-- | arch/um/include/shared/chan_kern.h (renamed from arch/um/include/chan_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/chan_user.h (renamed from arch/um/include/chan_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/common-offsets.h (renamed from arch/um/include/common-offsets.h) | 13 | ||||
-rw-r--r-- | arch/um/include/shared/elf_user.h (renamed from arch/um/include/elf_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/frame_kern.h (renamed from arch/um/include/frame_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/init.h (renamed from arch/um/include/init.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/initrd.h (renamed from arch/um/include/initrd.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/irq_kern.h (renamed from arch/um/include/irq_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/irq_user.h (renamed from arch/um/include/irq_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/kern.h (renamed from arch/um/include/kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/kern_util.h (renamed from arch/um/include/kern_util.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/ldt.h | 37 | ||||
-rw-r--r-- | arch/um/include/shared/line.h (renamed from arch/um/include/line.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/longjmp.h (renamed from arch/um/include/longjmp.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/mconsole.h (renamed from arch/um/include/mconsole.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/mconsole_kern.h (renamed from arch/um/include/mconsole_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/mem.h (renamed from arch/um/include/mem.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/mem_kern.h (renamed from arch/um/include/mem_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/mem_user.h (renamed from arch/um/include/mem_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/net_kern.h (renamed from arch/um/include/net_kern.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/net_user.h (renamed from arch/um/include/net_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/os.h (renamed from arch/um/include/os.h) | 1 | ||||
-rw-r--r-- | arch/um/include/shared/process.h (renamed from arch/um/include/process.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/ptrace_user.h (renamed from arch/um/include/ptrace_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/registers.h (renamed from arch/um/include/registers.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/sigio.h (renamed from arch/um/include/sigio.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas/mm_id.h (renamed from arch/um/include/skas/mm_id.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas/proc_mm.h (renamed from arch/um/include/skas/proc_mm.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas/skas.h (renamed from arch/um/include/skas/skas.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas/stub-data.h (renamed from arch/um/include/skas/stub-data.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas_ptrace.h (renamed from arch/um/include/skas_ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/skas_ptregs.h (renamed from arch/um/include/skas_ptregs.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/syscall.h (renamed from arch/um/include/syscall.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/sysrq.h (renamed from arch/um/include/sysrq.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/task.h (renamed from arch/um/include/task.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/tlb.h (renamed from arch/um/include/tlb.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/ubd_user.h (renamed from arch/um/include/ubd_user.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/um_malloc.h (renamed from arch/um/include/um_malloc.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/um_mmu.h (renamed from arch/um/include/um_mmu.h) | 3 | ||||
-rw-r--r-- | arch/um/include/shared/um_uaccess.h (renamed from arch/um/include/um_uaccess.h) | 0 | ||||
-rw-r--r-- | arch/um/include/shared/user.h (renamed from arch/um/include/user.h) | 2 | ||||
-rw-r--r-- | arch/um/include/sigcontext.h | 25 | ||||
-rw-r--r-- | arch/um/kernel/exec.c | 13 | ||||
-rw-r--r-- | arch/um/kernel/internal.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/smp.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/Makefile | 3 | ||||
-rw-r--r-- | arch/um/os-Linux/include/file.h | 11 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/mem.c | 1 | ||||
-rw-r--r-- | arch/um/os-Linux/tty_log.c | 217 | ||||
-rw-r--r-- | arch/um/sys-i386/asm/archparam.h | 26 | ||||
-rw-r--r-- | arch/um/sys-i386/asm/elf.h | 163 | ||||
-rw-r--r-- | arch/um/sys-i386/asm/module.h | 13 | ||||
-rw-r--r-- | arch/um/sys-i386/asm/processor.h | 78 | ||||
-rw-r--r-- | arch/um/sys-i386/asm/ptrace.h | 56 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/archsetjmp.h (renamed from arch/um/include/sysdep-i386/archsetjmp.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/barrier.h (renamed from arch/um/include/sysdep-i386/barrier.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/checksum.h (renamed from arch/um/include/sysdep-i386/checksum.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/faultinfo.h (renamed from arch/um/include/sysdep-i386/faultinfo.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/host_ldt.h | 34 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/kernel-offsets.h (renamed from arch/um/include/sysdep-i386/kernel-offsets.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/ptrace.h (renamed from arch/um/include/sysdep-i386/ptrace.h) | 1 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/ptrace_user.h (renamed from arch/um/include/sysdep-i386/ptrace_user.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/sc.h (renamed from arch/um/include/sysdep-i386/sc.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/sigcontext.h (renamed from arch/um/include/sysdep-i386/sigcontext.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/skas_ptrace.h (renamed from arch/um/include/sysdep-i386/skas_ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/stub.h (renamed from arch/um/include/sysdep-i386/stub.h) | 1 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/syscalls.h (renamed from arch/um/include/sysdep-i386/syscalls.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/system.h | 132 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/tls.h (renamed from arch/um/include/sysdep-i386/tls.h) | 2 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/vm-flags.h | 14 | ||||
-rw-r--r-- | arch/um/sys-i386/signal.c | 3 | ||||
-rw-r--r-- | arch/um/sys-i386/stub.S | 1 | ||||
-rw-r--r-- | arch/um/sys-i386/syscalls.c | 1 | ||||
-rw-r--r-- | arch/um/sys-ia64/sysdep/ptrace.h (renamed from arch/um/include/sysdep-ia64/ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ia64/sysdep/sigcontext.h (renamed from arch/um/include/sysdep-ia64/sigcontext.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ia64/sysdep/skas_ptrace.h (renamed from arch/um/include/sysdep-ia64/skas_ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ia64/sysdep/syscalls.h (renamed from arch/um/include/sysdep-ia64/syscalls.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ppc/asm/archparam.h | 8 | ||||
-rw-r--r-- | arch/um/sys-ppc/asm/elf.h | 53 | ||||
-rw-r--r-- | arch/um/sys-ppc/asm/processor.h | 15 | ||||
-rw-r--r-- | arch/um/sys-ppc/shared/sysdep/ptrace.h (renamed from arch/um/include/sysdep-ppc/ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ppc/shared/sysdep/sigcontext.h (renamed from arch/um/include/sysdep-ppc/sigcontext.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ppc/shared/sysdep/skas_ptrace.h (renamed from arch/um/include/sysdep-ppc/skas_ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-ppc/shared/sysdep/syscalls.h (renamed from arch/um/include/sysdep-ppc/syscalls.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/asm/archparam.h | 26 | ||||
-rw-r--r-- | arch/um/sys-x86_64/asm/elf.h | 119 | ||||
-rw-r--r-- | arch/um/sys-x86_64/asm/module.h | 30 | ||||
-rw-r--r-- | arch/um/sys-x86_64/asm/processor.h | 56 | ||||
-rw-r--r-- | arch/um/sys-x86_64/asm/ptrace.h | 72 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/archsetjmp.h (renamed from arch/um/include/sysdep-x86_64/archsetjmp.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/barrier.h (renamed from arch/um/include/sysdep-x86_64/barrier.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/checksum.h (renamed from arch/um/include/sysdep-x86_64/checksum.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/faultinfo.h (renamed from arch/um/include/sysdep-x86_64/faultinfo.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/host_ldt.h | 38 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h (renamed from arch/um/include/sysdep-x86_64/kernel-offsets.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/ptrace.h (renamed from arch/um/include/sysdep-x86_64/ptrace.h) | 1 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/ptrace_user.h (renamed from arch/um/include/sysdep-x86_64/ptrace_user.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/sc.h (renamed from arch/um/include/sysdep-x86_64/sc.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/sigcontext.h (renamed from arch/um/include/sysdep-x86_64/sigcontext.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h (renamed from arch/um/include/sysdep-x86_64/skas_ptrace.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/stub.h (renamed from arch/um/include/sysdep-x86_64/stub.h) | 1 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/syscalls.h (renamed from arch/um/include/sysdep-x86_64/syscalls.h) | 0 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/system.h | 132 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/tls.h (renamed from arch/um/include/sysdep-x86_64/tls.h) | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/shared/sysdep/vm-flags.h | 33 | ||||
-rw-r--r-- | arch/um/sys-x86_64/stub.S | 1 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscall_table.c | 8 |
177 files changed, 3585 insertions, 552 deletions
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char index 1b238ebae6b3..70dabd1e0652 100644 --- a/arch/um/Kconfig.char +++ b/arch/um/Kconfig.char | |||
@@ -203,6 +203,10 @@ config SOUND | |||
203 | tristate | 203 | tristate |
204 | default UML_SOUND | 204 | default UML_SOUND |
205 | 205 | ||
206 | config SOUND_OSS_CORE | ||
207 | bool | ||
208 | default UML_SOUND | ||
209 | |||
206 | config HOSTAUDIO | 210 | config HOSTAUDIO |
207 | tristate | 211 | tristate |
208 | default UML_SOUND | 212 | default UML_SOUND |
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common new file mode 100644 index 000000000000..0d207e73a758 --- /dev/null +++ b/arch/um/Kconfig.common | |||
@@ -0,0 +1,77 @@ | |||
1 | config DEFCONFIG_LIST | ||
2 | string | ||
3 | option defconfig_list | ||
4 | default "arch/$ARCH/defconfig" | ||
5 | |||
6 | # UML uses the generic IRQ subsystem | ||
7 | config GENERIC_HARDIRQS | ||
8 | bool | ||
9 | default y | ||
10 | |||
11 | config UML | ||
12 | bool | ||
13 | default y | ||
14 | |||
15 | config MMU | ||
16 | bool | ||
17 | default y | ||
18 | |||
19 | config NO_IOMEM | ||
20 | def_bool y | ||
21 | |||
22 | mainmenu "Linux/Usermode Kernel Configuration" | ||
23 | |||
24 | config ISA | ||
25 | bool | ||
26 | |||
27 | config SBUS | ||
28 | bool | ||
29 | |||
30 | config PCI | ||
31 | bool | ||
32 | |||
33 | config PCMCIA | ||
34 | bool | ||
35 | |||
36 | # Yet to do! | ||
37 | config TRACE_IRQFLAGS_SUPPORT | ||
38 | bool | ||
39 | default n | ||
40 | |||
41 | config LOCKDEP_SUPPORT | ||
42 | bool | ||
43 | default y | ||
44 | |||
45 | config STACKTRACE_SUPPORT | ||
46 | bool | ||
47 | default n | ||
48 | |||
49 | config GENERIC_CALIBRATE_DELAY | ||
50 | bool | ||
51 | default y | ||
52 | |||
53 | config GENERIC_BUG | ||
54 | bool | ||
55 | default y | ||
56 | depends on BUG | ||
57 | |||
58 | config GENERIC_TIME | ||
59 | bool | ||
60 | default y | ||
61 | |||
62 | config GENERIC_CLOCKEVENTS | ||
63 | bool | ||
64 | default y | ||
65 | |||
66 | # Used in kernel/irq/manage.c and include/linux/irq.h | ||
67 | config IRQ_RELEASE_METHOD | ||
68 | bool | ||
69 | default y | ||
70 | |||
71 | config HZ | ||
72 | int | ||
73 | default 100 | ||
74 | |||
75 | config SUBARCH | ||
76 | string | ||
77 | option env="SUBARCH" | ||
diff --git a/arch/um/Kconfig.rest b/arch/um/Kconfig.rest new file mode 100644 index 000000000000..7b5cea75a6c4 --- /dev/null +++ b/arch/um/Kconfig.rest | |||
@@ -0,0 +1,42 @@ | |||
1 | source "init/Kconfig" | ||
2 | |||
3 | source "kernel/Kconfig.freezer" | ||
4 | |||
5 | source "drivers/block/Kconfig" | ||
6 | |||
7 | source "arch/um/Kconfig.char" | ||
8 | |||
9 | source "drivers/base/Kconfig" | ||
10 | |||
11 | source "net/Kconfig" | ||
12 | |||
13 | source "arch/um/Kconfig.net" | ||
14 | |||
15 | source "drivers/net/Kconfig" | ||
16 | |||
17 | source "drivers/connector/Kconfig" | ||
18 | |||
19 | source "fs/Kconfig" | ||
20 | |||
21 | source "security/Kconfig" | ||
22 | |||
23 | source "crypto/Kconfig" | ||
24 | |||
25 | source "lib/Kconfig" | ||
26 | |||
27 | source "drivers/scsi/Kconfig" | ||
28 | |||
29 | source "drivers/md/Kconfig" | ||
30 | |||
31 | if BROKEN | ||
32 | source "drivers/mtd/Kconfig" | ||
33 | endif | ||
34 | |||
35 | source "drivers/leds/Kconfig" | ||
36 | |||
37 | #This is just to shut up some Kconfig warnings, so no prompt. | ||
38 | config INPUT | ||
39 | bool | ||
40 | default n | ||
41 | |||
42 | source "arch/um/Kconfig.debug" | ||
diff --git a/arch/um/Kconfig b/arch/um/Kconfig.um index 6976812cfb18..ec2b8da1aba4 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig.um | |||
@@ -1,79 +1,3 @@ | |||
1 | config DEFCONFIG_LIST | ||
2 | string | ||
3 | option defconfig_list | ||
4 | default "arch/$ARCH/defconfig" | ||
5 | |||
6 | # UML uses the generic IRQ subsystem | ||
7 | config GENERIC_HARDIRQS | ||
8 | bool | ||
9 | default y | ||
10 | |||
11 | config UML | ||
12 | bool | ||
13 | default y | ||
14 | |||
15 | config MMU | ||
16 | bool | ||
17 | default y | ||
18 | |||
19 | config NO_IOMEM | ||
20 | def_bool y | ||
21 | |||
22 | mainmenu "Linux/Usermode Kernel Configuration" | ||
23 | |||
24 | config ISA | ||
25 | bool | ||
26 | |||
27 | config SBUS | ||
28 | bool | ||
29 | |||
30 | config PCI | ||
31 | bool | ||
32 | |||
33 | config PCMCIA | ||
34 | bool | ||
35 | |||
36 | # Yet to do! | ||
37 | config TRACE_IRQFLAGS_SUPPORT | ||
38 | bool | ||
39 | default n | ||
40 | |||
41 | config LOCKDEP_SUPPORT | ||
42 | bool | ||
43 | default y | ||
44 | |||
45 | config STACKTRACE_SUPPORT | ||
46 | bool | ||
47 | default n | ||
48 | |||
49 | config GENERIC_CALIBRATE_DELAY | ||
50 | bool | ||
51 | default y | ||
52 | |||
53 | config GENERIC_BUG | ||
54 | bool | ||
55 | default y | ||
56 | depends on BUG | ||
57 | |||
58 | config GENERIC_TIME | ||
59 | bool | ||
60 | default y | ||
61 | |||
62 | config GENERIC_CLOCKEVENTS | ||
63 | bool | ||
64 | default y | ||
65 | |||
66 | # Used in kernel/irq/manage.c and include/linux/irq.h | ||
67 | config IRQ_RELEASE_METHOD | ||
68 | bool | ||
69 | default y | ||
70 | |||
71 | config HZ | ||
72 | int | ||
73 | default 100 | ||
74 | |||
75 | menu "UML-specific options" | ||
76 | |||
77 | config STATIC_LINK | 1 | config STATIC_LINK |
78 | bool "Force a static link" | 2 | bool "Force a static link" |
79 | default n | 3 | default n |
@@ -85,7 +9,6 @@ config STATIC_LINK | |||
85 | Additionally, this option enables using higher memory spaces (up to | 9 | Additionally, this option enables using higher memory spaces (up to |
86 | 2.75G) for UML. | 10 | 2.75G) for UML. |
87 | 11 | ||
88 | source "arch/um/Kconfig.arch" | ||
89 | source "mm/Kconfig" | 12 | source "mm/Kconfig" |
90 | source "kernel/time/Kconfig" | 13 | source "kernel/time/Kconfig" |
91 | 14 | ||
@@ -224,46 +147,3 @@ config KERNEL_STACK_ORDER | |||
224 | This option determines the size of UML kernel stacks. They will | 147 | This option determines the size of UML kernel stacks. They will |
225 | be 1 << order pages. The default is OK unless you're running Valgrind | 148 | be 1 << order pages. The default is OK unless you're running Valgrind |
226 | on UML, in which case, set this to 3. | 149 | on UML, in which case, set this to 3. |
227 | |||
228 | endmenu | ||
229 | |||
230 | source "init/Kconfig" | ||
231 | |||
232 | source "drivers/block/Kconfig" | ||
233 | |||
234 | source "arch/um/Kconfig.char" | ||
235 | |||
236 | source "drivers/base/Kconfig" | ||
237 | |||
238 | source "net/Kconfig" | ||
239 | |||
240 | source "arch/um/Kconfig.net" | ||
241 | |||
242 | source "drivers/net/Kconfig" | ||
243 | |||
244 | source "drivers/connector/Kconfig" | ||
245 | |||
246 | source "fs/Kconfig" | ||
247 | |||
248 | source "security/Kconfig" | ||
249 | |||
250 | source "crypto/Kconfig" | ||
251 | |||
252 | source "lib/Kconfig" | ||
253 | |||
254 | source "drivers/scsi/Kconfig" | ||
255 | |||
256 | source "drivers/md/Kconfig" | ||
257 | |||
258 | if BROKEN | ||
259 | source "drivers/mtd/Kconfig" | ||
260 | endif | ||
261 | |||
262 | source "drivers/leds/Kconfig" | ||
263 | |||
264 | #This is just to shut up some Kconfig warnings, so no prompt. | ||
265 | config INPUT | ||
266 | bool | ||
267 | default n | ||
268 | |||
269 | source "arch/um/Kconfig.debug" | ||
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.x86 index e09edfa560da..5ee328099c63 100644 --- a/arch/um/Kconfig.i386 +++ b/arch/um/Kconfig.x86 | |||
@@ -1,3 +1,7 @@ | |||
1 | source "arch/um/Kconfig.common" | ||
2 | |||
3 | menu "UML-specific options" | ||
4 | |||
1 | menu "Host processor type and features" | 5 | menu "Host processor type and features" |
2 | 6 | ||
3 | source "arch/x86/Kconfig.cpu" | 7 | source "arch/x86/Kconfig.cpu" |
@@ -5,23 +9,25 @@ source "arch/x86/Kconfig.cpu" | |||
5 | endmenu | 9 | endmenu |
6 | 10 | ||
7 | config UML_X86 | 11 | config UML_X86 |
12 | def_bool y | ||
13 | |||
14 | config 64BIT | ||
8 | bool | 15 | bool |
9 | default y | 16 | default SUBARCH = "x86_64" |
10 | 17 | ||
11 | config X86_32 | 18 | config X86_32 |
12 | bool | 19 | def_bool !64BIT |
13 | default y | 20 | select HAVE_AOUT |
14 | 21 | ||
15 | config RWSEM_XCHGADD_ALGORITHM | 22 | config RWSEM_XCHGADD_ALGORITHM |
16 | def_bool y | 23 | def_bool X86_XADD |
17 | 24 | ||
18 | config 64BIT | 25 | config RWSEM_GENERIC_SPINLOCK |
19 | bool | 26 | def_bool !X86_XADD |
20 | default n | ||
21 | 27 | ||
22 | config 3_LEVEL_PGTABLES | 28 | config 3_LEVEL_PGTABLES |
23 | bool "Three-level pagetables (EXPERIMENTAL)" | 29 | bool "Three-level pagetables (EXPERIMENTAL)" if !64BIT |
24 | default n | 30 | default 64BIT |
25 | depends on EXPERIMENTAL | 31 | depends on EXPERIMENTAL |
26 | help | 32 | help |
27 | Three-level pagetables will let UML have more than 4G of physical | 33 | Three-level pagetables will let UML have more than 4G of physical |
@@ -32,16 +38,19 @@ config 3_LEVEL_PGTABLES | |||
32 | N (on x86-64 it's automatically enabled, instead, as it's safe there). | 38 | N (on x86-64 it's automatically enabled, instead, as it's safe there). |
33 | 39 | ||
34 | config ARCH_HAS_SC_SIGNALS | 40 | config ARCH_HAS_SC_SIGNALS |
35 | bool | 41 | def_bool !64BIT |
36 | default y | ||
37 | 42 | ||
38 | config ARCH_REUSE_HOST_VSYSCALL_AREA | 43 | config ARCH_REUSE_HOST_VSYSCALL_AREA |
39 | bool | 44 | def_bool !64BIT |
40 | default y | ||
41 | 45 | ||
42 | config GENERIC_HWEIGHT | 46 | config SMP_BROKEN |
43 | bool | 47 | def_bool 64BIT |
44 | default y | ||
45 | 48 | ||
46 | config ARCH_SUPPORTS_AOUT | 49 | config GENERIC_HWEIGHT |
47 | def_bool y | 50 | def_bool y |
51 | |||
52 | source "arch/um/Kconfig.um" | ||
53 | |||
54 | endmenu | ||
55 | |||
56 | source "arch/um/Kconfig.rest" | ||
diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64 deleted file mode 100644 index 5696e7b374b3..000000000000 --- a/arch/um/Kconfig.x86_64 +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | |||
2 | menu "Host processor type and features" | ||
3 | |||
4 | source "arch/x86/Kconfig.cpu" | ||
5 | |||
6 | endmenu | ||
7 | |||
8 | config UML_X86 | ||
9 | bool | ||
10 | default y | ||
11 | |||
12 | config 64BIT | ||
13 | bool | ||
14 | default y | ||
15 | |||
16 | #XXX: this is so in the underlying arch, but it's wrong!!! | ||
17 | config RWSEM_GENERIC_SPINLOCK | ||
18 | bool | ||
19 | default y | ||
20 | |||
21 | config 3_LEVEL_PGTABLES | ||
22 | bool | ||
23 | default y | ||
24 | |||
25 | config ARCH_HAS_SC_SIGNALS | ||
26 | bool | ||
27 | default n | ||
28 | |||
29 | config ARCH_REUSE_HOST_VSYSCALL_AREA | ||
30 | bool | ||
31 | default n | ||
32 | |||
33 | config SMP_BROKEN | ||
34 | bool | ||
35 | default y | ||
36 | |||
37 | config GENERIC_HWEIGHT | ||
38 | bool | ||
39 | default y | ||
40 | |||
41 | config ARCH_SUPPORTS_AOUT | ||
42 | def_bool y | ||
diff --git a/arch/um/Makefile b/arch/um/Makefile index ca40397017b9..d944c343acdb 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -18,28 +18,16 @@ core-y += $(ARCH_DIR)/kernel/ \ | |||
18 | $(ARCH_DIR)/drivers/ \ | 18 | $(ARCH_DIR)/drivers/ \ |
19 | $(ARCH_DIR)/os-$(OS)/ | 19 | $(ARCH_DIR)/os-$(OS)/ |
20 | 20 | ||
21 | # Have to precede the include because the included Makefiles reference them. | 21 | MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas |
22 | SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \ | ||
23 | module.h vm-flags.h elf.h host_ldt.h | ||
24 | SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header)) | ||
25 | |||
26 | # XXX: The "os" symlink is only used by arch/um/include/os.h, which includes | ||
27 | # ../os/include/file.h | ||
28 | # | ||
29 | # These are cleaned up during mrproper. Please DO NOT fix it again, this is | ||
30 | # the Correct Thing(tm) to do! | ||
31 | ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ | ||
32 | $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h | ||
33 | |||
34 | MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/skas | ||
35 | 22 | ||
36 | include $(srctree)/$(ARCH_DIR)/Makefile-skas | 23 | include $(srctree)/$(ARCH_DIR)/Makefile-skas |
37 | 24 | ||
38 | ARCH_INCLUDE := -I$(ARCH_DIR)/include | 25 | ARCH_INCLUDE := -I$(srctree)/$(ARCH_DIR)/include/shared |
26 | ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared | ||
39 | ifneq ($(KBUILD_SRC),) | 27 | ifneq ($(KBUILD_SRC),) |
40 | ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include | 28 | ARCH_INCLUDE += -I$(ARCH_DIR)/include/shared # for two generated files |
41 | endif | 29 | endif |
42 | SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) | 30 | KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH) |
43 | 31 | ||
44 | # -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so | 32 | # -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so |
45 | # named - it's a common symbol in libpcap, so we get a binary which crashes. | 33 | # named - it's a common symbol in libpcap, so we get a binary which crashes. |
@@ -65,6 +53,8 @@ include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) | |||
65 | #This will adjust *FLAGS accordingly to the platform. | 53 | #This will adjust *FLAGS accordingly to the platform. |
66 | include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) | 54 | include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) |
67 | 55 | ||
56 | KBUILD_CPPFLAGS += -I$(srctree)/arch/$(HEADER_ARCH)/include | ||
57 | |||
68 | # -Derrno=kernel_errno - This turns all kernel references to errno into | 58 | # -Derrno=kernel_errno - This turns all kernel references to errno into |
69 | # kernel_errno to separate them from the libc errno. This allows -fno-common | 59 | # kernel_errno to separate them from the libc errno. This allows -fno-common |
70 | # in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different | 60 | # in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different |
@@ -93,14 +83,10 @@ define archhelp | |||
93 | echo ' find in the kernel root.' | 83 | echo ' find in the kernel root.' |
94 | endef | 84 | endef |
95 | 85 | ||
96 | ifneq ($(KBUILD_SRC),) | 86 | KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) |
97 | $(shell mkdir -p $(ARCH_DIR) && ln -fsn $(srctree)/$(ARCH_DIR)/Kconfig.$(SUBARCH) $(ARCH_DIR)/Kconfig.arch) | ||
98 | else | ||
99 | $(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch) | ||
100 | endif | ||
101 | 87 | ||
102 | archprepare: $(ARCH_SYMLINKS) $(ARCH_DIR)/include/user_constants.h | 88 | archprepare: $(ARCH_DIR)/include/shared/user_constants.h |
103 | prepare: $(ARCH_DIR)/include/kern_constants.h | 89 | prepare: $(ARCH_DIR)/include/shared/kern_constants.h |
104 | 90 | ||
105 | LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static | 91 | LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static |
106 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib | 92 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib |
@@ -132,62 +118,19 @@ endef | |||
132 | 118 | ||
133 | # When cleaning we don't include .config, so we don't include | 119 | # When cleaning we don't include .config, so we don't include |
134 | # TT or skas makefiles and don't clean skas_ptregs.h. | 120 | # TT or skas makefiles and don't clean skas_ptregs.h. |
135 | CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ | 121 | CLEAN_FILES += linux x.i gmon.out \ |
136 | $(ARCH_DIR)/include/user_constants.h \ | 122 | $(ARCH_DIR)/include/shared/user_constants.h \ |
137 | $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch | 123 | $(ARCH_DIR)/include/shared/kern_constants.h |
138 | |||
139 | MRPROPER_FILES += $(ARCH_SYMLINKS) | ||
140 | 124 | ||
141 | archclean: | 125 | archclean: |
142 | @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ | 126 | @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ |
143 | -o -name '*.gcov' \) -type f -print | xargs rm -f | 127 | -o -name '*.gcov' \) -type f -print | xargs rm -f |
144 | 128 | ||
145 | $(SYMLINK_HEADERS): | 129 | $(objtree)/$(ARCH_DIR)/include/shared: |
146 | @echo ' SYMLINK $@' | ||
147 | ifneq ($(KBUILD_SRC),) | ||
148 | $(Q)mkdir -p $(objtree)/include/asm-um | ||
149 | $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ | ||
150 | else | ||
151 | $(Q)cd $(srctree)/$(dir $@) ; \ | ||
152 | ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) | ||
153 | endif | ||
154 | |||
155 | include/asm-um/arch: | ||
156 | @echo ' SYMLINK $@' | ||
157 | ifneq ($(KBUILD_SRC),) | ||
158 | $(Q)mkdir -p $(objtree)/include/asm-um | ||
159 | $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch | ||
160 | else | ||
161 | $(Q)cd $(srctree)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch | ||
162 | endif | ||
163 | |||
164 | $(objtree)/$(ARCH_DIR)/include: | ||
165 | @echo ' MKDIR $@' | 130 | @echo ' MKDIR $@' |
166 | $(Q)mkdir -p $@ | 131 | $(Q)mkdir -p $@ |
167 | 132 | ||
168 | $(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include | ||
169 | @echo ' SYMLINK $@' | ||
170 | ifneq ($(KBUILD_SRC),) | ||
171 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep | ||
172 | else | ||
173 | $(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep | ||
174 | endif | ||
175 | |||
176 | $(ARCH_DIR)/os: | ||
177 | @echo ' SYMLINK $@' | ||
178 | ifneq ($(KBUILD_SRC),) | ||
179 | $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os | ||
180 | else | ||
181 | $(Q)cd $(ARCH_DIR) && ln -fsn os-$(OS) os | ||
182 | endif | ||
183 | |||
184 | # Generated files | 133 | # Generated files |
185 | define filechk_umlconfig | ||
186 | sed 's/ CONFIG/ UML_CONFIG/' | ||
187 | endef | ||
188 | |||
189 | $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h | ||
190 | $(call filechk,umlconfig) | ||
191 | 134 | ||
192 | $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE | 135 | $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE |
193 | $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(SUBARCH) $@ | 136 | $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(SUBARCH) $@ |
@@ -205,11 +148,11 @@ define filechk_gen-asm-offsets | |||
205 | echo ""; ) | 148 | echo ""; ) |
206 | endef | 149 | endef |
207 | 150 | ||
208 | $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s | 151 | $(ARCH_DIR)/include/shared/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s |
209 | $(call filechk,gen-asm-offsets) | 152 | $(call filechk,gen-asm-offsets) |
210 | 153 | ||
211 | $(ARCH_DIR)/include/kern_constants.h: $(objtree)/$(ARCH_DIR)/include | 154 | $(ARCH_DIR)/include/shared/kern_constants.h: $(objtree)/$(ARCH_DIR)/include/shared |
212 | @echo ' SYMLINK $@' | 155 | @echo ' SYMLINK $@' |
213 | $(Q)ln -sf ../../../include/asm-um/asm-offsets.h $@ | 156 | $(Q)ln -sf ../../../../include/asm/asm-offsets.h $@ |
214 | 157 | ||
215 | export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH | 158 | export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH |
diff --git a/arch/um/Makefile-os-Linux b/arch/um/Makefile-os-Linux index 52859487c95d..2c8a598ec14b 100644 --- a/arch/um/Makefile-os-Linux +++ b/arch/um/Makefile-os-Linux | |||
@@ -6,3 +6,4 @@ | |||
6 | # To get a definition of F_SETSIG | 6 | # To get a definition of F_SETSIG |
7 | USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE | 7 | USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE |
8 | KBUILD_CFLAGS += -D_LARGEFILE64_SOURCE | 8 | KBUILD_CFLAGS += -D_LARGEFILE64_SOURCE |
9 | DEV_NULL_PATH = \"/dev/null\" | ||
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile index d283e7b022a0..1d9b6ae967b0 100644 --- a/arch/um/drivers/Makefile +++ b/arch/um/drivers/Makefile | |||
@@ -62,5 +62,6 @@ obj-$(CONFIG_UML_RANDOM) += random.o | |||
62 | 62 | ||
63 | # pcap_user.o must be added explicitly. | 63 | # pcap_user.o must be added explicitly. |
64 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o | 64 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o |
65 | CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH) | ||
65 | 66 | ||
66 | include arch/um/scripts/Makefile.rules | 67 | include arch/um/scripts/Makefile.rules |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index d741f35d7b3a..14a102e877d6 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -275,6 +275,8 @@ int line_ioctl(struct tty_struct *tty, struct file * file, | |||
275 | case TIOCGLTC: | 275 | case TIOCGLTC: |
276 | case TIOCSLTC: | 276 | case TIOCSLTC: |
277 | #endif | 277 | #endif |
278 | /* Note: these are out of date as we now have TCGETS2 etc but this | ||
279 | whole lot should probably go away */ | ||
278 | case TCGETS: | 280 | case TCGETS: |
279 | case TCSETSF: | 281 | case TCSETSF: |
280 | case TCSETSW: | 282 | case TCSETSW: |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index b58fb8941d8d..0a868118cf06 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -98,9 +98,9 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data) | |||
98 | 98 | ||
99 | static DEFINE_MUTEX(ubd_lock); | 99 | static DEFINE_MUTEX(ubd_lock); |
100 | 100 | ||
101 | static int ubd_open(struct inode * inode, struct file * filp); | 101 | static int ubd_open(struct block_device *bdev, fmode_t mode); |
102 | static int ubd_release(struct inode * inode, struct file * file); | 102 | static int ubd_release(struct gendisk *disk, fmode_t mode); |
103 | static int ubd_ioctl(struct inode * inode, struct file * file, | 103 | static int ubd_ioctl(struct block_device *bdev, fmode_t mode, |
104 | unsigned int cmd, unsigned long arg); | 104 | unsigned int cmd, unsigned long arg); |
105 | static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 105 | static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
106 | 106 | ||
@@ -1112,9 +1112,9 @@ static int __init ubd_driver_init(void){ | |||
1112 | 1112 | ||
1113 | device_initcall(ubd_driver_init); | 1113 | device_initcall(ubd_driver_init); |
1114 | 1114 | ||
1115 | static int ubd_open(struct inode *inode, struct file *filp) | 1115 | static int ubd_open(struct block_device *bdev, fmode_t mode) |
1116 | { | 1116 | { |
1117 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1117 | struct gendisk *disk = bdev->bd_disk; |
1118 | struct ubd *ubd_dev = disk->private_data; | 1118 | struct ubd *ubd_dev = disk->private_data; |
1119 | int err = 0; | 1119 | int err = 0; |
1120 | 1120 | ||
@@ -1131,7 +1131,7 @@ static int ubd_open(struct inode *inode, struct file *filp) | |||
1131 | 1131 | ||
1132 | /* This should no more be needed. And it didn't work anyway to exclude | 1132 | /* This should no more be needed. And it didn't work anyway to exclude |
1133 | * read-write remounting of filesystems.*/ | 1133 | * read-write remounting of filesystems.*/ |
1134 | /*if((filp->f_mode & FMODE_WRITE) && !ubd_dev->openflags.w){ | 1134 | /*if((mode & FMODE_WRITE) && !ubd_dev->openflags.w){ |
1135 | if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev); | 1135 | if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev); |
1136 | err = -EROFS; | 1136 | err = -EROFS; |
1137 | }*/ | 1137 | }*/ |
@@ -1139,9 +1139,8 @@ static int ubd_open(struct inode *inode, struct file *filp) | |||
1139 | return err; | 1139 | return err; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static int ubd_release(struct inode * inode, struct file * file) | 1142 | static int ubd_release(struct gendisk *disk, fmode_t mode) |
1143 | { | 1143 | { |
1144 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
1145 | struct ubd *ubd_dev = disk->private_data; | 1144 | struct ubd *ubd_dev = disk->private_data; |
1146 | 1145 | ||
1147 | if(--ubd_dev->count == 0) | 1146 | if(--ubd_dev->count == 0) |
@@ -1306,10 +1305,10 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
1306 | return 0; | 1305 | return 0; |
1307 | } | 1306 | } |
1308 | 1307 | ||
1309 | static int ubd_ioctl(struct inode * inode, struct file * file, | 1308 | static int ubd_ioctl(struct block_device *bdev, fmode_t mode, |
1310 | unsigned int cmd, unsigned long arg) | 1309 | unsigned int cmd, unsigned long arg) |
1311 | { | 1310 | { |
1312 | struct ubd *ubd_dev = inode->i_bdev->bd_disk->private_data; | 1311 | struct ubd *ubd_dev = bdev->bd_disk->private_data; |
1313 | struct hd_driveid ubd_id = { | 1312 | struct hd_driveid ubd_id = { |
1314 | .cyls = 0, | 1313 | .cyls = 0, |
1315 | .heads = 128, | 1314 | .heads = 128, |
diff --git a/arch/um/include/asm/a.out-core.h b/arch/um/include/asm/a.out-core.h new file mode 100644 index 000000000000..995643b18309 --- /dev/null +++ b/arch/um/include/asm/a.out-core.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* a.out coredump register dumper | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __UM_A_OUT_CORE_H | ||
13 | #define __UM_A_OUT_CORE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/user.h> | ||
18 | |||
19 | /* | ||
20 | * fill in the user structure for an a.out core dump | ||
21 | */ | ||
22 | static inline void aout_dump_thread(struct pt_regs *regs, struct user *u) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | #endif /* __KERNEL__ */ | ||
27 | #endif /* __UM_A_OUT_CORE_H */ | ||
diff --git a/arch/um/include/asm/apic.h b/arch/um/include/asm/apic.h new file mode 100644 index 000000000000..876dee84ab11 --- /dev/null +++ b/arch/um/include/asm/apic.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_APIC_H | ||
2 | #define __UM_APIC_H | ||
3 | |||
4 | #endif | ||
diff --git a/arch/um/include/asm/auxvec.h b/arch/um/include/asm/auxvec.h new file mode 100644 index 000000000000..1e5e1c2fc9b1 --- /dev/null +++ b/arch/um/include/asm/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_AUXVEC_H | ||
2 | #define __UM_AUXVEC_H | ||
3 | |||
4 | #endif | ||
diff --git a/arch/um/include/asm/bugs.h b/arch/um/include/asm/bugs.h new file mode 100644 index 000000000000..6a72e240d5fc --- /dev/null +++ b/arch/um/include/asm/bugs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BUGS_H | ||
2 | #define __UM_BUGS_H | ||
3 | |||
4 | void check_bugs(void); | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/cache.h b/arch/um/include/asm/cache.h new file mode 100644 index 000000000000..19e1bdd67416 --- /dev/null +++ b/arch/um/include/asm/cache.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __UM_CACHE_H | ||
2 | #define __UM_CACHE_H | ||
3 | |||
4 | |||
5 | #if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT) | ||
6 | # define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) | ||
7 | #elif defined(CONFIG_UML_X86) /* 64-bit */ | ||
8 | # define L1_CACHE_SHIFT 6 /* Should be 7 on Intel */ | ||
9 | #else | ||
10 | /* XXX: this was taken from x86, now it's completely random. Luckily only | ||
11 | * affects SMP padding. */ | ||
12 | # define L1_CACHE_SHIFT 5 | ||
13 | #endif | ||
14 | |||
15 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
16 | |||
17 | #endif | ||
diff --git a/arch/um/include/asm/checksum.h b/arch/um/include/asm/checksum.h new file mode 100644 index 000000000000..5b501361e361 --- /dev/null +++ b/arch/um/include/asm/checksum.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_CHECKSUM_H | ||
2 | #define __UM_CHECKSUM_H | ||
3 | |||
4 | #include "sysdep/checksum.h" | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S new file mode 100644 index 000000000000..cb0248616d49 --- /dev/null +++ b/arch/um/include/asm/common.lds.S | |||
@@ -0,0 +1,130 @@ | |||
1 | #include <asm-generic/vmlinux.lds.h> | ||
2 | |||
3 | .fini : { *(.fini) } =0x9090 | ||
4 | _etext = .; | ||
5 | PROVIDE (etext = .); | ||
6 | |||
7 | . = ALIGN(4096); | ||
8 | _sdata = .; | ||
9 | PROVIDE (sdata = .); | ||
10 | |||
11 | RODATA | ||
12 | |||
13 | .unprotected : { *(.unprotected) } | ||
14 | . = ALIGN(4096); | ||
15 | PROVIDE (_unprotected_end = .); | ||
16 | |||
17 | . = ALIGN(4096); | ||
18 | .note : { *(.note.*) } | ||
19 | __ex_table : { | ||
20 | __start___ex_table = .; | ||
21 | *(__ex_table) | ||
22 | __stop___ex_table = .; | ||
23 | } | ||
24 | |||
25 | BUG_TABLE | ||
26 | |||
27 | .uml.setup.init : { | ||
28 | __uml_setup_start = .; | ||
29 | *(.uml.setup.init) | ||
30 | __uml_setup_end = .; | ||
31 | } | ||
32 | |||
33 | .uml.help.init : { | ||
34 | __uml_help_start = .; | ||
35 | *(.uml.help.init) | ||
36 | __uml_help_end = .; | ||
37 | } | ||
38 | |||
39 | .uml.postsetup.init : { | ||
40 | __uml_postsetup_start = .; | ||
41 | *(.uml.postsetup.init) | ||
42 | __uml_postsetup_end = .; | ||
43 | } | ||
44 | |||
45 | .init.setup : { | ||
46 | __setup_start = .; | ||
47 | *(.init.setup) | ||
48 | __setup_end = .; | ||
49 | } | ||
50 | |||
51 | . = ALIGN(32); | ||
52 | .data.percpu : { | ||
53 | __per_cpu_start = . ; | ||
54 | *(.data.percpu) | ||
55 | __per_cpu_end = . ; | ||
56 | } | ||
57 | |||
58 | .initcall.init : { | ||
59 | __initcall_start = .; | ||
60 | INITCALLS | ||
61 | __initcall_end = .; | ||
62 | } | ||
63 | |||
64 | .con_initcall.init : { | ||
65 | __con_initcall_start = .; | ||
66 | *(.con_initcall.init) | ||
67 | __con_initcall_end = .; | ||
68 | } | ||
69 | |||
70 | .uml.initcall.init : { | ||
71 | __uml_initcall_start = .; | ||
72 | *(.uml.initcall.init) | ||
73 | __uml_initcall_end = .; | ||
74 | } | ||
75 | __init_end = .; | ||
76 | |||
77 | SECURITY_INIT | ||
78 | |||
79 | .exitcall : { | ||
80 | __exitcall_begin = .; | ||
81 | *(.exitcall.exit) | ||
82 | __exitcall_end = .; | ||
83 | } | ||
84 | |||
85 | .uml.exitcall : { | ||
86 | __uml_exitcall_begin = .; | ||
87 | *(.uml.exitcall.exit) | ||
88 | __uml_exitcall_end = .; | ||
89 | } | ||
90 | |||
91 | . = ALIGN(4); | ||
92 | .altinstructions : { | ||
93 | __alt_instructions = .; | ||
94 | *(.altinstructions) | ||
95 | __alt_instructions_end = .; | ||
96 | } | ||
97 | .altinstr_replacement : { *(.altinstr_replacement) } | ||
98 | /* .exit.text is discard at runtime, not link time, to deal with references | ||
99 | from .altinstructions and .eh_frame */ | ||
100 | .exit.text : { *(.exit.text) } | ||
101 | .exit.data : { *(.exit.data) } | ||
102 | |||
103 | .preinit_array : { | ||
104 | __preinit_array_start = .; | ||
105 | *(.preinit_array) | ||
106 | __preinit_array_end = .; | ||
107 | } | ||
108 | .init_array : { | ||
109 | __init_array_start = .; | ||
110 | *(.init_array) | ||
111 | __init_array_end = .; | ||
112 | } | ||
113 | .fini_array : { | ||
114 | __fini_array_start = .; | ||
115 | *(.fini_array) | ||
116 | __fini_array_end = .; | ||
117 | } | ||
118 | |||
119 | . = ALIGN(4096); | ||
120 | .init.ramfs : { | ||
121 | __initramfs_start = .; | ||
122 | *(.init.ramfs) | ||
123 | __initramfs_end = .; | ||
124 | } | ||
125 | |||
126 | /* Sections to be discarded */ | ||
127 | /DISCARD/ : { | ||
128 | *(.exitcall.exit) | ||
129 | } | ||
130 | |||
diff --git a/arch/um/include/asm/cputime.h b/arch/um/include/asm/cputime.h new file mode 100644 index 000000000000..c84acbadfa2f --- /dev/null +++ b/arch/um/include/asm/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_CPUTIME_H | ||
2 | #define __UM_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __UM_CPUTIME_H */ | ||
diff --git a/arch/um/include/asm/current.h b/arch/um/include/asm/current.h new file mode 100644 index 000000000000..c2191d9aa03d --- /dev/null +++ b/arch/um/include/asm/current.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_CURRENT_H | ||
7 | #define __UM_CURRENT_H | ||
8 | |||
9 | #include "linux/thread_info.h" | ||
10 | |||
11 | #define current (current_thread_info()->task) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/um/include/asm/delay.h b/arch/um/include/asm/delay.h new file mode 100644 index 000000000000..c71e32b6741e --- /dev/null +++ b/arch/um/include/asm/delay.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __UM_DELAY_H | ||
2 | #define __UM_DELAY_H | ||
3 | |||
4 | #define MILLION 1000000 | ||
5 | |||
6 | /* Undefined on purpose */ | ||
7 | extern void __bad_udelay(void); | ||
8 | |||
9 | extern void __udelay(unsigned long usecs); | ||
10 | extern void __delay(unsigned long loops); | ||
11 | |||
12 | #define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \ | ||
13 | __bad_udelay() : __udelay(n)) | ||
14 | |||
15 | /* It appears that ndelay is not used at all for UML, and has never been | ||
16 | * implemented. */ | ||
17 | extern void __unimplemented_ndelay(void); | ||
18 | #define ndelay(n) __unimplemented_ndelay() | ||
19 | |||
20 | #endif | ||
diff --git a/arch/um/include/asm/desc.h b/arch/um/include/asm/desc.h new file mode 100644 index 000000000000..4ec34a51b62c --- /dev/null +++ b/arch/um/include/asm/desc.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __UM_DESC_H | ||
2 | #define __UM_DESC_H | ||
3 | |||
4 | /* Taken from asm-i386/desc.h, it's the only thing we need. The rest wouldn't | ||
5 | * compile, and has never been used. */ | ||
6 | #define LDT_empty(info) (\ | ||
7 | (info)->base_addr == 0 && \ | ||
8 | (info)->limit == 0 && \ | ||
9 | (info)->contents == 0 && \ | ||
10 | (info)->read_exec_only == 1 && \ | ||
11 | (info)->seg_32bit == 0 && \ | ||
12 | (info)->limit_in_pages == 0 && \ | ||
13 | (info)->seg_not_present == 1 && \ | ||
14 | (info)->useable == 0 ) | ||
15 | |||
16 | #endif | ||
diff --git a/arch/um/include/asm/device.h b/arch/um/include/asm/device.h new file mode 100644 index 000000000000..d8f9872b0e2d --- /dev/null +++ b/arch/um/include/asm/device.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* | ||
2 | * Arch specific extensions to struct device | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | */ | ||
6 | #include <asm-generic/device.h> | ||
7 | |||
diff --git a/arch/um/include/asm/dma-mapping.h b/arch/um/include/asm/dma-mapping.h new file mode 100644 index 000000000000..90fc708b320e --- /dev/null +++ b/arch/um/include/asm/dma-mapping.h | |||
@@ -0,0 +1,128 @@ | |||
1 | #ifndef _ASM_DMA_MAPPING_H | ||
2 | #define _ASM_DMA_MAPPING_H | ||
3 | |||
4 | #include <asm/scatterlist.h> | ||
5 | |||
6 | static inline int | ||
7 | dma_supported(struct device *dev, u64 mask) | ||
8 | { | ||
9 | BUG(); | ||
10 | return(0); | ||
11 | } | ||
12 | |||
13 | static inline int | ||
14 | dma_set_mask(struct device *dev, u64 dma_mask) | ||
15 | { | ||
16 | BUG(); | ||
17 | return(0); | ||
18 | } | ||
19 | |||
20 | static inline void * | ||
21 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
22 | gfp_t flag) | ||
23 | { | ||
24 | BUG(); | ||
25 | return((void *) 0); | ||
26 | } | ||
27 | |||
28 | static inline void | ||
29 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
30 | dma_addr_t dma_handle) | ||
31 | { | ||
32 | BUG(); | ||
33 | } | ||
34 | |||
35 | static inline dma_addr_t | ||
36 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | ||
37 | enum dma_data_direction direction) | ||
38 | { | ||
39 | BUG(); | ||
40 | return(0); | ||
41 | } | ||
42 | |||
43 | static inline void | ||
44 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
45 | enum dma_data_direction direction) | ||
46 | { | ||
47 | BUG(); | ||
48 | } | ||
49 | |||
50 | static inline dma_addr_t | ||
51 | dma_map_page(struct device *dev, struct page *page, | ||
52 | unsigned long offset, size_t size, | ||
53 | enum dma_data_direction direction) | ||
54 | { | ||
55 | BUG(); | ||
56 | return(0); | ||
57 | } | ||
58 | |||
59 | static inline void | ||
60 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
61 | enum dma_data_direction direction) | ||
62 | { | ||
63 | BUG(); | ||
64 | } | ||
65 | |||
66 | static inline int | ||
67 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
68 | enum dma_data_direction direction) | ||
69 | { | ||
70 | BUG(); | ||
71 | return(0); | ||
72 | } | ||
73 | |||
74 | static inline void | ||
75 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
76 | enum dma_data_direction direction) | ||
77 | { | ||
78 | BUG(); | ||
79 | } | ||
80 | |||
81 | static inline void | ||
82 | dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
83 | enum dma_data_direction direction) | ||
84 | { | ||
85 | BUG(); | ||
86 | } | ||
87 | |||
88 | static inline void | ||
89 | dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems, | ||
90 | enum dma_data_direction direction) | ||
91 | { | ||
92 | BUG(); | ||
93 | } | ||
94 | |||
95 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
96 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
97 | #define dma_is_consistent(d, h) (1) | ||
98 | |||
99 | static inline int | ||
100 | dma_get_cache_alignment(void) | ||
101 | { | ||
102 | BUG(); | ||
103 | return(0); | ||
104 | } | ||
105 | |||
106 | static inline void | ||
107 | dma_sync_single_range(struct device *dev, dma_addr_t dma_handle, | ||
108 | unsigned long offset, size_t size, | ||
109 | enum dma_data_direction direction) | ||
110 | { | ||
111 | BUG(); | ||
112 | } | ||
113 | |||
114 | static inline void | ||
115 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
116 | enum dma_data_direction direction) | ||
117 | { | ||
118 | BUG(); | ||
119 | } | ||
120 | |||
121 | static inline int | ||
122 | dma_mapping_error(struct device *dev, dma_addr_t dma_handle) | ||
123 | { | ||
124 | BUG(); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | #endif | ||
diff --git a/arch/um/include/asm/dma.h b/arch/um/include/asm/dma.h new file mode 100644 index 000000000000..9f6139a8a525 --- /dev/null +++ b/arch/um/include/asm/dma.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_DMA_H | ||
2 | #define __UM_DMA_H | ||
3 | |||
4 | #include "asm/io.h" | ||
5 | |||
6 | extern unsigned long uml_physmem; | ||
7 | |||
8 | #define MAX_DMA_ADDRESS (uml_physmem) | ||
9 | |||
10 | #endif | ||
diff --git a/arch/um/include/asm/emergency-restart.h b/arch/um/include/asm/emergency-restart.h new file mode 100644 index 000000000000..108d8c48e42e --- /dev/null +++ b/arch/um/include/asm/emergency-restart.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_EMERGENCY_RESTART_H | ||
2 | #define _ASM_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/um/include/asm/fixmap.h b/arch/um/include/asm/fixmap.h new file mode 100644 index 000000000000..69c0252345f1 --- /dev/null +++ b/arch/um/include/asm/fixmap.h | |||
@@ -0,0 +1,99 @@ | |||
1 | #ifndef __UM_FIXMAP_H | ||
2 | #define __UM_FIXMAP_H | ||
3 | |||
4 | #include <asm/processor.h> | ||
5 | #include <asm/system.h> | ||
6 | #include <asm/kmap_types.h> | ||
7 | #include <asm/archparam.h> | ||
8 | #include <asm/page.h> | ||
9 | #include <linux/threads.h> | ||
10 | |||
11 | /* | ||
12 | * Here we define all the compile-time 'special' virtual | ||
13 | * addresses. The point is to have a constant address at | ||
14 | * compile time, but to set the physical address only | ||
15 | * in the boot process. We allocate these special addresses | ||
16 | * from the end of virtual memory (0xfffff000) backwards. | ||
17 | * Also this lets us do fail-safe vmalloc(), we | ||
18 | * can guarantee that these special addresses and | ||
19 | * vmalloc()-ed addresses never overlap. | ||
20 | * | ||
21 | * these 'compile-time allocated' memory buffers are | ||
22 | * fixed-size 4k pages. (or larger if used with an increment | ||
23 | * highger than 1) use fixmap_set(idx,phys) to associate | ||
24 | * physical memory with fixmap indices. | ||
25 | * | ||
26 | * TLB entries of such buffers will not be flushed across | ||
27 | * task switches. | ||
28 | */ | ||
29 | |||
30 | /* | ||
31 | * on UP currently we will have no trace of the fixmap mechanizm, | ||
32 | * no page table allocations, etc. This might change in the | ||
33 | * future, say framebuffers for the console driver(s) could be | ||
34 | * fix-mapped? | ||
35 | */ | ||
36 | enum fixed_addresses { | ||
37 | #ifdef CONFIG_HIGHMEM | ||
38 | FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ | ||
39 | FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, | ||
40 | #endif | ||
41 | __end_of_fixed_addresses | ||
42 | }; | ||
43 | |||
44 | extern void __set_fixmap (enum fixed_addresses idx, | ||
45 | unsigned long phys, pgprot_t flags); | ||
46 | |||
47 | #define set_fixmap(idx, phys) \ | ||
48 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
49 | /* | ||
50 | * Some hardware wants to get fixmapped without caching. | ||
51 | */ | ||
52 | #define set_fixmap_nocache(idx, phys) \ | ||
53 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
54 | /* | ||
55 | * used by vmalloc.c. | ||
56 | * | ||
57 | * Leave one empty page between vmalloc'ed areas and | ||
58 | * the start of the fixmap, and leave one page empty | ||
59 | * at the top of mem.. | ||
60 | */ | ||
61 | |||
62 | #define FIXADDR_TOP (TASK_SIZE - 2 * PAGE_SIZE) | ||
63 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | ||
64 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
65 | |||
66 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
67 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
68 | |||
69 | extern void __this_fixmap_does_not_exist(void); | ||
70 | |||
71 | /* | ||
72 | * 'index to address' translation. If anyone tries to use the idx | ||
73 | * directly without tranlation, we catch the bug with a NULL-deference | ||
74 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
75 | */ | ||
76 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
77 | { | ||
78 | /* | ||
79 | * this branch gets completely eliminated after inlining, | ||
80 | * except when someone tries to use fixaddr indices in an | ||
81 | * illegal way. (such as mixing up address types or using | ||
82 | * out-of-range indices). | ||
83 | * | ||
84 | * If it doesn't get removed, the linker will complain | ||
85 | * loudly with a reasonably clear error message.. | ||
86 | */ | ||
87 | if (idx >= __end_of_fixed_addresses) | ||
88 | __this_fixmap_does_not_exist(); | ||
89 | |||
90 | return __fix_to_virt(idx); | ||
91 | } | ||
92 | |||
93 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
94 | { | ||
95 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
96 | return __virt_to_fix(vaddr); | ||
97 | } | ||
98 | |||
99 | #endif | ||
diff --git a/arch/um/include/asm/futex.h b/arch/um/include/asm/futex.h new file mode 100644 index 000000000000..6a332a9f099c --- /dev/null +++ b/arch/um/include/asm/futex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_FUTEX_H | ||
2 | #define _ASM_FUTEX_H | ||
3 | |||
4 | #include <asm-generic/futex.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/hardirq.h b/arch/um/include/asm/hardirq.h new file mode 100644 index 000000000000..313ebb8a2566 --- /dev/null +++ b/arch/um/include/asm/hardirq.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* (c) 2004 cw@f00f.org, GPLv2 blah blah */ | ||
2 | |||
3 | #ifndef __ASM_UM_HARDIRQ_H | ||
4 | #define __ASM_UM_HARDIRQ_H | ||
5 | |||
6 | #include <linux/threads.h> | ||
7 | #include <linux/irq.h> | ||
8 | |||
9 | /* NOTE: When SMP works again we might want to make this | ||
10 | * ____cacheline_aligned or maybe use per_cpu state? --cw */ | ||
11 | typedef struct { | ||
12 | unsigned int __softirq_pending; | ||
13 | } irq_cpustat_t; | ||
14 | |||
15 | #include <linux/irq_cpustat.h> | ||
16 | |||
17 | /* As this would be very strange for UML to get we BUG() after the | ||
18 | * printk. */ | ||
19 | static inline void ack_bad_irq(unsigned int irq) | ||
20 | { | ||
21 | printk(KERN_ERR "unexpected IRQ %02x\n", irq); | ||
22 | BUG(); | ||
23 | } | ||
24 | |||
25 | #endif /* __ASM_UM_HARDIRQ_H */ | ||
diff --git a/arch/um/include/asm/hw_irq.h b/arch/um/include/asm/hw_irq.h new file mode 100644 index 000000000000..1cf84cf5f21a --- /dev/null +++ b/arch/um/include/asm/hw_irq.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_UM_HW_IRQ_H | ||
2 | #define _ASM_UM_HW_IRQ_H | ||
3 | |||
4 | #include "asm/irq.h" | ||
5 | #include "asm/archparam.h" | ||
6 | |||
7 | #endif | ||
diff --git a/arch/um/include/asm/io.h b/arch/um/include/asm/io.h new file mode 100644 index 000000000000..44e8b8c772ae --- /dev/null +++ b/arch/um/include/asm/io.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef __UM_IO_H | ||
2 | #define __UM_IO_H | ||
3 | |||
4 | #include "asm/page.h" | ||
5 | |||
6 | #define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */ | ||
7 | |||
8 | static inline int inb(unsigned long i) { return(0); } | ||
9 | static inline void outb(char c, unsigned long i) { } | ||
10 | |||
11 | /* | ||
12 | * Change virtual addresses to physical addresses and vv. | ||
13 | * These are pretty trivial | ||
14 | */ | ||
15 | static inline unsigned long virt_to_phys(volatile void * address) | ||
16 | { | ||
17 | return __pa((void *) address); | ||
18 | } | ||
19 | |||
20 | static inline void * phys_to_virt(unsigned long address) | ||
21 | { | ||
22 | return __va(address); | ||
23 | } | ||
24 | |||
25 | /* | ||
26 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
27 | * access | ||
28 | */ | ||
29 | #define xlate_dev_mem_ptr(p) __va(p) | ||
30 | |||
31 | /* | ||
32 | * Convert a virtual cached pointer to an uncached pointer | ||
33 | */ | ||
34 | #define xlate_dev_kmem_ptr(p) p | ||
35 | |||
36 | static inline void writeb(unsigned char b, volatile void __iomem *addr) | ||
37 | { | ||
38 | *(volatile unsigned char __force *) addr = b; | ||
39 | } | ||
40 | static inline void writew(unsigned short b, volatile void __iomem *addr) | ||
41 | { | ||
42 | *(volatile unsigned short __force *) addr = b; | ||
43 | } | ||
44 | static inline void writel(unsigned int b, volatile void __iomem *addr) | ||
45 | { | ||
46 | *(volatile unsigned int __force *) addr = b; | ||
47 | } | ||
48 | static inline void writeq(unsigned int b, volatile void __iomem *addr) | ||
49 | { | ||
50 | *(volatile unsigned long long __force *) addr = b; | ||
51 | } | ||
52 | #define __raw_writeb writeb | ||
53 | #define __raw_writew writew | ||
54 | #define __raw_writel writel | ||
55 | #define __raw_writeq writeq | ||
56 | |||
57 | #endif | ||
diff --git a/arch/um/include/asm/irq.h b/arch/um/include/asm/irq.h new file mode 100644 index 000000000000..4a2037f8204b --- /dev/null +++ b/arch/um/include/asm/irq.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __UM_IRQ_H | ||
2 | #define __UM_IRQ_H | ||
3 | |||
4 | #define TIMER_IRQ 0 | ||
5 | #define UMN_IRQ 1 | ||
6 | #define CONSOLE_IRQ 2 | ||
7 | #define CONSOLE_WRITE_IRQ 3 | ||
8 | #define UBD_IRQ 4 | ||
9 | #define UM_ETH_IRQ 5 | ||
10 | #define SSL_IRQ 6 | ||
11 | #define SSL_WRITE_IRQ 7 | ||
12 | #define ACCEPT_IRQ 8 | ||
13 | #define MCONSOLE_IRQ 9 | ||
14 | #define WINCH_IRQ 10 | ||
15 | #define SIGIO_WRITE_IRQ 11 | ||
16 | #define TELNETD_IRQ 12 | ||
17 | #define XTERM_IRQ 13 | ||
18 | #define RANDOM_IRQ 14 | ||
19 | |||
20 | #define LAST_IRQ RANDOM_IRQ | ||
21 | #define NR_IRQS (LAST_IRQ + 1) | ||
22 | |||
23 | #endif | ||
diff --git a/arch/um/include/asm/irq_regs.h b/arch/um/include/asm/irq_regs.h new file mode 100644 index 000000000000..3dd9c0b70270 --- /dev/null +++ b/arch/um/include/asm/irq_regs.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/irq_regs.h> | |||
diff --git a/arch/um/include/asm/irq_vectors.h b/arch/um/include/asm/irq_vectors.h new file mode 100644 index 000000000000..62ddba6fc733 --- /dev/null +++ b/arch/um/include/asm/irq_vectors.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_IRQ_VECTORS_H | ||
7 | #define __UM_IRQ_VECTORS_H | ||
8 | |||
9 | #endif | ||
10 | |||
11 | /* | ||
12 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
13 | * Emacs will notice this stuff at the end of the file and automatically | ||
14 | * adjust the settings for this buffer only. This must remain at the end | ||
15 | * of the file. | ||
16 | * --------------------------------------------------------------------------- | ||
17 | * Local variables: | ||
18 | * c-file-style: "linux" | ||
19 | * End: | ||
20 | */ | ||
diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h new file mode 100644 index 000000000000..659b9abdfdba --- /dev/null +++ b/arch/um/include/asm/irqflags.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IRQFLAGS_H | ||
2 | #define __UM_IRQFLAGS_H | ||
3 | |||
4 | /* Empty for now */ | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/kdebug.h b/arch/um/include/asm/kdebug.h new file mode 100644 index 000000000000..6ece1b037665 --- /dev/null +++ b/arch/um/include/asm/kdebug.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/kdebug.h> | |||
diff --git a/arch/um/include/asm/kmap_types.h b/arch/um/include/asm/kmap_types.h new file mode 100644 index 000000000000..6c03acdb4405 --- /dev/null +++ b/arch/um/include/asm/kmap_types.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_KMAP_TYPES_H | ||
7 | #define __UM_KMAP_TYPES_H | ||
8 | |||
9 | /* No more #include "asm/arch/kmap_types.h" ! */ | ||
10 | |||
11 | enum km_type { | ||
12 | KM_BOUNCE_READ, | ||
13 | KM_SKB_SUNRPC_DATA, | ||
14 | KM_SKB_DATA_SOFTIRQ, | ||
15 | KM_USER0, | ||
16 | KM_USER1, | ||
17 | KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */ | ||
18 | KM_BIO_SRC_IRQ, | ||
19 | KM_BIO_DST_IRQ, | ||
20 | KM_PTE0, | ||
21 | KM_PTE1, | ||
22 | KM_IRQ0, | ||
23 | KM_IRQ1, | ||
24 | KM_SOFTIRQ0, | ||
25 | KM_SOFTIRQ1, | ||
26 | KM_TYPE_NR | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h new file mode 100644 index 000000000000..2cf35c21d694 --- /dev/null +++ b/arch/um/include/asm/mmu.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __MMU_H | ||
7 | #define __MMU_H | ||
8 | |||
9 | #include "um_mmu.h" | ||
10 | |||
11 | #endif | ||
12 | |||
13 | /* | ||
14 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
15 | * Emacs will notice this stuff at the end of the file and automatically | ||
16 | * adjust the settings for this buffer only. This must remain at the end | ||
17 | * of the file. | ||
18 | * --------------------------------------------------------------------------- | ||
19 | * Local variables: | ||
20 | * c-file-style: "linux" | ||
21 | * End: | ||
22 | */ | ||
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h new file mode 100644 index 000000000000..54f42e8b0105 --- /dev/null +++ b/arch/um/include/asm/mmu_context.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_MMU_CONTEXT_H | ||
7 | #define __UM_MMU_CONTEXT_H | ||
8 | |||
9 | #include "linux/sched.h" | ||
10 | #include "um_mmu.h" | ||
11 | |||
12 | extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); | ||
13 | extern void arch_exit_mmap(struct mm_struct *mm); | ||
14 | |||
15 | #define get_mmu_context(task) do ; while(0) | ||
16 | #define activate_context(tsk) do ; while(0) | ||
17 | |||
18 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
19 | |||
20 | extern void force_flush_all(void); | ||
21 | |||
22 | static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | ||
23 | { | ||
24 | /* | ||
25 | * This is called by fs/exec.c and sys_unshare() | ||
26 | * when the new ->mm is used for the first time. | ||
27 | */ | ||
28 | __switch_mm(&new->context.id); | ||
29 | arch_dup_mmap(old, new); | ||
30 | } | ||
31 | |||
32 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
33 | struct task_struct *tsk) | ||
34 | { | ||
35 | unsigned cpu = smp_processor_id(); | ||
36 | |||
37 | if(prev != next){ | ||
38 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
39 | cpu_set(cpu, next->cpu_vm_mask); | ||
40 | if(next != &init_mm) | ||
41 | __switch_mm(&next->context.id); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | static inline void enter_lazy_tlb(struct mm_struct *mm, | ||
46 | struct task_struct *tsk) | ||
47 | { | ||
48 | } | ||
49 | |||
50 | extern int init_new_context(struct task_struct *task, struct mm_struct *mm); | ||
51 | |||
52 | extern void destroy_context(struct mm_struct *mm); | ||
53 | |||
54 | #endif | ||
diff --git a/arch/um/include/asm/mutex.h b/arch/um/include/asm/mutex.h new file mode 100644 index 000000000000..458c1f7fbc18 --- /dev/null +++ b/arch/um/include/asm/mutex.h | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Pull in the generic implementation for the mutex fastpath. | ||
3 | * | ||
4 | * TODO: implement optimized primitives instead, or leave the generic | ||
5 | * implementation in place, or pick the atomic_xchg() based generic | ||
6 | * implementation. (see asm-generic/mutex-xchg.h for details) | ||
7 | */ | ||
8 | |||
9 | #include <asm-generic/mutex-dec.h> | ||
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h new file mode 100644 index 000000000000..55f28a0bae6d --- /dev/null +++ b/arch/um/include/asm/page.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PAGE_H | ||
8 | #define __UM_PAGE_H | ||
9 | |||
10 | #include <linux/const.h> | ||
11 | |||
12 | /* PAGE_SHIFT determines the page size */ | ||
13 | #define PAGE_SHIFT 12 | ||
14 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) | ||
15 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
16 | |||
17 | #ifndef __ASSEMBLY__ | ||
18 | |||
19 | struct page; | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <sysdep/vm-flags.h> | ||
23 | |||
24 | /* | ||
25 | * These are used to make use of C type-checking.. | ||
26 | */ | ||
27 | |||
28 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
29 | #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) | ||
30 | |||
31 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
32 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
33 | |||
34 | #if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) | ||
35 | |||
36 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | ||
37 | typedef struct { unsigned long pmd; } pmd_t; | ||
38 | typedef struct { unsigned long pgd; } pgd_t; | ||
39 | #define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) | ||
40 | |||
41 | #define pte_get_bits(pte, bits) ((pte).pte_low & (bits)) | ||
42 | #define pte_set_bits(pte, bits) ((pte).pte_low |= (bits)) | ||
43 | #define pte_clear_bits(pte, bits) ((pte).pte_low &= ~(bits)) | ||
44 | #define pte_copy(to, from) ({ (to).pte_high = (from).pte_high; \ | ||
45 | smp_wmb(); \ | ||
46 | (to).pte_low = (from).pte_low; }) | ||
47 | #define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high) | ||
48 | #define pte_set_val(pte, phys, prot) \ | ||
49 | ({ (pte).pte_high = (phys) >> 32; \ | ||
50 | (pte).pte_low = (phys) | pgprot_val(prot); }) | ||
51 | |||
52 | #define pmd_val(x) ((x).pmd) | ||
53 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
54 | |||
55 | typedef unsigned long long pfn_t; | ||
56 | typedef unsigned long long phys_t; | ||
57 | |||
58 | #else | ||
59 | |||
60 | typedef struct { unsigned long pte; } pte_t; | ||
61 | typedef struct { unsigned long pgd; } pgd_t; | ||
62 | |||
63 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
64 | typedef struct { unsigned long pmd; } pmd_t; | ||
65 | #define pmd_val(x) ((x).pmd) | ||
66 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
67 | #endif | ||
68 | |||
69 | #define pte_val(x) ((x).pte) | ||
70 | |||
71 | |||
72 | #define pte_get_bits(p, bits) ((p).pte & (bits)) | ||
73 | #define pte_set_bits(p, bits) ((p).pte |= (bits)) | ||
74 | #define pte_clear_bits(p, bits) ((p).pte &= ~(bits)) | ||
75 | #define pte_copy(to, from) ((to).pte = (from).pte) | ||
76 | #define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE)) | ||
77 | #define pte_set_val(p, phys, prot) (p).pte = (phys | pgprot_val(prot)) | ||
78 | |||
79 | typedef unsigned long pfn_t; | ||
80 | typedef unsigned long phys_t; | ||
81 | |||
82 | #endif | ||
83 | |||
84 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
85 | |||
86 | typedef struct page *pgtable_t; | ||
87 | |||
88 | #define pgd_val(x) ((x).pgd) | ||
89 | #define pgprot_val(x) ((x).pgprot) | ||
90 | |||
91 | #define __pte(x) ((pte_t) { (x) } ) | ||
92 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
93 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
94 | |||
95 | extern unsigned long uml_physmem; | ||
96 | |||
97 | #define PAGE_OFFSET (uml_physmem) | ||
98 | #define KERNELBASE PAGE_OFFSET | ||
99 | |||
100 | #define __va_space (8*1024*1024) | ||
101 | |||
102 | #include "mem.h" | ||
103 | |||
104 | /* Cast to unsigned long before casting to void * to avoid a warning from | ||
105 | * mmap_kmem about cutting a long long down to a void *. Not sure that | ||
106 | * casting is the right thing, but 32-bit UML can't have 64-bit virtual | ||
107 | * addresses | ||
108 | */ | ||
109 | #define __pa(virt) to_phys((void *) (unsigned long) (virt)) | ||
110 | #define __va(phys) to_virt((unsigned long) (phys)) | ||
111 | |||
112 | #define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT)) | ||
113 | #define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT)) | ||
114 | |||
115 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
116 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) | ||
117 | |||
118 | #include <asm-generic/memory_model.h> | ||
119 | #include <asm-generic/page.h> | ||
120 | |||
121 | #endif /* __ASSEMBLY__ */ | ||
122 | #endif /* __UM_PAGE_H */ | ||
diff --git a/arch/um/include/asm/page_offset.h b/arch/um/include/asm/page_offset.h new file mode 100644 index 000000000000..1c168dfbf359 --- /dev/null +++ b/arch/um/include/asm/page_offset.h | |||
@@ -0,0 +1 @@ | |||
#define PAGE_OFFSET_RAW (uml_physmem) | |||
diff --git a/arch/um/include/asm/param.h b/arch/um/include/asm/param.h new file mode 100644 index 000000000000..e44f4e60d16d --- /dev/null +++ b/arch/um/include/asm/param.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _UM_PARAM_H | ||
2 | #define _UM_PARAM_H | ||
3 | |||
4 | #define EXEC_PAGESIZE 4096 | ||
5 | |||
6 | #ifndef NOGROUP | ||
7 | #define NOGROUP (-1) | ||
8 | #endif | ||
9 | |||
10 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | #define HZ CONFIG_HZ | ||
14 | #define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
15 | #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ | ||
16 | #else | ||
17 | #define HZ 100 | ||
18 | #endif | ||
19 | |||
20 | #endif | ||
diff --git a/arch/um/include/asm/pci.h b/arch/um/include/asm/pci.h new file mode 100644 index 000000000000..59923199cdc3 --- /dev/null +++ b/arch/um/include/asm/pci.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __UM_PCI_H | ||
2 | #define __UM_PCI_H | ||
3 | |||
4 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
5 | #define pcibios_scan_all_fns(a, b) 0 | ||
6 | |||
7 | #endif | ||
diff --git a/arch/um/include/asm/pda.h b/arch/um/include/asm/pda.h new file mode 100644 index 000000000000..0d8bf33ffd42 --- /dev/null +++ b/arch/um/include/asm/pda.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PDA_X86_64_H | ||
8 | #define __UM_PDA_X86_64_H | ||
9 | |||
10 | /* XXX */ | ||
11 | struct foo { | ||
12 | unsigned int __softirq_pending; | ||
13 | unsigned int __nmi_count; | ||
14 | }; | ||
15 | |||
16 | extern struct foo me; | ||
17 | |||
18 | #define read_pda(me) (&me) | ||
19 | |||
20 | #endif | ||
21 | |||
22 | /* | ||
23 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
24 | * Emacs will notice this stuff at the end of the file and automatically | ||
25 | * adjust the settings for this buffer only. This must remain at the end | ||
26 | * of the file. | ||
27 | * --------------------------------------------------------------------------- | ||
28 | * Local variables: | ||
29 | * c-file-style: "linux" | ||
30 | * End: | ||
31 | */ | ||
diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h new file mode 100644 index 000000000000..9062a6e72241 --- /dev/null +++ b/arch/um/include/asm/pgalloc.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h | ||
5 | * Licensed under the GPL | ||
6 | */ | ||
7 | |||
8 | #ifndef __UM_PGALLOC_H | ||
9 | #define __UM_PGALLOC_H | ||
10 | |||
11 | #include "linux/mm.h" | ||
12 | #include "asm/fixmap.h" | ||
13 | |||
14 | #define pmd_populate_kernel(mm, pmd, pte) \ | ||
15 | set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) | ||
16 | |||
17 | #define pmd_populate(mm, pmd, pte) \ | ||
18 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ | ||
19 | ((unsigned long long)page_to_pfn(pte) << \ | ||
20 | (unsigned long long) PAGE_SHIFT))) | ||
21 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
22 | |||
23 | /* | ||
24 | * Allocate and free page tables. | ||
25 | */ | ||
26 | extern pgd_t *pgd_alloc(struct mm_struct *); | ||
27 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); | ||
28 | |||
29 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); | ||
30 | extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long); | ||
31 | |||
32 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
33 | { | ||
34 | free_page((unsigned long) pte); | ||
35 | } | ||
36 | |||
37 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
38 | { | ||
39 | pgtable_page_dtor(pte); | ||
40 | __free_page(pte); | ||
41 | } | ||
42 | |||
43 | #define __pte_free_tlb(tlb,pte) \ | ||
44 | do { \ | ||
45 | pgtable_page_dtor(pte); \ | ||
46 | tlb_remove_page((tlb),(pte)); \ | ||
47 | } while (0) | ||
48 | |||
49 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
50 | |||
51 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | ||
52 | { | ||
53 | free_page((unsigned long)pmd); | ||
54 | } | ||
55 | |||
56 | #define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x)) | ||
57 | #endif | ||
58 | |||
59 | #define check_pgt_cache() do { } while (0) | ||
60 | |||
61 | #endif | ||
62 | |||
63 | /* | ||
64 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
65 | * Emacs will notice this stuff at the end of the file and automatically | ||
66 | * adjust the settings for this buffer only. This must remain at the end | ||
67 | * of the file. | ||
68 | * --------------------------------------------------------------------------- | ||
69 | * Local variables: | ||
70 | * c-file-style: "linux" | ||
71 | * End: | ||
72 | */ | ||
diff --git a/arch/um/include/asm/pgtable-2level.h b/arch/um/include/asm/pgtable-2level.h new file mode 100644 index 000000000000..f534b73e753e --- /dev/null +++ b/arch/um/include/asm/pgtable-2level.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Derived from include/asm-i386/pgtable.h | ||
5 | * Licensed under the GPL | ||
6 | */ | ||
7 | |||
8 | #ifndef __UM_PGTABLE_2LEVEL_H | ||
9 | #define __UM_PGTABLE_2LEVEL_H | ||
10 | |||
11 | #include <asm-generic/pgtable-nopmd.h> | ||
12 | |||
13 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
14 | |||
15 | #define PGDIR_SHIFT 22 | ||
16 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
17 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
18 | |||
19 | /* | ||
20 | * entries per page directory level: the i386 is two-level, so | ||
21 | * we don't really have any PMD directory physically. | ||
22 | */ | ||
23 | #define PTRS_PER_PTE 1024 | ||
24 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
25 | #define PTRS_PER_PGD 1024 | ||
26 | #define FIRST_USER_ADDRESS 0 | ||
27 | |||
28 | #define pte_ERROR(e) \ | ||
29 | printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \ | ||
30 | pte_val(e)) | ||
31 | #define pgd_ERROR(e) \ | ||
32 | printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \ | ||
33 | pgd_val(e)) | ||
34 | |||
35 | static inline int pgd_newpage(pgd_t pgd) { return 0; } | ||
36 | static inline void pgd_mkuptodate(pgd_t pgd) { } | ||
37 | |||
38 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) | ||
39 | |||
40 | #define pte_pfn(x) phys_to_pfn(pte_val(x)) | ||
41 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) | ||
42 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) | ||
43 | |||
44 | /* | ||
45 | * Bits 0 through 4 are taken | ||
46 | */ | ||
47 | #define PTE_FILE_MAX_BITS 27 | ||
48 | |||
49 | #define pte_to_pgoff(pte) (pte_val(pte) >> 5) | ||
50 | |||
51 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE }) | ||
52 | |||
53 | #endif | ||
diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h new file mode 100644 index 000000000000..0446f456b428 --- /dev/null +++ b/arch/um/include/asm/pgtable-3level.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale Inc | ||
3 | * Derived from include/asm-i386/pgtable.h | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PGTABLE_3LEVEL_H | ||
8 | #define __UM_PGTABLE_3LEVEL_H | ||
9 | |||
10 | #include <asm-generic/pgtable-nopud.h> | ||
11 | |||
12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
13 | |||
14 | #ifdef CONFIG_64BIT | ||
15 | #define PGDIR_SHIFT 30 | ||
16 | #else | ||
17 | #define PGDIR_SHIFT 31 | ||
18 | #endif | ||
19 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
20 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
21 | |||
22 | /* PMD_SHIFT determines the size of the area a second-level page table can | ||
23 | * map | ||
24 | */ | ||
25 | |||
26 | #define PMD_SHIFT 21 | ||
27 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
28 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
29 | |||
30 | /* | ||
31 | * entries per page directory level | ||
32 | */ | ||
33 | |||
34 | #define PTRS_PER_PTE 512 | ||
35 | #ifdef CONFIG_64BIT | ||
36 | #define PTRS_PER_PMD 512 | ||
37 | #define PTRS_PER_PGD 512 | ||
38 | #else | ||
39 | #define PTRS_PER_PMD 1024 | ||
40 | #define PTRS_PER_PGD 1024 | ||
41 | #endif | ||
42 | |||
43 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
44 | #define FIRST_USER_ADDRESS 0 | ||
45 | |||
46 | #define pte_ERROR(e) \ | ||
47 | printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
48 | pte_val(e)) | ||
49 | #define pmd_ERROR(e) \ | ||
50 | printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
51 | pmd_val(e)) | ||
52 | #define pgd_ERROR(e) \ | ||
53 | printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
54 | pgd_val(e)) | ||
55 | |||
56 | #define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE)) | ||
57 | #define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | ||
58 | #define pud_present(x) (pud_val(x) & _PAGE_PRESENT) | ||
59 | #define pud_populate(mm, pud, pmd) \ | ||
60 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) | ||
61 | |||
62 | #ifdef CONFIG_64BIT | ||
63 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) | ||
64 | #else | ||
65 | #define set_pud(pudptr, pudval) (*(pudptr) = (pudval)) | ||
66 | #endif | ||
67 | |||
68 | static inline int pgd_newpage(pgd_t pgd) | ||
69 | { | ||
70 | return(pgd_val(pgd) & _PAGE_NEWPAGE); | ||
71 | } | ||
72 | |||
73 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } | ||
74 | |||
75 | #ifdef CONFIG_64BIT | ||
76 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) | ||
77 | #else | ||
78 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) | ||
79 | #endif | ||
80 | |||
81 | struct mm_struct; | ||
82 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); | ||
83 | |||
84 | static inline void pud_clear (pud_t *pud) | ||
85 | { | ||
86 | set_pud(pud, __pud(_PAGE_NEWPAGE)); | ||
87 | } | ||
88 | |||
89 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) | ||
90 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) | ||
91 | |||
92 | /* Find an entry in the second-level page table.. */ | ||
93 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ | ||
94 | pmd_index(address)) | ||
95 | |||
96 | static inline unsigned long pte_pfn(pte_t pte) | ||
97 | { | ||
98 | return phys_to_pfn(pte_val(pte)); | ||
99 | } | ||
100 | |||
101 | static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot) | ||
102 | { | ||
103 | pte_t pte; | ||
104 | phys_t phys = pfn_to_phys(page_nr); | ||
105 | |||
106 | pte_set_val(pte, phys, pgprot); | ||
107 | return pte; | ||
108 | } | ||
109 | |||
110 | static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot) | ||
111 | { | ||
112 | return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Bits 0 through 3 are taken in the low part of the pte, | ||
117 | * put the 32 bits of offset into the high part. | ||
118 | */ | ||
119 | #define PTE_FILE_MAX_BITS 32 | ||
120 | |||
121 | #ifdef CONFIG_64BIT | ||
122 | |||
123 | #define pte_to_pgoff(p) ((p).pte >> 32) | ||
124 | |||
125 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE }) | ||
126 | |||
127 | #else | ||
128 | |||
129 | #define pte_to_pgoff(pte) ((pte).pte_high) | ||
130 | |||
131 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) | ||
132 | |||
133 | #endif | ||
134 | |||
135 | #endif | ||
136 | |||
137 | /* | ||
138 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
139 | * Emacs will notice this stuff at the end of the file and automatically | ||
140 | * adjust the settings for this buffer only. This must remain at the end | ||
141 | * of the file. | ||
142 | * --------------------------------------------------------------------------- | ||
143 | * Local variables: | ||
144 | * c-file-style: "linux" | ||
145 | * End: | ||
146 | */ | ||
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h new file mode 100644 index 000000000000..58da2480a7f4 --- /dev/null +++ b/arch/um/include/asm/pgtable.h | |||
@@ -0,0 +1,366 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Derived from include/asm-i386/pgtable.h | ||
5 | * Licensed under the GPL | ||
6 | */ | ||
7 | |||
8 | #ifndef __UM_PGTABLE_H | ||
9 | #define __UM_PGTABLE_H | ||
10 | |||
11 | #include <asm/fixmap.h> | ||
12 | |||
13 | #define _PAGE_PRESENT 0x001 | ||
14 | #define _PAGE_NEWPAGE 0x002 | ||
15 | #define _PAGE_NEWPROT 0x004 | ||
16 | #define _PAGE_RW 0x020 | ||
17 | #define _PAGE_USER 0x040 | ||
18 | #define _PAGE_ACCESSED 0x080 | ||
19 | #define _PAGE_DIRTY 0x100 | ||
20 | /* If _PAGE_PRESENT is clear, we use these: */ | ||
21 | #define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */ | ||
22 | #define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE; | ||
23 | pte_present gives true */ | ||
24 | |||
25 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
26 | #include "asm/pgtable-3level.h" | ||
27 | #else | ||
28 | #include "asm/pgtable-2level.h" | ||
29 | #endif | ||
30 | |||
31 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
32 | |||
33 | /* zero page used for uninitialized stuff */ | ||
34 | extern unsigned long *empty_zero_page; | ||
35 | |||
36 | #define pgtable_cache_init() do ; while (0) | ||
37 | |||
38 | /* Just any arbitrary offset to the start of the vmalloc VM area: the | ||
39 | * current 8MB value just means that there will be a 8MB "hole" after the | ||
40 | * physical memory until the kernel virtual memory starts. That means that | ||
41 | * any out-of-bounds memory accesses will hopefully be caught. | ||
42 | * The vmalloc() routines leaves a hole of 4kB between each vmalloced | ||
43 | * area for the same reason. ;) | ||
44 | */ | ||
45 | |||
46 | extern unsigned long end_iomem; | ||
47 | |||
48 | #define VMALLOC_OFFSET (__va_space) | ||
49 | #define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) | ||
50 | #define PKMAP_BASE ((FIXADDR_START - LAST_PKMAP * PAGE_SIZE) & PMD_MASK) | ||
51 | #ifdef CONFIG_HIGHMEM | ||
52 | # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) | ||
53 | #else | ||
54 | # define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) | ||
55 | #endif | ||
56 | |||
57 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
58 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
59 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
60 | |||
61 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) | ||
62 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) | ||
63 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) | ||
64 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) | ||
65 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) | ||
66 | |||
67 | /* | ||
68 | * The i386 can't do page protection for execute, and considers that the same | ||
69 | * are read. | ||
70 | * Also, write permissions imply read permissions. This is the closest we can | ||
71 | * get.. | ||
72 | */ | ||
73 | #define __P000 PAGE_NONE | ||
74 | #define __P001 PAGE_READONLY | ||
75 | #define __P010 PAGE_COPY | ||
76 | #define __P011 PAGE_COPY | ||
77 | #define __P100 PAGE_READONLY | ||
78 | #define __P101 PAGE_READONLY | ||
79 | #define __P110 PAGE_COPY | ||
80 | #define __P111 PAGE_COPY | ||
81 | |||
82 | #define __S000 PAGE_NONE | ||
83 | #define __S001 PAGE_READONLY | ||
84 | #define __S010 PAGE_SHARED | ||
85 | #define __S011 PAGE_SHARED | ||
86 | #define __S100 PAGE_READONLY | ||
87 | #define __S101 PAGE_READONLY | ||
88 | #define __S110 PAGE_SHARED | ||
89 | #define __S111 PAGE_SHARED | ||
90 | |||
91 | /* | ||
92 | * ZERO_PAGE is a global shared page that is always zero: used | ||
93 | * for zero-mapped memory areas etc.. | ||
94 | */ | ||
95 | #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) | ||
96 | |||
97 | #define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE)) | ||
98 | |||
99 | #define pmd_none(x) (!((unsigned long)pmd_val(x) & ~_PAGE_NEWPAGE)) | ||
100 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | ||
101 | |||
102 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | ||
103 | #define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0) | ||
104 | |||
105 | #define pmd_newpage(x) (pmd_val(x) & _PAGE_NEWPAGE) | ||
106 | #define pmd_mkuptodate(x) (pmd_val(x) &= ~_PAGE_NEWPAGE) | ||
107 | |||
108 | #define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE) | ||
109 | #define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE) | ||
110 | |||
111 | #define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK) | ||
112 | |||
113 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
114 | |||
115 | #define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE)) | ||
116 | |||
117 | /* | ||
118 | * ================================= | ||
119 | * Flags checking section. | ||
120 | * ================================= | ||
121 | */ | ||
122 | |||
123 | static inline int pte_none(pte_t pte) | ||
124 | { | ||
125 | return pte_is_zero(pte); | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * The following only work if pte_present() is true. | ||
130 | * Undefined behaviour if not.. | ||
131 | */ | ||
132 | static inline int pte_read(pte_t pte) | ||
133 | { | ||
134 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
135 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
136 | } | ||
137 | |||
138 | static inline int pte_exec(pte_t pte){ | ||
139 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
140 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
141 | } | ||
142 | |||
143 | static inline int pte_write(pte_t pte) | ||
144 | { | ||
145 | return((pte_get_bits(pte, _PAGE_RW)) && | ||
146 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * The following only works if pte_present() is not true. | ||
151 | */ | ||
152 | static inline int pte_file(pte_t pte) | ||
153 | { | ||
154 | return pte_get_bits(pte, _PAGE_FILE); | ||
155 | } | ||
156 | |||
157 | static inline int pte_dirty(pte_t pte) | ||
158 | { | ||
159 | return pte_get_bits(pte, _PAGE_DIRTY); | ||
160 | } | ||
161 | |||
162 | static inline int pte_young(pte_t pte) | ||
163 | { | ||
164 | return pte_get_bits(pte, _PAGE_ACCESSED); | ||
165 | } | ||
166 | |||
167 | static inline int pte_newpage(pte_t pte) | ||
168 | { | ||
169 | return pte_get_bits(pte, _PAGE_NEWPAGE); | ||
170 | } | ||
171 | |||
172 | static inline int pte_newprot(pte_t pte) | ||
173 | { | ||
174 | return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT))); | ||
175 | } | ||
176 | |||
177 | static inline int pte_special(pte_t pte) | ||
178 | { | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * ================================= | ||
184 | * Flags setting section. | ||
185 | * ================================= | ||
186 | */ | ||
187 | |||
188 | static inline pte_t pte_mknewprot(pte_t pte) | ||
189 | { | ||
190 | pte_set_bits(pte, _PAGE_NEWPROT); | ||
191 | return(pte); | ||
192 | } | ||
193 | |||
194 | static inline pte_t pte_mkclean(pte_t pte) | ||
195 | { | ||
196 | pte_clear_bits(pte, _PAGE_DIRTY); | ||
197 | return(pte); | ||
198 | } | ||
199 | |||
200 | static inline pte_t pte_mkold(pte_t pte) | ||
201 | { | ||
202 | pte_clear_bits(pte, _PAGE_ACCESSED); | ||
203 | return(pte); | ||
204 | } | ||
205 | |||
206 | static inline pte_t pte_wrprotect(pte_t pte) | ||
207 | { | ||
208 | pte_clear_bits(pte, _PAGE_RW); | ||
209 | return(pte_mknewprot(pte)); | ||
210 | } | ||
211 | |||
212 | static inline pte_t pte_mkread(pte_t pte) | ||
213 | { | ||
214 | pte_set_bits(pte, _PAGE_USER); | ||
215 | return(pte_mknewprot(pte)); | ||
216 | } | ||
217 | |||
218 | static inline pte_t pte_mkdirty(pte_t pte) | ||
219 | { | ||
220 | pte_set_bits(pte, _PAGE_DIRTY); | ||
221 | return(pte); | ||
222 | } | ||
223 | |||
224 | static inline pte_t pte_mkyoung(pte_t pte) | ||
225 | { | ||
226 | pte_set_bits(pte, _PAGE_ACCESSED); | ||
227 | return(pte); | ||
228 | } | ||
229 | |||
230 | static inline pte_t pte_mkwrite(pte_t pte) | ||
231 | { | ||
232 | pte_set_bits(pte, _PAGE_RW); | ||
233 | return(pte_mknewprot(pte)); | ||
234 | } | ||
235 | |||
236 | static inline pte_t pte_mkuptodate(pte_t pte) | ||
237 | { | ||
238 | pte_clear_bits(pte, _PAGE_NEWPAGE); | ||
239 | if(pte_present(pte)) | ||
240 | pte_clear_bits(pte, _PAGE_NEWPROT); | ||
241 | return(pte); | ||
242 | } | ||
243 | |||
244 | static inline pte_t pte_mknewpage(pte_t pte) | ||
245 | { | ||
246 | pte_set_bits(pte, _PAGE_NEWPAGE); | ||
247 | return(pte); | ||
248 | } | ||
249 | |||
250 | static inline pte_t pte_mkspecial(pte_t pte) | ||
251 | { | ||
252 | return(pte); | ||
253 | } | ||
254 | |||
255 | static inline void set_pte(pte_t *pteptr, pte_t pteval) | ||
256 | { | ||
257 | pte_copy(*pteptr, pteval); | ||
258 | |||
259 | /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so | ||
260 | * fix_range knows to unmap it. _PAGE_NEWPROT is specific to | ||
261 | * mapped pages. | ||
262 | */ | ||
263 | |||
264 | *pteptr = pte_mknewpage(*pteptr); | ||
265 | if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr); | ||
266 | } | ||
267 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
268 | |||
269 | /* | ||
270 | * Conversion functions: convert a page and protection to a page entry, | ||
271 | * and a page entry and page directory to the page they refer to. | ||
272 | */ | ||
273 | |||
274 | #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) | ||
275 | #define __virt_to_page(virt) phys_to_page(__pa(virt)) | ||
276 | #define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page)) | ||
277 | #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) | ||
278 | |||
279 | #define mk_pte(page, pgprot) \ | ||
280 | ({ pte_t pte; \ | ||
281 | \ | ||
282 | pte_set_val(pte, page_to_phys(page), (pgprot)); \ | ||
283 | if (pte_present(pte)) \ | ||
284 | pte_mknewprot(pte_mknewpage(pte)); \ | ||
285 | pte;}) | ||
286 | |||
287 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
288 | { | ||
289 | pte_set_val(pte, (pte_val(pte) & _PAGE_CHG_MASK), newprot); | ||
290 | return pte; | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | ||
295 | * | ||
296 | * this macro returns the index of the entry in the pgd page which would | ||
297 | * control the given virtual address | ||
298 | */ | ||
299 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
300 | |||
301 | /* | ||
302 | * pgd_offset() returns a (pgd_t *) | ||
303 | * pgd_index() is used get the offset into the pgd page's array of pgd_t's; | ||
304 | */ | ||
305 | #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) | ||
306 | |||
307 | /* | ||
308 | * a shortcut which implies the use of the kernel's pgd, instead | ||
309 | * of a process's | ||
310 | */ | ||
311 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
312 | |||
313 | /* | ||
314 | * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] | ||
315 | * | ||
316 | * this macro returns the index of the entry in the pmd page which would | ||
317 | * control the given virtual address | ||
318 | */ | ||
319 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
320 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | ||
321 | |||
322 | #define pmd_page_vaddr(pmd) \ | ||
323 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
324 | |||
325 | /* | ||
326 | * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] | ||
327 | * | ||
328 | * this macro returns the index of the entry in the pte page which would | ||
329 | * control the given virtual address | ||
330 | */ | ||
331 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
332 | #define pte_offset_kernel(dir, address) \ | ||
333 | ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) | ||
334 | #define pte_offset_map(dir, address) \ | ||
335 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | ||
336 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | ||
337 | #define pte_unmap(pte) do { } while (0) | ||
338 | #define pte_unmap_nested(pte) do { } while (0) | ||
339 | |||
340 | struct mm_struct; | ||
341 | extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); | ||
342 | |||
343 | #define update_mmu_cache(vma,address,pte) do ; while (0) | ||
344 | |||
345 | /* Encode and de-code a swap entry */ | ||
346 | #define __swp_type(x) (((x).val >> 4) & 0x3f) | ||
347 | #define __swp_offset(x) ((x).val >> 11) | ||
348 | |||
349 | #define __swp_entry(type, offset) \ | ||
350 | ((swp_entry_t) { ((type) << 4) | ((offset) << 11) }) | ||
351 | #define __pte_to_swp_entry(pte) \ | ||
352 | ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) }) | ||
353 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
354 | |||
355 | #define kern_addr_valid(addr) (1) | ||
356 | |||
357 | #include <asm-generic/pgtable.h> | ||
358 | |||
359 | /* Clear a kernel PTE and flush it from the TLB */ | ||
360 | #define kpte_clear_flush(ptep, vaddr) \ | ||
361 | do { \ | ||
362 | pte_clear(&init_mm, (vaddr), (ptep)); \ | ||
363 | __flush_tlb_one((vaddr)); \ | ||
364 | } while (0) | ||
365 | |||
366 | #endif | ||
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h new file mode 100644 index 000000000000..bed668824b5f --- /dev/null +++ b/arch/um/include/asm/processor-generic.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PROCESSOR_GENERIC_H | ||
7 | #define __UM_PROCESSOR_GENERIC_H | ||
8 | |||
9 | struct pt_regs; | ||
10 | |||
11 | struct task_struct; | ||
12 | |||
13 | #include "asm/ptrace.h" | ||
14 | #include "registers.h" | ||
15 | #include "sysdep/archsetjmp.h" | ||
16 | |||
17 | struct mm_struct; | ||
18 | |||
19 | struct thread_struct { | ||
20 | struct task_struct *saved_task; | ||
21 | /* | ||
22 | * This flag is set to 1 before calling do_fork (and analyzed in | ||
23 | * copy_thread) to mark that we are begin called from userspace (fork / | ||
24 | * vfork / clone), and reset to 0 after. It is left to 0 when called | ||
25 | * from kernelspace (i.e. kernel_thread() or fork_idle(), | ||
26 | * as of 2.6.11). | ||
27 | */ | ||
28 | int forking; | ||
29 | struct pt_regs regs; | ||
30 | int singlestep_syscall; | ||
31 | void *fault_addr; | ||
32 | jmp_buf *fault_catcher; | ||
33 | struct task_struct *prev_sched; | ||
34 | unsigned long temp_stack; | ||
35 | jmp_buf *exec_buf; | ||
36 | struct arch_thread arch; | ||
37 | jmp_buf switch_buf; | ||
38 | int mm_count; | ||
39 | struct { | ||
40 | int op; | ||
41 | union { | ||
42 | struct { | ||
43 | int pid; | ||
44 | } fork, exec; | ||
45 | struct { | ||
46 | int (*proc)(void *); | ||
47 | void *arg; | ||
48 | } thread; | ||
49 | struct { | ||
50 | void (*proc)(void *); | ||
51 | void *arg; | ||
52 | } cb; | ||
53 | } u; | ||
54 | } request; | ||
55 | }; | ||
56 | |||
57 | #define INIT_THREAD \ | ||
58 | { \ | ||
59 | .forking = 0, \ | ||
60 | .regs = EMPTY_REGS, \ | ||
61 | .fault_addr = NULL, \ | ||
62 | .prev_sched = NULL, \ | ||
63 | .temp_stack = 0, \ | ||
64 | .exec_buf = NULL, \ | ||
65 | .arch = INIT_ARCH_THREAD, \ | ||
66 | .request = { 0 } \ | ||
67 | } | ||
68 | |||
69 | extern struct task_struct *alloc_task_struct(void); | ||
70 | |||
71 | static inline void release_thread(struct task_struct *task) | ||
72 | { | ||
73 | } | ||
74 | |||
75 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
76 | |||
77 | static inline void prepare_to_copy(struct task_struct *tsk) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | |||
82 | extern unsigned long thread_saved_pc(struct task_struct *t); | ||
83 | |||
84 | static inline void mm_copy_segments(struct mm_struct *from_mm, | ||
85 | struct mm_struct *new_mm) | ||
86 | { | ||
87 | } | ||
88 | |||
89 | #define init_stack (init_thread_union.stack) | ||
90 | |||
91 | /* | ||
92 | * User space process size: 3GB (default). | ||
93 | */ | ||
94 | extern unsigned long task_size; | ||
95 | |||
96 | #define TASK_SIZE (task_size) | ||
97 | |||
98 | #undef STACK_TOP | ||
99 | #undef STACK_TOP_MAX | ||
100 | |||
101 | extern unsigned long stacksizelim; | ||
102 | |||
103 | #define STACK_ROOM (stacksizelim) | ||
104 | #define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE) | ||
105 | #define STACK_TOP_MAX STACK_TOP | ||
106 | |||
107 | /* This decides where the kernel will search for a free chunk of vm | ||
108 | * space during mmap's. | ||
109 | */ | ||
110 | #define TASK_UNMAPPED_BASE (0x40000000) | ||
111 | |||
112 | extern void start_thread(struct pt_regs *regs, unsigned long entry, | ||
113 | unsigned long stack); | ||
114 | |||
115 | struct cpuinfo_um { | ||
116 | unsigned long loops_per_jiffy; | ||
117 | int ipi_pipe[2]; | ||
118 | }; | ||
119 | |||
120 | extern struct cpuinfo_um boot_cpu_data; | ||
121 | |||
122 | #define my_cpu_data cpu_data[smp_processor_id()] | ||
123 | |||
124 | #ifdef CONFIG_SMP | ||
125 | extern struct cpuinfo_um cpu_data[]; | ||
126 | #define current_cpu_data cpu_data[smp_processor_id()] | ||
127 | #else | ||
128 | #define cpu_data (&boot_cpu_data) | ||
129 | #define current_cpu_data boot_cpu_data | ||
130 | #endif | ||
131 | |||
132 | |||
133 | #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) | ||
134 | extern unsigned long get_wchan(struct task_struct *p); | ||
135 | |||
136 | #endif | ||
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h new file mode 100644 index 000000000000..6c8899013c92 --- /dev/null +++ b/arch/um/include/asm/ptrace-generic.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PTRACE_GENERIC_H | ||
7 | #define __UM_PTRACE_GENERIC_H | ||
8 | |||
9 | #ifndef __ASSEMBLY__ | ||
10 | |||
11 | #include <asm/ptrace-abi.h> | ||
12 | #include <asm/user.h> | ||
13 | #include "sysdep/ptrace.h" | ||
14 | |||
15 | struct pt_regs { | ||
16 | struct uml_pt_regs regs; | ||
17 | }; | ||
18 | |||
19 | #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS } | ||
20 | |||
21 | #define PT_REGS_IP(r) UPT_IP(&(r)->regs) | ||
22 | #define PT_REGS_SP(r) UPT_SP(&(r)->regs) | ||
23 | |||
24 | #define PT_REG(r, reg) UPT_REG(&(r)->regs, reg) | ||
25 | #define PT_REGS_SET(r, reg, val) UPT_SET(&(r)->regs, reg, val) | ||
26 | |||
27 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) \ | ||
28 | UPT_SET_SYSCALL_RETURN(&(r)->regs, res) | ||
29 | #define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs) | ||
30 | |||
31 | #define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs) | ||
32 | |||
33 | #define PT_REGS_SC(r) UPT_SC(&(r)->regs) | ||
34 | |||
35 | #define instruction_pointer(regs) PT_REGS_IP(regs) | ||
36 | |||
37 | struct task_struct; | ||
38 | |||
39 | extern long subarch_ptrace(struct task_struct *child, long request, long addr, | ||
40 | long data); | ||
41 | extern unsigned long getreg(struct task_struct *child, int regno); | ||
42 | extern int putreg(struct task_struct *child, int regno, unsigned long value); | ||
43 | extern int get_fpregs(struct user_i387_struct __user *buf, | ||
44 | struct task_struct *child); | ||
45 | extern int set_fpregs(struct user_i387_struct __user *buf, | ||
46 | struct task_struct *child); | ||
47 | |||
48 | extern void show_regs(struct pt_regs *regs); | ||
49 | |||
50 | extern int arch_copy_tls(struct task_struct *new); | ||
51 | extern void clear_flushed_tls(struct task_struct *task); | ||
52 | |||
53 | #endif | ||
54 | |||
55 | #endif | ||
diff --git a/arch/um/include/asm/required-features.h b/arch/um/include/asm/required-features.h new file mode 100644 index 000000000000..dfb967b2d2f3 --- /dev/null +++ b/arch/um/include/asm/required-features.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __UM_REQUIRED_FEATURES_H | ||
2 | #define __UM_REQUIRED_FEATURES_H | ||
3 | |||
4 | /* | ||
5 | * Nothing to see, just need something for the i386 and x86_64 asm | ||
6 | * headers to include. | ||
7 | */ | ||
8 | |||
9 | #endif | ||
diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h new file mode 100644 index 000000000000..6b0231eefea8 --- /dev/null +++ b/arch/um/include/asm/sections.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _UM_SECTIONS_H | ||
2 | #define _UM_SECTIONS_H | ||
3 | |||
4 | /* nothing to see, move along */ | ||
5 | #include <asm-generic/sections.h> | ||
6 | |||
7 | #endif | ||
diff --git a/arch/um/include/asm/segment.h b/arch/um/include/asm/segment.h new file mode 100644 index 000000000000..45183fcd10b6 --- /dev/null +++ b/arch/um/include/asm/segment.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_SEGMENT_H | ||
2 | #define __UM_SEGMENT_H | ||
3 | |||
4 | extern int host_gdt_entry_tls_min; | ||
5 | |||
6 | #define GDT_ENTRY_TLS_ENTRIES 3 | ||
7 | #define GDT_ENTRY_TLS_MIN host_gdt_entry_tls_min | ||
8 | #define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) | ||
9 | |||
10 | #endif | ||
diff --git a/arch/um/include/asm/setup.h b/arch/um/include/asm/setup.h new file mode 100644 index 000000000000..99f086301f4c --- /dev/null +++ b/arch/um/include/asm/setup.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef SETUP_H_INCLUDED | ||
2 | #define SETUP_H_INCLUDED | ||
3 | |||
4 | /* POSIX mandated with _POSIX_ARG_MAX that we can rely on 4096 chars in the | ||
5 | * command line, so this choice is ok. | ||
6 | */ | ||
7 | |||
8 | #define COMMAND_LINE_SIZE 4096 | ||
9 | |||
10 | #endif /* SETUP_H_INCLUDED */ | ||
diff --git a/arch/um/include/asm/smp.h b/arch/um/include/asm/smp.h new file mode 100644 index 000000000000..f27a96313174 --- /dev/null +++ b/arch/um/include/asm/smp.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __UM_SMP_H | ||
2 | #define __UM_SMP_H | ||
3 | |||
4 | #ifdef CONFIG_SMP | ||
5 | |||
6 | #include "linux/bitops.h" | ||
7 | #include "asm/current.h" | ||
8 | #include "linux/cpumask.h" | ||
9 | |||
10 | #define raw_smp_processor_id() (current_thread->cpu) | ||
11 | |||
12 | #define cpu_logical_map(n) (n) | ||
13 | #define cpu_number_map(n) (n) | ||
14 | #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ | ||
15 | extern int hard_smp_processor_id(void); | ||
16 | #define NO_PROC_ID -1 | ||
17 | |||
18 | extern int ncpus; | ||
19 | |||
20 | |||
21 | static inline void smp_cpus_done(unsigned int maxcpus) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | extern struct task_struct *idle_threads[NR_CPUS]; | ||
26 | |||
27 | #else | ||
28 | |||
29 | #define hard_smp_processor_id() 0 | ||
30 | |||
31 | #endif | ||
32 | |||
33 | #endif | ||
diff --git a/arch/um/include/asm/suspend.h b/arch/um/include/asm/suspend.h new file mode 100644 index 000000000000..f4e8e007f468 --- /dev/null +++ b/arch/um/include/asm/suspend.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_SUSPEND_H | ||
2 | #define __UM_SUSPEND_H | ||
3 | |||
4 | #endif | ||
diff --git a/arch/um/include/asm/system.h b/arch/um/include/asm/system.h new file mode 100644 index 000000000000..ae5f94d6317d --- /dev/null +++ b/arch/um/include/asm/system.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef __UM_SYSTEM_GENERIC_H | ||
2 | #define __UM_SYSTEM_GENERIC_H | ||
3 | |||
4 | #include "sysdep/system.h" | ||
5 | |||
6 | extern void *switch_to(void *prev, void *next, void *last); | ||
7 | |||
8 | extern int get_signals(void); | ||
9 | extern int set_signals(int enable); | ||
10 | extern int get_signals(void); | ||
11 | extern void block_signals(void); | ||
12 | extern void unblock_signals(void); | ||
13 | |||
14 | #define raw_local_save_flags(flags) do { typecheck(unsigned long, flags); \ | ||
15 | (flags) = get_signals(); } while(0) | ||
16 | #define raw_local_irq_restore(flags) do { typecheck(unsigned long, flags); \ | ||
17 | set_signals(flags); } while(0) | ||
18 | |||
19 | #define raw_local_irq_save(flags) do { raw_local_save_flags(flags); \ | ||
20 | raw_local_irq_disable(); } while(0) | ||
21 | |||
22 | #define raw_local_irq_enable() unblock_signals() | ||
23 | #define raw_local_irq_disable() block_signals() | ||
24 | |||
25 | #define irqs_disabled() \ | ||
26 | ({ \ | ||
27 | unsigned long flags; \ | ||
28 | raw_local_save_flags(flags); \ | ||
29 | (flags == 0); \ | ||
30 | }) | ||
31 | |||
32 | extern void *_switch_to(void *prev, void *next, void *last); | ||
33 | #define switch_to(prev, next, last) prev = _switch_to(prev, next, last) | ||
34 | |||
35 | #endif | ||
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h new file mode 100644 index 000000000000..62274ab9471f --- /dev/null +++ b/arch/um/include/asm/thread_info.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_THREAD_INFO_H | ||
7 | #define __UM_THREAD_INFO_H | ||
8 | |||
9 | #ifndef __ASSEMBLY__ | ||
10 | |||
11 | #include <asm/types.h> | ||
12 | #include <asm/page.h> | ||
13 | #include <asm/uaccess.h> | ||
14 | |||
15 | struct thread_info { | ||
16 | struct task_struct *task; /* main task structure */ | ||
17 | struct exec_domain *exec_domain; /* execution domain */ | ||
18 | unsigned long flags; /* low level flags */ | ||
19 | __u32 cpu; /* current CPU */ | ||
20 | int preempt_count; /* 0 => preemptable, | ||
21 | <0 => BUG */ | ||
22 | mm_segment_t addr_limit; /* thread address space: | ||
23 | 0-0xBFFFFFFF for user | ||
24 | 0-0xFFFFFFFF for kernel */ | ||
25 | struct restart_block restart_block; | ||
26 | struct thread_info *real_thread; /* Points to non-IRQ stack */ | ||
27 | }; | ||
28 | |||
29 | #define INIT_THREAD_INFO(tsk) \ | ||
30 | { \ | ||
31 | .task = &tsk, \ | ||
32 | .exec_domain = &default_exec_domain, \ | ||
33 | .flags = 0, \ | ||
34 | .cpu = 0, \ | ||
35 | .preempt_count = 1, \ | ||
36 | .addr_limit = KERNEL_DS, \ | ||
37 | .restart_block = { \ | ||
38 | .fn = do_no_restart_syscall, \ | ||
39 | }, \ | ||
40 | .real_thread = NULL, \ | ||
41 | } | ||
42 | |||
43 | #define init_thread_info (init_thread_union.thread_info) | ||
44 | #define init_stack (init_thread_union.stack) | ||
45 | |||
46 | #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE) | ||
47 | /* how to get the thread information struct from C */ | ||
48 | static inline struct thread_info *current_thread_info(void) | ||
49 | { | ||
50 | struct thread_info *ti; | ||
51 | unsigned long mask = THREAD_SIZE - 1; | ||
52 | ti = (struct thread_info *) (((unsigned long) &ti) & ~mask); | ||
53 | return ti; | ||
54 | } | ||
55 | |||
56 | #define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER | ||
57 | |||
58 | #endif | ||
59 | |||
60 | #define PREEMPT_ACTIVE 0x10000000 | ||
61 | |||
62 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
63 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
64 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
65 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
66 | * TIF_NEED_RESCHED | ||
67 | */ | ||
68 | #define TIF_RESTART_BLOCK 4 | ||
69 | #define TIF_MEMDIE 5 | ||
70 | #define TIF_SYSCALL_AUDIT 6 | ||
71 | #define TIF_RESTORE_SIGMASK 7 | ||
72 | #define TIF_FREEZE 16 /* is freezing for suspend */ | ||
73 | |||
74 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
75 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
76 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
77 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
78 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | ||
79 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | ||
80 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
81 | #define _TIF_FREEZE (1 << TIF_FREEZE) | ||
82 | |||
83 | #endif | ||
diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h new file mode 100644 index 000000000000..0f4ada08f748 --- /dev/null +++ b/arch/um/include/asm/timex.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __UM_TIMEX_H | ||
2 | #define __UM_TIMEX_H | ||
3 | |||
4 | typedef unsigned long cycles_t; | ||
5 | |||
6 | static inline cycles_t get_cycles (void) | ||
7 | { | ||
8 | return 0; | ||
9 | } | ||
10 | |||
11 | #define CLOCK_TICK_RATE (HZ) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/um/include/asm/tlb.h b/arch/um/include/asm/tlb.h new file mode 100644 index 000000000000..5240fa1c5e08 --- /dev/null +++ b/arch/um/include/asm/tlb.h | |||
@@ -0,0 +1,127 @@ | |||
1 | #ifndef __UM_TLB_H | ||
2 | #define __UM_TLB_H | ||
3 | |||
4 | #include <linux/pagemap.h> | ||
5 | #include <linux/swap.h> | ||
6 | #include <asm/percpu.h> | ||
7 | #include <asm/pgalloc.h> | ||
8 | #include <asm/tlbflush.h> | ||
9 | |||
10 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
11 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
12 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
13 | |||
14 | /* struct mmu_gather is an opaque type used by the mm code for passing around | ||
15 | * any data needed by arch specific code for tlb_remove_page. | ||
16 | */ | ||
17 | struct mmu_gather { | ||
18 | struct mm_struct *mm; | ||
19 | unsigned int need_flush; /* Really unmapped some ptes? */ | ||
20 | unsigned long start; | ||
21 | unsigned long end; | ||
22 | unsigned int fullmm; /* non-zero means full mm flush */ | ||
23 | }; | ||
24 | |||
25 | /* Users of the generic TLB shootdown code must declare this storage space. */ | ||
26 | DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); | ||
27 | |||
28 | static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, | ||
29 | unsigned long address) | ||
30 | { | ||
31 | if (tlb->start > address) | ||
32 | tlb->start = address; | ||
33 | if (tlb->end < address + PAGE_SIZE) | ||
34 | tlb->end = address + PAGE_SIZE; | ||
35 | } | ||
36 | |||
37 | static inline void init_tlb_gather(struct mmu_gather *tlb) | ||
38 | { | ||
39 | tlb->need_flush = 0; | ||
40 | |||
41 | tlb->start = TASK_SIZE; | ||
42 | tlb->end = 0; | ||
43 | |||
44 | if (tlb->fullmm) { | ||
45 | tlb->start = 0; | ||
46 | tlb->end = TASK_SIZE; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | /* tlb_gather_mmu | ||
51 | * Return a pointer to an initialized struct mmu_gather. | ||
52 | */ | ||
53 | static inline struct mmu_gather * | ||
54 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | ||
55 | { | ||
56 | struct mmu_gather *tlb = &get_cpu_var(mmu_gathers); | ||
57 | |||
58 | tlb->mm = mm; | ||
59 | tlb->fullmm = full_mm_flush; | ||
60 | |||
61 | init_tlb_gather(tlb); | ||
62 | |||
63 | return tlb; | ||
64 | } | ||
65 | |||
66 | extern void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | ||
67 | unsigned long end); | ||
68 | |||
69 | static inline void | ||
70 | tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | ||
71 | { | ||
72 | if (!tlb->need_flush) | ||
73 | return; | ||
74 | |||
75 | flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end); | ||
76 | init_tlb_gather(tlb); | ||
77 | } | ||
78 | |||
79 | /* tlb_finish_mmu | ||
80 | * Called at the end of the shootdown operation to free up any resources | ||
81 | * that were required. | ||
82 | */ | ||
83 | static inline void | ||
84 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | ||
85 | { | ||
86 | tlb_flush_mmu(tlb, start, end); | ||
87 | |||
88 | /* keep the page table cache within bounds */ | ||
89 | check_pgt_cache(); | ||
90 | |||
91 | put_cpu_var(mmu_gathers); | ||
92 | } | ||
93 | |||
94 | /* tlb_remove_page | ||
95 | * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), | ||
96 | * while handling the additional races in SMP caused by other CPUs | ||
97 | * caching valid mappings in their TLBs. | ||
98 | */ | ||
99 | static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | ||
100 | { | ||
101 | tlb->need_flush = 1; | ||
102 | free_page_and_swap_cache(page); | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation. | ||
108 | * | ||
109 | * Record the fact that pte's were really umapped in ->need_flush, so we can | ||
110 | * later optimise away the tlb invalidate. This helps when userspace is | ||
111 | * unmapping already-unmapped pages, which happens quite a lot. | ||
112 | */ | ||
113 | #define tlb_remove_tlb_entry(tlb, ptep, address) \ | ||
114 | do { \ | ||
115 | tlb->need_flush = 1; \ | ||
116 | __tlb_remove_tlb_entry(tlb, ptep, address); \ | ||
117 | } while (0) | ||
118 | |||
119 | #define pte_free_tlb(tlb, ptep) __pte_free_tlb(tlb, ptep) | ||
120 | |||
121 | #define pud_free_tlb(tlb, pudp) __pud_free_tlb(tlb, pudp) | ||
122 | |||
123 | #define pmd_free_tlb(tlb, pmdp) __pmd_free_tlb(tlb, pmdp) | ||
124 | |||
125 | #define tlb_migrate_finish(mm) do {} while (0) | ||
126 | |||
127 | #endif | ||
diff --git a/arch/um/include/asm/tlbflush.h b/arch/um/include/asm/tlbflush.h new file mode 100644 index 000000000000..614f2c091178 --- /dev/null +++ b/arch/um/include/asm/tlbflush.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_TLBFLUSH_H | ||
7 | #define __UM_TLBFLUSH_H | ||
8 | |||
9 | #include <linux/mm.h> | ||
10 | |||
11 | /* | ||
12 | * TLB flushing: | ||
13 | * | ||
14 | * - flush_tlb() flushes the current mm struct TLBs | ||
15 | * - flush_tlb_all() flushes all processes TLBs | ||
16 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
17 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
18 | * - flush_tlb_kernel_vm() flushes the kernel vm area | ||
19 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
20 | */ | ||
21 | |||
22 | extern void flush_tlb_all(void); | ||
23 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
24 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
25 | unsigned long end); | ||
26 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long address); | ||
27 | extern void flush_tlb_kernel_vm(void); | ||
28 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
29 | extern void __flush_tlb_one(unsigned long addr); | ||
30 | |||
31 | #endif | ||
diff --git a/arch/um/include/asm/topology.h b/arch/um/include/asm/topology.h new file mode 100644 index 000000000000..0905e4f21d42 --- /dev/null +++ b/arch/um/include/asm/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_UM_TOPOLOGY_H | ||
2 | #define _ASM_UM_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h new file mode 100644 index 000000000000..b9a895d6fa1d --- /dev/null +++ b/arch/um/include/asm/uaccess.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_UACCESS_H | ||
7 | #define __UM_UACCESS_H | ||
8 | |||
9 | #include <asm/errno.h> | ||
10 | #include <asm/processor.h> | ||
11 | |||
12 | /* thread_info has a mm_segment_t in it, so put the definition up here */ | ||
13 | typedef struct { | ||
14 | unsigned long seg; | ||
15 | } mm_segment_t; | ||
16 | |||
17 | #include "linux/thread_info.h" | ||
18 | |||
19 | #define VERIFY_READ 0 | ||
20 | #define VERIFY_WRITE 1 | ||
21 | |||
22 | /* | ||
23 | * The fs value determines whether argument validity checking should be | ||
24 | * performed or not. If get_fs() == USER_DS, checking is performed, with | ||
25 | * get_fs() == KERNEL_DS, checking is bypassed. | ||
26 | * | ||
27 | * For historical reasons, these macros are grossly misnamed. | ||
28 | */ | ||
29 | |||
30 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
31 | |||
32 | #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) | ||
33 | #define USER_DS MAKE_MM_SEG(TASK_SIZE) | ||
34 | |||
35 | #define get_ds() (KERNEL_DS) | ||
36 | #define get_fs() (current_thread_info()->addr_limit) | ||
37 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | ||
38 | |||
39 | #define segment_eq(a, b) ((a).seg == (b).seg) | ||
40 | |||
41 | #include "um_uaccess.h" | ||
42 | |||
43 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | ||
44 | |||
45 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | ||
46 | |||
47 | #define __copy_to_user_inatomic __copy_to_user | ||
48 | #define __copy_from_user_inatomic __copy_from_user | ||
49 | |||
50 | #define __get_user(x, ptr) \ | ||
51 | ({ \ | ||
52 | const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \ | ||
53 | __typeof__(x) __private_val; \ | ||
54 | int __private_ret = -EFAULT; \ | ||
55 | (x) = (__typeof__(*(__private_ptr)))0; \ | ||
56 | if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\ | ||
57 | sizeof(*(__private_ptr))) == 0) { \ | ||
58 | (x) = (__typeof__(*(__private_ptr))) __private_val; \ | ||
59 | __private_ret = 0; \ | ||
60 | } \ | ||
61 | __private_ret; \ | ||
62 | }) | ||
63 | |||
64 | #define get_user(x, ptr) \ | ||
65 | ({ \ | ||
66 | const __typeof__((*(ptr))) __user *private_ptr = (ptr); \ | ||
67 | (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \ | ||
68 | __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \ | ||
69 | }) | ||
70 | |||
71 | #define __put_user(x, ptr) \ | ||
72 | ({ \ | ||
73 | __typeof__(*(ptr)) __user *__private_ptr = ptr; \ | ||
74 | __typeof__(*(__private_ptr)) __private_val; \ | ||
75 | int __private_ret = -EFAULT; \ | ||
76 | __private_val = (__typeof__(*(__private_ptr))) (x); \ | ||
77 | if (__copy_to_user((__private_ptr), &__private_val, \ | ||
78 | sizeof(*(__private_ptr))) == 0) { \ | ||
79 | __private_ret = 0; \ | ||
80 | } \ | ||
81 | __private_ret; \ | ||
82 | }) | ||
83 | |||
84 | #define put_user(x, ptr) \ | ||
85 | ({ \ | ||
86 | __typeof__(*(ptr)) __user *private_ptr = (ptr); \ | ||
87 | (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \ | ||
88 | __put_user(x, private_ptr) : -EFAULT); \ | ||
89 | }) | ||
90 | |||
91 | #define strlen_user(str) strnlen_user(str, ~0U >> 1) | ||
92 | |||
93 | struct exception_table_entry | ||
94 | { | ||
95 | unsigned long insn; | ||
96 | unsigned long fixup; | ||
97 | }; | ||
98 | |||
99 | #endif | ||
diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h new file mode 100644 index 000000000000..a19db3e17241 --- /dev/null +++ b/arch/um/include/asm/xor.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_XOR_H | ||
2 | #define __UM_XOR_H | ||
3 | |||
4 | #include "asm-generic/xor.h" | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/aio.h b/arch/um/include/shared/aio.h index 423bae9153f8..423bae9153f8 100644 --- a/arch/um/include/aio.h +++ b/arch/um/include/shared/aio.h | |||
diff --git a/arch/um/include/arch.h b/arch/um/include/shared/arch.h index 2de92a08a76b..2de92a08a76b 100644 --- a/arch/um/include/arch.h +++ b/arch/um/include/shared/arch.h | |||
diff --git a/arch/um/include/as-layout.h b/arch/um/include/shared/as-layout.h index 58e852dfb0ce..a92b678503cf 100644 --- a/arch/um/include/as-layout.h +++ b/arch/um/include/shared/as-layout.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef __START_H__ | 6 | #ifndef __START_H__ |
7 | #define __START_H__ | 7 | #define __START_H__ |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | #include "kern_constants.h" | 9 | #include "kern_constants.h" |
11 | 10 | ||
12 | /* | 11 | /* |
diff --git a/arch/um/include/chan_kern.h b/arch/um/include/shared/chan_kern.h index 1e651457e049..1e651457e049 100644 --- a/arch/um/include/chan_kern.h +++ b/arch/um/include/shared/chan_kern.h | |||
diff --git a/arch/um/include/chan_user.h b/arch/um/include/shared/chan_user.h index 9b9ced85b703..9b9ced85b703 100644 --- a/arch/um/include/chan_user.h +++ b/arch/um/include/shared/chan_user.h | |||
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/shared/common-offsets.h index b54bd35585c2..72009c7e3210 100644 --- a/arch/um/include/common-offsets.h +++ b/arch/um/include/shared/common-offsets.h | |||
@@ -39,3 +39,16 @@ DEFINE(UM_HZ, HZ); | |||
39 | DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC); | 39 | DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC); |
40 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); | 40 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); |
41 | DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC); | 41 | DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC); |
42 | |||
43 | #ifdef CONFIG_PRINTK | ||
44 | DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK); | ||
45 | #endif | ||
46 | #ifdef CONFIG_NO_HZ | ||
47 | DEFINE(UML_CONFIG_NO_HZ, CONFIG_NO_HZ); | ||
48 | #endif | ||
49 | #ifdef CONFIG_UML_X86 | ||
50 | DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86); | ||
51 | #endif | ||
52 | #ifdef CONFIG_64BIT | ||
53 | DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT); | ||
54 | #endif | ||
diff --git a/arch/um/include/elf_user.h b/arch/um/include/shared/elf_user.h index 53516b637272..53516b637272 100644 --- a/arch/um/include/elf_user.h +++ b/arch/um/include/shared/elf_user.h | |||
diff --git a/arch/um/include/frame_kern.h b/arch/um/include/shared/frame_kern.h index ce9514f57211..ce9514f57211 100644 --- a/arch/um/include/frame_kern.h +++ b/arch/um/include/shared/frame_kern.h | |||
diff --git a/arch/um/include/init.h b/arch/um/include/shared/init.h index 37dd097c16c0..37dd097c16c0 100644 --- a/arch/um/include/init.h +++ b/arch/um/include/shared/init.h | |||
diff --git a/arch/um/include/initrd.h b/arch/um/include/shared/initrd.h index 439b9a814985..439b9a814985 100644 --- a/arch/um/include/initrd.h +++ b/arch/um/include/shared/initrd.h | |||
diff --git a/arch/um/include/irq_kern.h b/arch/um/include/shared/irq_kern.h index fba3895274f9..fba3895274f9 100644 --- a/arch/um/include/irq_kern.h +++ b/arch/um/include/shared/irq_kern.h | |||
diff --git a/arch/um/include/irq_user.h b/arch/um/include/shared/irq_user.h index c6c784df2673..c6c784df2673 100644 --- a/arch/um/include/irq_user.h +++ b/arch/um/include/shared/irq_user.h | |||
diff --git a/arch/um/include/kern.h b/arch/um/include/shared/kern.h index 4ce3fc650e57..4ce3fc650e57 100644 --- a/arch/um/include/kern.h +++ b/arch/um/include/shared/kern.h | |||
diff --git a/arch/um/include/kern_util.h b/arch/um/include/shared/kern_util.h index 3c341222d252..3c341222d252 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/shared/kern_util.h | |||
diff --git a/arch/um/include/shared/ldt.h b/arch/um/include/shared/ldt.h new file mode 100644 index 000000000000..a7f999a58774 --- /dev/null +++ b/arch/um/include/shared/ldt.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
3 | * Licensed under the GPL | ||
4 | * | ||
5 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef __ASM_LDT_H | ||
9 | #define __ASM_LDT_H | ||
10 | |||
11 | #include <linux/mutex.h> | ||
12 | #include <sysdep/host_ldt.h> | ||
13 | |||
14 | extern void ldt_host_info(void); | ||
15 | |||
16 | #define LDT_PAGES_MAX \ | ||
17 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
18 | #define LDT_ENTRIES_PER_PAGE \ | ||
19 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
20 | #define LDT_DIRECT_ENTRIES \ | ||
21 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
22 | |||
23 | struct ldt_entry { | ||
24 | __u32 a; | ||
25 | __u32 b; | ||
26 | }; | ||
27 | |||
28 | typedef struct uml_ldt { | ||
29 | int entry_count; | ||
30 | struct mutex lock; | ||
31 | union { | ||
32 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
33 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
34 | } u; | ||
35 | } uml_ldt_t; | ||
36 | |||
37 | #endif | ||
diff --git a/arch/um/include/line.h b/arch/um/include/shared/line.h index 311a0d3d93af..311a0d3d93af 100644 --- a/arch/um/include/line.h +++ b/arch/um/include/shared/line.h | |||
diff --git a/arch/um/include/longjmp.h b/arch/um/include/shared/longjmp.h index e860bc5848e0..e860bc5848e0 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/shared/longjmp.h | |||
diff --git a/arch/um/include/mconsole.h b/arch/um/include/shared/mconsole.h index c139ae1d6826..c139ae1d6826 100644 --- a/arch/um/include/mconsole.h +++ b/arch/um/include/shared/mconsole.h | |||
diff --git a/arch/um/include/mconsole_kern.h b/arch/um/include/shared/mconsole_kern.h index d2fe07e78958..d2fe07e78958 100644 --- a/arch/um/include/mconsole_kern.h +++ b/arch/um/include/shared/mconsole_kern.h | |||
diff --git a/arch/um/include/mem.h b/arch/um/include/shared/mem.h index 5cd40e99e8d5..5cd40e99e8d5 100644 --- a/arch/um/include/mem.h +++ b/arch/um/include/shared/mem.h | |||
diff --git a/arch/um/include/mem_kern.h b/arch/um/include/shared/mem_kern.h index cb7e196d366b..cb7e196d366b 100644 --- a/arch/um/include/mem_kern.h +++ b/arch/um/include/shared/mem_kern.h | |||
diff --git a/arch/um/include/mem_user.h b/arch/um/include/shared/mem_user.h index 46384acd547b..46384acd547b 100644 --- a/arch/um/include/mem_user.h +++ b/arch/um/include/shared/mem_user.h | |||
diff --git a/arch/um/include/net_kern.h b/arch/um/include/shared/net_kern.h index d843c7924a7c..d843c7924a7c 100644 --- a/arch/um/include/net_kern.h +++ b/arch/um/include/shared/net_kern.h | |||
diff --git a/arch/um/include/net_user.h b/arch/um/include/shared/net_user.h index 63bee158cd8e..63bee158cd8e 100644 --- a/arch/um/include/net_user.h +++ b/arch/um/include/shared/net_user.h | |||
diff --git a/arch/um/include/os.h b/arch/um/include/shared/os.h index db5be46e3e18..cd40fddcf99d 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/shared/os.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "longjmp.h" | 11 | #include "longjmp.h" |
12 | #include "mm_id.h" | 12 | #include "mm_id.h" |
13 | #include "sysdep/tls.h" | 13 | #include "sysdep/tls.h" |
14 | #include "../os/include/file.h" | ||
15 | 14 | ||
16 | #define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) | 15 | #define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) |
17 | 16 | ||
diff --git a/arch/um/include/process.h b/arch/um/include/shared/process.h index bb873a51262e..bb873a51262e 100644 --- a/arch/um/include/process.h +++ b/arch/um/include/shared/process.h | |||
diff --git a/arch/um/include/ptrace_user.h b/arch/um/include/shared/ptrace_user.h index 4bce6e012889..4bce6e012889 100644 --- a/arch/um/include/ptrace_user.h +++ b/arch/um/include/shared/ptrace_user.h | |||
diff --git a/arch/um/include/registers.h b/arch/um/include/shared/registers.h index b0b4589e0ebc..b0b4589e0ebc 100644 --- a/arch/um/include/registers.h +++ b/arch/um/include/shared/registers.h | |||
diff --git a/arch/um/include/sigio.h b/arch/um/include/shared/sigio.h index 434f1a9ae4b3..434f1a9ae4b3 100644 --- a/arch/um/include/sigio.h +++ b/arch/um/include/shared/sigio.h | |||
diff --git a/arch/um/include/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h index 48dd0989ddaa..48dd0989ddaa 100644 --- a/arch/um/include/skas/mm_id.h +++ b/arch/um/include/shared/skas/mm_id.h | |||
diff --git a/arch/um/include/skas/proc_mm.h b/arch/um/include/shared/skas/proc_mm.h index 902809209603..902809209603 100644 --- a/arch/um/include/skas/proc_mm.h +++ b/arch/um/include/shared/skas/proc_mm.h | |||
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/shared/skas/skas.h index 64d2c7443306..64d2c7443306 100644 --- a/arch/um/include/skas/skas.h +++ b/arch/um/include/shared/skas/skas.h | |||
diff --git a/arch/um/include/skas/stub-data.h b/arch/um/include/shared/skas/stub-data.h index f6ed92c3727d..f6ed92c3727d 100644 --- a/arch/um/include/skas/stub-data.h +++ b/arch/um/include/shared/skas/stub-data.h | |||
diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/shared/skas_ptrace.h index 3d31bbacd016..3d31bbacd016 100644 --- a/arch/um/include/skas_ptrace.h +++ b/arch/um/include/shared/skas_ptrace.h | |||
diff --git a/arch/um/include/skas_ptregs.h b/arch/um/include/shared/skas_ptregs.h index 73db19e9c077..73db19e9c077 100644 --- a/arch/um/include/skas_ptregs.h +++ b/arch/um/include/shared/skas_ptregs.h | |||
diff --git a/arch/um/include/syscall.h b/arch/um/include/shared/syscall.h index dda1df901a08..dda1df901a08 100644 --- a/arch/um/include/syscall.h +++ b/arch/um/include/shared/syscall.h | |||
diff --git a/arch/um/include/sysrq.h b/arch/um/include/shared/sysrq.h index c8d332b56b98..c8d332b56b98 100644 --- a/arch/um/include/sysrq.h +++ b/arch/um/include/shared/sysrq.h | |||
diff --git a/arch/um/include/task.h b/arch/um/include/shared/task.h index 3fe726b3cf48..3fe726b3cf48 100644 --- a/arch/um/include/task.h +++ b/arch/um/include/shared/task.h | |||
diff --git a/arch/um/include/tlb.h b/arch/um/include/shared/tlb.h index ecd2265b301b..ecd2265b301b 100644 --- a/arch/um/include/tlb.h +++ b/arch/um/include/shared/tlb.h | |||
diff --git a/arch/um/include/ubd_user.h b/arch/um/include/shared/ubd_user.h index bb66517f0739..bb66517f0739 100644 --- a/arch/um/include/ubd_user.h +++ b/arch/um/include/shared/ubd_user.h | |||
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/shared/um_malloc.h index c554d706d106..c554d706d106 100644 --- a/arch/um/include/um_malloc.h +++ b/arch/um/include/shared/um_malloc.h | |||
diff --git a/arch/um/include/um_mmu.h b/arch/um/include/shared/um_mmu.h index f575ff91f2a0..b1a7e47d1027 100644 --- a/arch/um/include/um_mmu.h +++ b/arch/um/include/shared/um_mmu.h | |||
@@ -6,9 +6,8 @@ | |||
6 | #ifndef __ARCH_UM_MMU_H | 6 | #ifndef __ARCH_UM_MMU_H |
7 | #define __ARCH_UM_MMU_H | 7 | #define __ARCH_UM_MMU_H |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | #include "mm_id.h" | 9 | #include "mm_id.h" |
11 | #include "asm/ldt.h" | 10 | #include "ldt.h" |
12 | 11 | ||
13 | typedef struct mm_context { | 12 | typedef struct mm_context { |
14 | struct mm_id id; | 13 | struct mm_id id; |
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/shared/um_uaccess.h index 45c04999d670..45c04999d670 100644 --- a/arch/um/include/um_uaccess.h +++ b/arch/um/include/shared/um_uaccess.h | |||
diff --git a/arch/um/include/user.h b/arch/um/include/shared/user.h index 1723fac6f40d..293f7c794faa 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/shared/user.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #ifndef __USER_H__ | 6 | #ifndef __USER_H__ |
7 | #define __USER_H__ | 7 | #define __USER_H__ |
8 | 8 | ||
9 | #include "uml-config.h" | 9 | #include "kern_constants.h" |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * The usual definition - copied here because the kernel provides its own, | 12 | * The usual definition - copied here because the kernel provides its own, |
diff --git a/arch/um/include/sigcontext.h b/arch/um/include/sigcontext.h deleted file mode 100644 index 59816ca7a8df..000000000000 --- a/arch/um/include/sigcontext.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UML_SIGCONTEXT_H__ | ||
7 | #define __UML_SIGCONTEXT_H__ | ||
8 | |||
9 | #include "sysdep/sigcontext.h" | ||
10 | |||
11 | extern int sc_size(void *data); | ||
12 | extern void sc_to_sc(void *to_ptr, void *from_ptr); | ||
13 | |||
14 | #endif | ||
15 | |||
16 | /* | ||
17 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
18 | * Emacs will notice this stuff at the end of the file and automatically | ||
19 | * adjust the settings for this buffer only. This must remain at the end | ||
20 | * of the file. | ||
21 | * --------------------------------------------------------------------------- | ||
22 | * Local variables: | ||
23 | * c-file-style: "linux" | ||
24 | * End: | ||
25 | */ | ||
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index f5d7f4569ba7..fda30d21fb90 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "mem_user.h" | 15 | #include "mem_user.h" |
16 | #include "skas.h" | 16 | #include "skas.h" |
17 | #include "os.h" | 17 | #include "os.h" |
18 | #include "internal.h" | ||
18 | 19 | ||
19 | void flush_thread(void) | 20 | void flush_thread(void) |
20 | { | 21 | { |
@@ -42,23 +43,11 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | |||
42 | PT_REGS_SP(regs) = esp; | 43 | PT_REGS_SP(regs) = esp; |
43 | } | 44 | } |
44 | 45 | ||
45 | #ifdef CONFIG_TTY_LOG | ||
46 | extern void log_exec(char **argv, void *tty); | ||
47 | #endif | ||
48 | |||
49 | static long execve1(char *file, char __user * __user *argv, | 46 | static long execve1(char *file, char __user * __user *argv, |
50 | char __user *__user *env) | 47 | char __user *__user *env) |
51 | { | 48 | { |
52 | long error; | 49 | long error; |
53 | #ifdef CONFIG_TTY_LOG | ||
54 | struct tty_struct *tty; | ||
55 | 50 | ||
56 | mutex_lock(&tty_mutex); | ||
57 | tty = get_current_tty(); | ||
58 | if (tty) | ||
59 | log_exec(argv, tty); | ||
60 | mutex_unlock(&tty_mutex); | ||
61 | #endif | ||
62 | error = do_execve(file, argv, env, ¤t->thread.regs); | 51 | error = do_execve(file, argv, env, ¤t->thread.regs); |
63 | if (error == 0) { | 52 | if (error == 0) { |
64 | task_lock(current); | 53 | task_lock(current); |
diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h new file mode 100644 index 000000000000..3bda43c7a786 --- /dev/null +++ b/arch/um/kernel/internal.h | |||
@@ -0,0 +1 @@ | |||
extern long um_execve(char *file, char __user *__user *argv, char __user *__user *env); | |||
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index b0fce720c4d0..b5c094c4ade4 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <asm/unistd.h> | 11 | #include <asm/unistd.h> |
12 | #include "frame_kern.h" | 12 | #include "frame_kern.h" |
13 | #include "kern_util.h" | 13 | #include "kern_util.h" |
14 | #include "sigcontext.h" | 14 | #include <sysdep/sigcontext.h> |
15 | 15 | ||
16 | EXPORT_SYMBOL(block_signals); | 16 | EXPORT_SYMBOL(block_signals); |
17 | EXPORT_SYMBOL(unblock_signals); | 17 | EXPORT_SYMBOL(unblock_signals); |
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c index be2d50c3aa95..045772142844 100644 --- a/arch/um/kernel/smp.c +++ b/arch/um/kernel/smp.c | |||
@@ -85,6 +85,7 @@ static int idle_proc(void *cpup) | |||
85 | while (!cpu_isset(cpu, smp_commenced_mask)) | 85 | while (!cpu_isset(cpu, smp_commenced_mask)) |
86 | cpu_relax(); | 86 | cpu_relax(); |
87 | 87 | ||
88 | notify_cpu_starting(cpu); | ||
88 | cpu_set(cpu, cpu_online_map); | 89 | cpu_set(cpu, cpu_online_map); |
89 | default_idle(); | 90 | default_idle(); |
90 | return 0; | 91 | return 0; |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 128ee85bc8d9..c4df705b8359 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "asm/mman.h" | 12 | #include "asm/mman.h" |
13 | #include "asm/uaccess.h" | 13 | #include "asm/uaccess.h" |
14 | #include "asm/unistd.h" | 14 | #include "asm/unistd.h" |
15 | #include "internal.h" | ||
15 | 16 | ||
16 | long sys_fork(void) | 17 | long sys_fork(void) |
17 | { | 18 | { |
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index 8a48d6a30064..d66f0388f091 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile | |||
@@ -7,9 +7,6 @@ obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ | |||
7 | registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \ | 7 | registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \ |
8 | umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ | 8 | umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ |
9 | 9 | ||
10 | obj-$(CONFIG_TTY_LOG) += tty_log.o | ||
11 | user-objs-$(CONFIG_TTY_LOG) += tty_log.o | ||
12 | |||
13 | USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ | 10 | USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ |
14 | main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ | 11 | main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ |
15 | tty.o tls.o uaccess.o umid.o util.o | 12 | tty.o tls.o uaccess.o umid.o util.o |
diff --git a/arch/um/os-Linux/include/file.h b/arch/um/os-Linux/include/file.h deleted file mode 100644 index fe71be24bd59..000000000000 --- a/arch/um/os-Linux/include/file.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __OS_FILE_H__ | ||
7 | #define __OS_FILE_H__ | ||
8 | |||
9 | #define DEV_NULL "/dev/null" | ||
10 | |||
11 | #endif | ||
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 484e68f9f7ae..d261f170d120 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include "user.h" | 20 | #include "user.h" |
21 | #include "sysdep/ptrace.h" | 21 | #include "sysdep/ptrace.h" |
22 | #include "sysdep/stub.h" | 22 | #include "sysdep/stub.h" |
23 | #include "uml-config.h" | ||
24 | 23 | ||
25 | extern unsigned long batch_syscall_stub, __syscall_stub_start; | 24 | extern unsigned long batch_syscall_stub, __syscall_stub_start; |
26 | 25 | ||
diff --git a/arch/um/os-Linux/tty_log.c b/arch/um/os-Linux/tty_log.c deleted file mode 100644 index cc648e6fd3a2..000000000000 --- a/arch/um/os-Linux/tty_log.c +++ /dev/null | |||
@@ -1,217 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and | ||
3 | * geoffrey hing <ghing@net.ohio-state.edu> | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #include <errno.h> | ||
8 | #include <string.h> | ||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <unistd.h> | ||
12 | #include <sys/time.h> | ||
13 | #include "init.h" | ||
14 | #include "user.h" | ||
15 | #include "os.h" | ||
16 | |||
17 | #define TTY_LOG_DIR "./" | ||
18 | |||
19 | /* Set early in boot and then unchanged */ | ||
20 | static char *tty_log_dir = TTY_LOG_DIR; | ||
21 | static int tty_log_fd = -1; | ||
22 | |||
23 | #define TTY_LOG_OPEN 1 | ||
24 | #define TTY_LOG_CLOSE 2 | ||
25 | #define TTY_LOG_WRITE 3 | ||
26 | #define TTY_LOG_EXEC 4 | ||
27 | |||
28 | #define TTY_READ 1 | ||
29 | #define TTY_WRITE 2 | ||
30 | |||
31 | struct tty_log_buf { | ||
32 | int what; | ||
33 | unsigned long tty; | ||
34 | int len; | ||
35 | int direction; | ||
36 | unsigned long sec; | ||
37 | unsigned long usec; | ||
38 | }; | ||
39 | |||
40 | int open_tty_log(void *tty, void *current_tty) | ||
41 | { | ||
42 | struct timeval tv; | ||
43 | struct tty_log_buf data; | ||
44 | char buf[strlen(tty_log_dir) + sizeof("01234567890-01234567\0")]; | ||
45 | int fd; | ||
46 | |||
47 | gettimeofday(&tv, NULL); | ||
48 | if(tty_log_fd != -1){ | ||
49 | data = ((struct tty_log_buf) { .what = TTY_LOG_OPEN, | ||
50 | .tty = (unsigned long) tty, | ||
51 | .len = sizeof(current_tty), | ||
52 | .direction = 0, | ||
53 | .sec = tv.tv_sec, | ||
54 | .usec = tv.tv_usec } ); | ||
55 | write(tty_log_fd, &data, sizeof(data)); | ||
56 | write(tty_log_fd, ¤t_tty, data.len); | ||
57 | return tty_log_fd; | ||
58 | } | ||
59 | |||
60 | sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec, | ||
61 | (unsigned int) tv.tv_usec); | ||
62 | |||
63 | fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))), | ||
64 | 0644); | ||
65 | if(fd < 0){ | ||
66 | printk("open_tty_log : couldn't open '%s', errno = %d\n", | ||
67 | buf, -fd); | ||
68 | } | ||
69 | return fd; | ||
70 | } | ||
71 | |||
72 | void close_tty_log(int fd, void *tty) | ||
73 | { | ||
74 | struct tty_log_buf data; | ||
75 | struct timeval tv; | ||
76 | |||
77 | if(tty_log_fd != -1){ | ||
78 | gettimeofday(&tv, NULL); | ||
79 | data = ((struct tty_log_buf) { .what = TTY_LOG_CLOSE, | ||
80 | .tty = (unsigned long) tty, | ||
81 | .len = 0, | ||
82 | .direction = 0, | ||
83 | .sec = tv.tv_sec, | ||
84 | .usec = tv.tv_usec } ); | ||
85 | write(tty_log_fd, &data, sizeof(data)); | ||
86 | return; | ||
87 | } | ||
88 | os_close_file(fd); | ||
89 | } | ||
90 | |||
91 | static int log_chunk(int fd, const char *buf, int len) | ||
92 | { | ||
93 | int total = 0, try, missed, n; | ||
94 | char chunk[64]; | ||
95 | |||
96 | while(len > 0){ | ||
97 | try = (len > sizeof(chunk)) ? sizeof(chunk) : len; | ||
98 | missed = copy_from_user_proc(chunk, (char *) buf, try); | ||
99 | try -= missed; | ||
100 | n = write(fd, chunk, try); | ||
101 | if(n != try) { | ||
102 | if(n < 0) | ||
103 | return -errno; | ||
104 | return -EIO; | ||
105 | } | ||
106 | if(missed != 0) | ||
107 | return -EFAULT; | ||
108 | |||
109 | len -= try; | ||
110 | total += try; | ||
111 | buf += try; | ||
112 | } | ||
113 | |||
114 | return total; | ||
115 | } | ||
116 | |||
117 | int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read) | ||
118 | { | ||
119 | struct timeval tv; | ||
120 | struct tty_log_buf data; | ||
121 | int direction; | ||
122 | |||
123 | if(fd == tty_log_fd){ | ||
124 | gettimeofday(&tv, NULL); | ||
125 | direction = is_read ? TTY_READ : TTY_WRITE; | ||
126 | data = ((struct tty_log_buf) { .what = TTY_LOG_WRITE, | ||
127 | .tty = (unsigned long) tty, | ||
128 | .len = len, | ||
129 | .direction = direction, | ||
130 | .sec = tv.tv_sec, | ||
131 | .usec = tv.tv_usec } ); | ||
132 | write(tty_log_fd, &data, sizeof(data)); | ||
133 | } | ||
134 | |||
135 | return log_chunk(fd, buf, len); | ||
136 | } | ||
137 | |||
138 | void log_exec(char **argv, void *tty) | ||
139 | { | ||
140 | struct timeval tv; | ||
141 | struct tty_log_buf data; | ||
142 | char **ptr,*arg; | ||
143 | int len; | ||
144 | |||
145 | if(tty_log_fd == -1) return; | ||
146 | |||
147 | gettimeofday(&tv, NULL); | ||
148 | |||
149 | len = 0; | ||
150 | for(ptr = argv; ; ptr++){ | ||
151 | if(copy_from_user_proc(&arg, ptr, sizeof(arg))) | ||
152 | return; | ||
153 | if(arg == NULL) break; | ||
154 | len += strlen_user_proc(arg); | ||
155 | } | ||
156 | |||
157 | data = ((struct tty_log_buf) { .what = TTY_LOG_EXEC, | ||
158 | .tty = (unsigned long) tty, | ||
159 | .len = len, | ||
160 | .direction = 0, | ||
161 | .sec = tv.tv_sec, | ||
162 | .usec = tv.tv_usec } ); | ||
163 | write(tty_log_fd, &data, sizeof(data)); | ||
164 | |||
165 | for(ptr = argv; ; ptr++){ | ||
166 | if(copy_from_user_proc(&arg, ptr, sizeof(arg))) | ||
167 | return; | ||
168 | if(arg == NULL) break; | ||
169 | log_chunk(tty_log_fd, arg, strlen_user_proc(arg)); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | extern void register_tty_logger(int (*opener)(void *, void *), | ||
174 | int (*writer)(int, const char *, int, | ||
175 | void *, int), | ||
176 | void (*closer)(int, void *)); | ||
177 | |||
178 | static int register_logger(void) | ||
179 | { | ||
180 | register_tty_logger(open_tty_log, write_tty_log, close_tty_log); | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | __uml_initcall(register_logger); | ||
185 | |||
186 | static int __init set_tty_log_dir(char *name, int *add) | ||
187 | { | ||
188 | tty_log_dir = name; | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | __uml_setup("tty_log_dir=", set_tty_log_dir, | ||
193 | "tty_log_dir=<directory>\n" | ||
194 | " This is used to specify the directory where the logs of all pty\n" | ||
195 | " data from this UML machine will be written.\n\n" | ||
196 | ); | ||
197 | |||
198 | static int __init set_tty_log_fd(char *name, int *add) | ||
199 | { | ||
200 | char *end; | ||
201 | |||
202 | tty_log_fd = strtoul(name, &end, 0); | ||
203 | if((*end != '\0') || (end == name)){ | ||
204 | printf("set_tty_log_fd - strtoul failed on '%s'\n", name); | ||
205 | tty_log_fd = -1; | ||
206 | } | ||
207 | |||
208 | *add = 0; | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | __uml_setup("tty_log_fd=", set_tty_log_fd, | ||
213 | "tty_log_fd=<fd>\n" | ||
214 | " This is used to specify a preconfigured file descriptor to which all\n" | ||
215 | " tty data will be written. Preconfigure the descriptor with something\n" | ||
216 | " like '10>tty_log tty_log_fd=10'.\n\n" | ||
217 | ); | ||
diff --git a/arch/um/sys-i386/asm/archparam.h b/arch/um/sys-i386/asm/archparam.h new file mode 100644 index 000000000000..93fd723344e5 --- /dev/null +++ b/arch/um/sys-i386/asm/archparam.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_ARCHPARAM_I386_H | ||
7 | #define __UM_ARCHPARAM_I386_H | ||
8 | |||
9 | #ifdef CONFIG_X86_PAE | ||
10 | #define LAST_PKMAP 512 | ||
11 | #else | ||
12 | #define LAST_PKMAP 1024 | ||
13 | #endif | ||
14 | |||
15 | #endif | ||
16 | |||
17 | /* | ||
18 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
19 | * Emacs will notice this stuff at the end of the file and automatically | ||
20 | * adjust the settings for this buffer only. This must remain at the end | ||
21 | * of the file. | ||
22 | * --------------------------------------------------------------------------- | ||
23 | * Local variables: | ||
24 | * c-file-style: "linux" | ||
25 | * End: | ||
26 | */ | ||
diff --git a/arch/um/sys-i386/asm/elf.h b/arch/um/sys-i386/asm/elf.h new file mode 100644 index 000000000000..d0da9d7c5371 --- /dev/null +++ b/arch/um/sys-i386/asm/elf.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | #ifndef __UM_ELF_I386_H | ||
6 | #define __UM_ELF_I386_H | ||
7 | |||
8 | #include <asm/user.h> | ||
9 | #include "skas.h" | ||
10 | |||
11 | #define R_386_NONE 0 | ||
12 | #define R_386_32 1 | ||
13 | #define R_386_PC32 2 | ||
14 | #define R_386_GOT32 3 | ||
15 | #define R_386_PLT32 4 | ||
16 | #define R_386_COPY 5 | ||
17 | #define R_386_GLOB_DAT 6 | ||
18 | #define R_386_JMP_SLOT 7 | ||
19 | #define R_386_RELATIVE 8 | ||
20 | #define R_386_GOTOFF 9 | ||
21 | #define R_386_GOTPC 10 | ||
22 | #define R_386_NUM 11 | ||
23 | |||
24 | typedef unsigned long elf_greg_t; | ||
25 | |||
26 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
27 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
28 | |||
29 | typedef struct user_i387_struct elf_fpregset_t; | ||
30 | |||
31 | /* | ||
32 | * This is used to ensure we don't load something for the wrong architecture. | ||
33 | */ | ||
34 | #define elf_check_arch(x) \ | ||
35 | (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486)) | ||
36 | |||
37 | #define ELF_CLASS ELFCLASS32 | ||
38 | #define ELF_DATA ELFDATA2LSB | ||
39 | #define ELF_ARCH EM_386 | ||
40 | |||
41 | #define ELF_PLAT_INIT(regs, load_addr) do { \ | ||
42 | PT_REGS_EBX(regs) = 0; \ | ||
43 | PT_REGS_ECX(regs) = 0; \ | ||
44 | PT_REGS_EDX(regs) = 0; \ | ||
45 | PT_REGS_ESI(regs) = 0; \ | ||
46 | PT_REGS_EDI(regs) = 0; \ | ||
47 | PT_REGS_EBP(regs) = 0; \ | ||
48 | PT_REGS_EAX(regs) = 0; \ | ||
49 | } while (0) | ||
50 | |||
51 | #define USE_ELF_CORE_DUMP | ||
52 | #define ELF_EXEC_PAGESIZE 4096 | ||
53 | |||
54 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
55 | |||
56 | /* Shamelessly stolen from include/asm-i386/elf.h */ | ||
57 | |||
58 | #define ELF_CORE_COPY_REGS(pr_reg, regs) do { \ | ||
59 | pr_reg[0] = PT_REGS_EBX(regs); \ | ||
60 | pr_reg[1] = PT_REGS_ECX(regs); \ | ||
61 | pr_reg[2] = PT_REGS_EDX(regs); \ | ||
62 | pr_reg[3] = PT_REGS_ESI(regs); \ | ||
63 | pr_reg[4] = PT_REGS_EDI(regs); \ | ||
64 | pr_reg[5] = PT_REGS_EBP(regs); \ | ||
65 | pr_reg[6] = PT_REGS_EAX(regs); \ | ||
66 | pr_reg[7] = PT_REGS_DS(regs); \ | ||
67 | pr_reg[8] = PT_REGS_ES(regs); \ | ||
68 | /* fake once used fs and gs selectors? */ \ | ||
69 | pr_reg[9] = PT_REGS_DS(regs); \ | ||
70 | pr_reg[10] = PT_REGS_DS(regs); \ | ||
71 | pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \ | ||
72 | pr_reg[12] = PT_REGS_IP(regs); \ | ||
73 | pr_reg[13] = PT_REGS_CS(regs); \ | ||
74 | pr_reg[14] = PT_REGS_EFLAGS(regs); \ | ||
75 | pr_reg[15] = PT_REGS_SP(regs); \ | ||
76 | pr_reg[16] = PT_REGS_SS(regs); \ | ||
77 | } while (0); | ||
78 | |||
79 | extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); | ||
80 | |||
81 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) | ||
82 | |||
83 | extern long elf_aux_hwcap; | ||
84 | #define ELF_HWCAP (elf_aux_hwcap) | ||
85 | |||
86 | extern char * elf_aux_platform; | ||
87 | #define ELF_PLATFORM (elf_aux_platform) | ||
88 | |||
89 | #define SET_PERSONALITY(ex) do { } while (0) | ||
90 | |||
91 | extern unsigned long vsyscall_ehdr; | ||
92 | extern unsigned long vsyscall_end; | ||
93 | extern unsigned long __kernel_vsyscall; | ||
94 | |||
95 | #define VSYSCALL_BASE vsyscall_ehdr | ||
96 | #define VSYSCALL_END vsyscall_end | ||
97 | |||
98 | /* | ||
99 | * This is the range that is readable by user mode, and things | ||
100 | * acting like user mode such as get_user_pages. | ||
101 | */ | ||
102 | #define FIXADDR_USER_START VSYSCALL_BASE | ||
103 | #define FIXADDR_USER_END VSYSCALL_END | ||
104 | |||
105 | /* | ||
106 | * Architecture-neutral AT_ values in 0-17, leave some room | ||
107 | * for more of them, start the x86-specific ones at 32. | ||
108 | */ | ||
109 | #define AT_SYSINFO 32 | ||
110 | #define AT_SYSINFO_EHDR 33 | ||
111 | |||
112 | #define ARCH_DLINFO \ | ||
113 | do { \ | ||
114 | if ( vsyscall_ehdr ) { \ | ||
115 | NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \ | ||
116 | NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \ | ||
117 | } \ | ||
118 | } while (0) | ||
119 | |||
120 | /* | ||
121 | * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out | ||
122 | * extra segments containing the vsyscall DSO contents. Dumping its | ||
123 | * contents makes post-mortem fully interpretable later without matching up | ||
124 | * the same kernel and hardware config to see what PC values meant. | ||
125 | * Dumping its extra ELF program headers includes all the other information | ||
126 | * a debugger needs to easily find how the vsyscall DSO was being used. | ||
127 | */ | ||
128 | #define ELF_CORE_EXTRA_PHDRS \ | ||
129 | (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 ) | ||
130 | |||
131 | #define ELF_CORE_WRITE_EXTRA_PHDRS \ | ||
132 | if ( vsyscall_ehdr ) { \ | ||
133 | const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \ | ||
134 | const struct elf_phdr *const phdrp = \ | ||
135 | (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \ | ||
136 | int i; \ | ||
137 | Elf32_Off ofs = 0; \ | ||
138 | for (i = 0; i < ehdrp->e_phnum; ++i) { \ | ||
139 | struct elf_phdr phdr = phdrp[i]; \ | ||
140 | if (phdr.p_type == PT_LOAD) { \ | ||
141 | ofs = phdr.p_offset = offset; \ | ||
142 | offset += phdr.p_filesz; \ | ||
143 | } \ | ||
144 | else \ | ||
145 | phdr.p_offset += ofs; \ | ||
146 | phdr.p_paddr = 0; /* match other core phdrs */ \ | ||
147 | DUMP_WRITE(&phdr, sizeof(phdr)); \ | ||
148 | } \ | ||
149 | } | ||
150 | #define ELF_CORE_WRITE_EXTRA_DATA \ | ||
151 | if ( vsyscall_ehdr ) { \ | ||
152 | const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \ | ||
153 | const struct elf_phdr *const phdrp = \ | ||
154 | (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \ | ||
155 | int i; \ | ||
156 | for (i = 0; i < ehdrp->e_phnum; ++i) { \ | ||
157 | if (phdrp[i].p_type == PT_LOAD) \ | ||
158 | DUMP_WRITE((void *) phdrp[i].p_vaddr, \ | ||
159 | phdrp[i].p_filesz); \ | ||
160 | } \ | ||
161 | } | ||
162 | |||
163 | #endif | ||
diff --git a/arch/um/sys-i386/asm/module.h b/arch/um/sys-i386/asm/module.h new file mode 100644 index 000000000000..5ead4a0b2e35 --- /dev/null +++ b/arch/um/sys-i386/asm/module.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __UM_MODULE_I386_H | ||
2 | #define __UM_MODULE_I386_H | ||
3 | |||
4 | /* UML is simple */ | ||
5 | struct mod_arch_specific | ||
6 | { | ||
7 | }; | ||
8 | |||
9 | #define Elf_Shdr Elf32_Shdr | ||
10 | #define Elf_Sym Elf32_Sym | ||
11 | #define Elf_Ehdr Elf32_Ehdr | ||
12 | |||
13 | #endif | ||
diff --git a/arch/um/sys-i386/asm/processor.h b/arch/um/sys-i386/asm/processor.h new file mode 100644 index 000000000000..82a9061ab5be --- /dev/null +++ b/arch/um/sys-i386/asm/processor.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PROCESSOR_I386_H | ||
7 | #define __UM_PROCESSOR_I386_H | ||
8 | |||
9 | #include "linux/string.h" | ||
10 | #include <sysdep/host_ldt.h> | ||
11 | #include "asm/segment.h" | ||
12 | |||
13 | extern int host_has_cmov; | ||
14 | |||
15 | /* include faultinfo structure */ | ||
16 | #include "sysdep/faultinfo.h" | ||
17 | |||
18 | struct uml_tls_struct { | ||
19 | struct user_desc tls; | ||
20 | unsigned flushed:1; | ||
21 | unsigned present:1; | ||
22 | }; | ||
23 | |||
24 | struct arch_thread { | ||
25 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ||
26 | unsigned long debugregs[8]; | ||
27 | int debugregs_seq; | ||
28 | struct faultinfo faultinfo; | ||
29 | }; | ||
30 | |||
31 | #define INIT_ARCH_THREAD { \ | ||
32 | .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \ | ||
33 | { .present = 0, .flushed = 0 } }, \ | ||
34 | .debugregs = { [ 0 ... 7 ] = 0 }, \ | ||
35 | .debugregs_seq = 0, \ | ||
36 | .faultinfo = { 0, 0, 0 } \ | ||
37 | } | ||
38 | |||
39 | static inline void arch_flush_thread(struct arch_thread *thread) | ||
40 | { | ||
41 | /* Clear any TLS still hanging */ | ||
42 | memset(&thread->tls_array, 0, sizeof(thread->tls_array)); | ||
43 | } | ||
44 | |||
45 | static inline void arch_copy_thread(struct arch_thread *from, | ||
46 | struct arch_thread *to) | ||
47 | { | ||
48 | memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array)); | ||
49 | } | ||
50 | |||
51 | #include <asm/user.h> | ||
52 | |||
53 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | ||
54 | static inline void rep_nop(void) | ||
55 | { | ||
56 | __asm__ __volatile__("rep;nop": : :"memory"); | ||
57 | } | ||
58 | |||
59 | #define cpu_relax() rep_nop() | ||
60 | |||
61 | /* | ||
62 | * Default implementation of macro that returns current | ||
63 | * instruction pointer ("program counter"). Stolen | ||
64 | * from asm-i386/processor.h | ||
65 | */ | ||
66 | #define current_text_addr() \ | ||
67 | ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) | ||
68 | |||
69 | #define ARCH_IS_STACKGROW(address) \ | ||
70 | (address + 32 >= UPT_SP(¤t->thread.regs.regs)) | ||
71 | |||
72 | #define KSTK_EIP(tsk) KSTK_REG(tsk, EIP) | ||
73 | #define KSTK_ESP(tsk) KSTK_REG(tsk, UESP) | ||
74 | #define KSTK_EBP(tsk) KSTK_REG(tsk, EBP) | ||
75 | |||
76 | #include "asm/processor-generic.h" | ||
77 | |||
78 | #endif | ||
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h new file mode 100644 index 000000000000..0273e4d09af7 --- /dev/null +++ b/arch/um/sys-i386/asm/ptrace.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PTRACE_I386_H | ||
7 | #define __UM_PTRACE_I386_H | ||
8 | |||
9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | ||
10 | |||
11 | #include "linux/compiler.h" | ||
12 | #include "asm/ptrace-generic.h" | ||
13 | |||
14 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) | ||
15 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) | ||
16 | #define PT_REGS_ECX(r) UPT_ECX(&(r)->regs) | ||
17 | #define PT_REGS_EDX(r) UPT_EDX(&(r)->regs) | ||
18 | #define PT_REGS_ESI(r) UPT_ESI(&(r)->regs) | ||
19 | #define PT_REGS_EDI(r) UPT_EDI(&(r)->regs) | ||
20 | #define PT_REGS_EBP(r) UPT_EBP(&(r)->regs) | ||
21 | |||
22 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | ||
23 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | ||
24 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | ||
25 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | ||
26 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | ||
27 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | ||
28 | |||
29 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | ||
30 | |||
31 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r) | ||
32 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) | ||
33 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | ||
34 | |||
35 | #define profile_pc(regs) PT_REGS_IP(regs) | ||
36 | |||
37 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
38 | |||
39 | /* | ||
40 | * Forward declaration to avoid including sysdep/tls.h, which causes a | ||
41 | * circular include, and compilation failures. | ||
42 | */ | ||
43 | struct user_desc; | ||
44 | |||
45 | extern int get_fpxregs(struct user_fxsr_struct __user *buf, | ||
46 | struct task_struct *child); | ||
47 | extern int set_fpxregs(struct user_fxsr_struct __user *buf, | ||
48 | struct task_struct *tsk); | ||
49 | |||
50 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
51 | struct user_desc __user *user_desc); | ||
52 | |||
53 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
54 | struct user_desc __user *user_desc); | ||
55 | |||
56 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/archsetjmp.h b/arch/um/sys-i386/shared/sysdep/archsetjmp.h index 0f312085ce1d..0f312085ce1d 100644 --- a/arch/um/include/sysdep-i386/archsetjmp.h +++ b/arch/um/sys-i386/shared/sysdep/archsetjmp.h | |||
diff --git a/arch/um/include/sysdep-i386/barrier.h b/arch/um/sys-i386/shared/sysdep/barrier.h index b58d52c5b2f4..b58d52c5b2f4 100644 --- a/arch/um/include/sysdep-i386/barrier.h +++ b/arch/um/sys-i386/shared/sysdep/barrier.h | |||
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/sys-i386/shared/sysdep/checksum.h index 0cb4645cbeb8..0cb4645cbeb8 100644 --- a/arch/um/include/sysdep-i386/checksum.h +++ b/arch/um/sys-i386/shared/sysdep/checksum.h | |||
diff --git a/arch/um/include/sysdep-i386/faultinfo.h b/arch/um/sys-i386/shared/sysdep/faultinfo.h index db437cc373bc..db437cc373bc 100644 --- a/arch/um/include/sysdep-i386/faultinfo.h +++ b/arch/um/sys-i386/shared/sysdep/faultinfo.h | |||
diff --git a/arch/um/sys-i386/shared/sysdep/host_ldt.h b/arch/um/sys-i386/shared/sysdep/host_ldt.h new file mode 100644 index 000000000000..0953cc4df652 --- /dev/null +++ b/arch/um/sys-i386/shared/sysdep/host_ldt.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __ASM_HOST_LDT_I386_H | ||
2 | #define __ASM_HOST_LDT_I386_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-i386/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | #define LDT_entry_b(info) \ | ||
13 | (((info)->base_addr & 0xff000000) | \ | ||
14 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
15 | ((info)->limit & 0xf0000) | \ | ||
16 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
17 | ((info)->contents << 10) | \ | ||
18 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
19 | ((info)->seg_32bit << 22) | \ | ||
20 | ((info)->limit_in_pages << 23) | \ | ||
21 | ((info)->useable << 20) | \ | ||
22 | 0x7000) | ||
23 | |||
24 | #define LDT_empty(info) (\ | ||
25 | (info)->base_addr == 0 && \ | ||
26 | (info)->limit == 0 && \ | ||
27 | (info)->contents == 0 && \ | ||
28 | (info)->read_exec_only == 1 && \ | ||
29 | (info)->seg_32bit == 0 && \ | ||
30 | (info)->limit_in_pages == 0 && \ | ||
31 | (info)->seg_not_present == 1 && \ | ||
32 | (info)->useable == 0 ) | ||
33 | |||
34 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/sys-i386/shared/sysdep/kernel-offsets.h index 5868526b5eef..5868526b5eef 100644 --- a/arch/um/include/sysdep-i386/kernel-offsets.h +++ b/arch/um/sys-i386/shared/sysdep/kernel-offsets.h | |||
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/sys-i386/shared/sysdep/ptrace.h index 11c08969d134..d50e62e07070 100644 --- a/arch/um/include/sysdep-i386/ptrace.h +++ b/arch/um/sys-i386/shared/sysdep/ptrace.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef __SYSDEP_I386_PTRACE_H | 6 | #ifndef __SYSDEP_I386_PTRACE_H |
7 | #define __SYSDEP_I386_PTRACE_H | 7 | #define __SYSDEP_I386_PTRACE_H |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | #include "user_constants.h" | 9 | #include "user_constants.h" |
11 | #include "sysdep/faultinfo.h" | 10 | #include "sysdep/faultinfo.h" |
12 | 11 | ||
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/sys-i386/shared/sysdep/ptrace_user.h index ef56247e4143..ef56247e4143 100644 --- a/arch/um/include/sysdep-i386/ptrace_user.h +++ b/arch/um/sys-i386/shared/sysdep/ptrace_user.h | |||
diff --git a/arch/um/include/sysdep-i386/sc.h b/arch/um/sys-i386/shared/sysdep/sc.h index c57d1780ad37..c57d1780ad37 100644 --- a/arch/um/include/sysdep-i386/sc.h +++ b/arch/um/sys-i386/shared/sysdep/sc.h | |||
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/sys-i386/shared/sysdep/sigcontext.h index f583c87111a0..f583c87111a0 100644 --- a/arch/um/include/sysdep-i386/sigcontext.h +++ b/arch/um/sys-i386/shared/sysdep/sigcontext.h | |||
diff --git a/arch/um/include/sysdep-i386/skas_ptrace.h b/arch/um/sys-i386/shared/sysdep/skas_ptrace.h index e27b8a791773..e27b8a791773 100644 --- a/arch/um/include/sysdep-i386/skas_ptrace.h +++ b/arch/um/sys-i386/shared/sysdep/skas_ptrace.h | |||
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/sys-i386/shared/sysdep/stub.h index 8c097b87fca7..977dedd9221b 100644 --- a/arch/um/include/sysdep-i386/stub.h +++ b/arch/um/sys-i386/shared/sysdep/stub.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include "as-layout.h" | 12 | #include "as-layout.h" |
13 | #include "stub-data.h" | 13 | #include "stub-data.h" |
14 | #include "kern_constants.h" | 14 | #include "kern_constants.h" |
15 | #include "uml-config.h" | ||
16 | 15 | ||
17 | extern void stub_segv_handler(int sig); | 16 | extern void stub_segv_handler(int sig); |
18 | extern void stub_clone_handler(void); | 17 | extern void stub_clone_handler(void); |
diff --git a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/sys-i386/shared/sysdep/syscalls.h index 905698197e35..905698197e35 100644 --- a/arch/um/include/sysdep-i386/syscalls.h +++ b/arch/um/sys-i386/shared/sysdep/syscalls.h | |||
diff --git a/arch/um/sys-i386/shared/sysdep/system.h b/arch/um/sys-i386/shared/sysdep/system.h new file mode 100644 index 000000000000..d1b93c436200 --- /dev/null +++ b/arch/um/sys-i386/shared/sysdep/system.h | |||
@@ -0,0 +1,132 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_H_ | ||
2 | #define _ASM_X86_SYSTEM_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* entries in ARCH_DLINFO: */ | ||
14 | #ifdef CONFIG_IA32_EMULATION | ||
15 | # define AT_VECTOR_SIZE_ARCH 2 | ||
16 | #else | ||
17 | # define AT_VECTOR_SIZE_ARCH 1 | ||
18 | #endif | ||
19 | |||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | void default_idle(void); | ||
23 | |||
24 | /* | ||
25 | * Force strict CPU ordering. | ||
26 | * And yes, this is required on UP too when we're talking | ||
27 | * to devices. | ||
28 | */ | ||
29 | #ifdef CONFIG_X86_32 | ||
30 | /* | ||
31 | * Some non-Intel clones support out of order store. wmb() ceases to be a | ||
32 | * nop for these. | ||
33 | */ | ||
34 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
35 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
36 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
37 | #else | ||
38 | #define mb() asm volatile("mfence":::"memory") | ||
39 | #define rmb() asm volatile("lfence":::"memory") | ||
40 | #define wmb() asm volatile("sfence" ::: "memory") | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * read_barrier_depends - Flush all pending reads that subsequents reads | ||
45 | * depend on. | ||
46 | * | ||
47 | * No data-dependent reads from memory-like regions are ever reordered | ||
48 | * over this barrier. All reads preceding this primitive are guaranteed | ||
49 | * to access memory (but not necessarily other CPUs' caches) before any | ||
50 | * reads following this primitive that depend on the data return by | ||
51 | * any of the preceding reads. This primitive is much lighter weight than | ||
52 | * rmb() on most CPUs, and is never heavier weight than is | ||
53 | * rmb(). | ||
54 | * | ||
55 | * These ordering constraints are respected by both the local CPU | ||
56 | * and the compiler. | ||
57 | * | ||
58 | * Ordering is not guaranteed by anything other than these primitives, | ||
59 | * not even by data dependencies. See the documentation for | ||
60 | * memory_barrier() for examples and URLs to more information. | ||
61 | * | ||
62 | * For example, the following code would force ordering (the initial | ||
63 | * value of "a" is zero, "b" is one, and "p" is "&a"): | ||
64 | * | ||
65 | * <programlisting> | ||
66 | * CPU 0 CPU 1 | ||
67 | * | ||
68 | * b = 2; | ||
69 | * memory_barrier(); | ||
70 | * p = &b; q = p; | ||
71 | * read_barrier_depends(); | ||
72 | * d = *q; | ||
73 | * </programlisting> | ||
74 | * | ||
75 | * because the read of "*q" depends on the read of "p" and these | ||
76 | * two reads are separated by a read_barrier_depends(). However, | ||
77 | * the following code, with the same initial values for "a" and "b": | ||
78 | * | ||
79 | * <programlisting> | ||
80 | * CPU 0 CPU 1 | ||
81 | * | ||
82 | * a = 2; | ||
83 | * memory_barrier(); | ||
84 | * b = 3; y = b; | ||
85 | * read_barrier_depends(); | ||
86 | * x = a; | ||
87 | * </programlisting> | ||
88 | * | ||
89 | * does not enforce ordering, since there is no data dependency between | ||
90 | * the read of "a" and the read of "b". Therefore, on some CPUs, such | ||
91 | * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() | ||
92 | * in cases like this where there are no data dependencies. | ||
93 | **/ | ||
94 | |||
95 | #define read_barrier_depends() do { } while (0) | ||
96 | |||
97 | #ifdef CONFIG_SMP | ||
98 | #define smp_mb() mb() | ||
99 | #ifdef CONFIG_X86_PPRO_FENCE | ||
100 | # define smp_rmb() rmb() | ||
101 | #else | ||
102 | # define smp_rmb() barrier() | ||
103 | #endif | ||
104 | #ifdef CONFIG_X86_OOSTORE | ||
105 | # define smp_wmb() wmb() | ||
106 | #else | ||
107 | # define smp_wmb() barrier() | ||
108 | #endif | ||
109 | #define smp_read_barrier_depends() read_barrier_depends() | ||
110 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
111 | #else | ||
112 | #define smp_mb() barrier() | ||
113 | #define smp_rmb() barrier() | ||
114 | #define smp_wmb() barrier() | ||
115 | #define smp_read_barrier_depends() do { } while (0) | ||
116 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
117 | #endif | ||
118 | |||
119 | /* | ||
120 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
121 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
122 | * code region. | ||
123 | * | ||
124 | * (Could use an alternative three way for this if there was one.) | ||
125 | */ | ||
126 | static inline void rdtsc_barrier(void) | ||
127 | { | ||
128 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
129 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
130 | } | ||
131 | |||
132 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/tls.h b/arch/um/sys-i386/shared/sysdep/tls.h index 918fd3c5ff9c..34550755b2a1 100644 --- a/arch/um/include/sysdep-i386/tls.h +++ b/arch/um/sys-i386/shared/sysdep/tls.h | |||
@@ -21,7 +21,7 @@ typedef struct um_dup_user_desc { | |||
21 | 21 | ||
22 | # else /* __KERNEL__ */ | 22 | # else /* __KERNEL__ */ |
23 | 23 | ||
24 | # include <asm/ldt.h> | 24 | # include <ldt.h> |
25 | typedef struct user_desc user_desc_t; | 25 | typedef struct user_desc user_desc_t; |
26 | 26 | ||
27 | # endif /* __KERNEL__ */ | 27 | # endif /* __KERNEL__ */ |
diff --git a/arch/um/sys-i386/shared/sysdep/vm-flags.h b/arch/um/sys-i386/shared/sysdep/vm-flags.h new file mode 100644 index 000000000000..e0d24c568dbc --- /dev/null +++ b/arch/um/sys-i386/shared/sysdep/vm-flags.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __VM_FLAGS_I386_H | ||
7 | #define __VM_FLAGS_I386_H | ||
8 | |||
9 | #define VM_DATA_DEFAULT_FLAGS \ | ||
10 | (VM_READ | VM_WRITE | \ | ||
11 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | ||
12 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
13 | |||
14 | #endif | ||
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index fd0c25ad6af3..129647375a6c 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c | |||
@@ -179,7 +179,8 @@ static int copy_sc_from_user(struct pt_regs *regs, | |||
179 | if (have_fpx_regs) { | 179 | if (have_fpx_regs) { |
180 | struct user_fxsr_struct fpx; | 180 | struct user_fxsr_struct fpx; |
181 | 181 | ||
182 | err = copy_from_user(&fpx, &sc.fpstate->_fxsr_env[0], | 182 | err = copy_from_user(&fpx, |
183 | &((struct _fpstate __user *)sc.fpstate)->_fxsr_env[0], | ||
183 | sizeof(struct user_fxsr_struct)); | 184 | sizeof(struct user_fxsr_struct)); |
184 | if (err) | 185 | if (err) |
185 | return 1; | 186 | return 1; |
diff --git a/arch/um/sys-i386/stub.S b/arch/um/sys-i386/stub.S index 7699e89f660f..c41b04bf5fa0 100644 --- a/arch/um/sys-i386/stub.S +++ b/arch/um/sys-i386/stub.S | |||
@@ -1,4 +1,3 @@ | |||
1 | #include "uml-config.h" | ||
2 | #include "as-layout.h" | 1 | #include "as-layout.h" |
3 | 2 | ||
4 | .globl syscall_stub | 3 | .globl syscall_stub |
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c index e2d142684412..857ca0b3bdef 100644 --- a/arch/um/sys-i386/syscalls.c +++ b/arch/um/sys-i386/syscalls.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include "linux/sched.h" | 6 | #include "linux/sched.h" |
7 | #include "linux/shm.h" | 7 | #include "linux/shm.h" |
8 | #include "linux/ipc.h" | 8 | #include "linux/ipc.h" |
9 | #include "linux/syscalls.h" | ||
9 | #include "asm/mman.h" | 10 | #include "asm/mman.h" |
10 | #include "asm/uaccess.h" | 11 | #include "asm/uaccess.h" |
11 | #include "asm/unistd.h" | 12 | #include "asm/unistd.h" |
diff --git a/arch/um/include/sysdep-ia64/ptrace.h b/arch/um/sys-ia64/sysdep/ptrace.h index 42dd8fb6f2f9..42dd8fb6f2f9 100644 --- a/arch/um/include/sysdep-ia64/ptrace.h +++ b/arch/um/sys-ia64/sysdep/ptrace.h | |||
diff --git a/arch/um/include/sysdep-ia64/sigcontext.h b/arch/um/sys-ia64/sysdep/sigcontext.h index f15fb25260ba..f15fb25260ba 100644 --- a/arch/um/include/sysdep-ia64/sigcontext.h +++ b/arch/um/sys-ia64/sysdep/sigcontext.h | |||
diff --git a/arch/um/include/sysdep-ia64/skas_ptrace.h b/arch/um/sys-ia64/sysdep/skas_ptrace.h index 25a38e715702..25a38e715702 100644 --- a/arch/um/include/sysdep-ia64/skas_ptrace.h +++ b/arch/um/sys-ia64/sysdep/skas_ptrace.h | |||
diff --git a/arch/um/include/sysdep-ia64/syscalls.h b/arch/um/sys-ia64/sysdep/syscalls.h index 4a1f46ef1ebc..4a1f46ef1ebc 100644 --- a/arch/um/include/sysdep-ia64/syscalls.h +++ b/arch/um/sys-ia64/sysdep/syscalls.h | |||
diff --git a/arch/um/sys-ppc/asm/archparam.h b/arch/um/sys-ppc/asm/archparam.h new file mode 100644 index 000000000000..4269d8a37b4f --- /dev/null +++ b/arch/um/sys-ppc/asm/archparam.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __UM_ARCHPARAM_PPC_H | ||
2 | #define __UM_ARCHPARAM_PPC_H | ||
3 | |||
4 | /********* Bits for asm-um/string.h **********/ | ||
5 | |||
6 | #define __HAVE_ARCH_STRRCHR | ||
7 | |||
8 | #endif | ||
diff --git a/arch/um/sys-ppc/asm/elf.h b/arch/um/sys-ppc/asm/elf.h new file mode 100644 index 000000000000..af9463cd8ce5 --- /dev/null +++ b/arch/um/sys-ppc/asm/elf.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __UM_ELF_PPC_H | ||
2 | #define __UM_ELF_PPC_H | ||
3 | |||
4 | |||
5 | extern long elf_aux_hwcap; | ||
6 | #define ELF_HWCAP (elf_aux_hwcap) | ||
7 | |||
8 | #define SET_PERSONALITY(ex) do ; while(0) | ||
9 | |||
10 | #define ELF_EXEC_PAGESIZE 4096 | ||
11 | |||
12 | #define elf_check_arch(x) (1) | ||
13 | |||
14 | #ifdef CONFIG_64BIT | ||
15 | #define ELF_CLASS ELFCLASS64 | ||
16 | #else | ||
17 | #define ELF_CLASS ELFCLASS32 | ||
18 | #endif | ||
19 | |||
20 | #define USE_ELF_CORE_DUMP | ||
21 | |||
22 | #define R_386_NONE 0 | ||
23 | #define R_386_32 1 | ||
24 | #define R_386_PC32 2 | ||
25 | #define R_386_GOT32 3 | ||
26 | #define R_386_PLT32 4 | ||
27 | #define R_386_COPY 5 | ||
28 | #define R_386_GLOB_DAT 6 | ||
29 | #define R_386_JMP_SLOT 7 | ||
30 | #define R_386_RELATIVE 8 | ||
31 | #define R_386_GOTOFF 9 | ||
32 | #define R_386_GOTPC 10 | ||
33 | #define R_386_NUM 11 | ||
34 | |||
35 | #define ELF_PLATFORM (0) | ||
36 | |||
37 | #define ELF_ET_DYN_BASE (0x08000000) | ||
38 | |||
39 | /* the following stolen from asm-ppc/elf.h */ | ||
40 | #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ | ||
41 | #define ELF_NFPREG 33 /* includes fpscr */ | ||
42 | /* General registers */ | ||
43 | typedef unsigned long elf_greg_t; | ||
44 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
45 | |||
46 | /* Floating point registers */ | ||
47 | typedef double elf_fpreg_t; | ||
48 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
49 | |||
50 | #define ELF_DATA ELFDATA2MSB | ||
51 | #define ELF_ARCH EM_PPC | ||
52 | |||
53 | #endif | ||
diff --git a/arch/um/sys-ppc/asm/processor.h b/arch/um/sys-ppc/asm/processor.h new file mode 100644 index 000000000000..959323151229 --- /dev/null +++ b/arch/um/sys-ppc/asm/processor.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __UM_PROCESSOR_PPC_H | ||
2 | #define __UM_PROCESSOR_PPC_H | ||
3 | |||
4 | #if defined(__ASSEMBLY__) | ||
5 | |||
6 | #define CONFIG_PPC_MULTIPLATFORM | ||
7 | #include "arch/processor.h" | ||
8 | |||
9 | #else | ||
10 | |||
11 | #include "asm/processor-generic.h" | ||
12 | |||
13 | #endif | ||
14 | |||
15 | #endif | ||
diff --git a/arch/um/include/sysdep-ppc/ptrace.h b/arch/um/sys-ppc/shared/sysdep/ptrace.h index df2397dba3e5..df2397dba3e5 100644 --- a/arch/um/include/sysdep-ppc/ptrace.h +++ b/arch/um/sys-ppc/shared/sysdep/ptrace.h | |||
diff --git a/arch/um/include/sysdep-ppc/sigcontext.h b/arch/um/sys-ppc/shared/sysdep/sigcontext.h index f20d965de9c7..f20d965de9c7 100644 --- a/arch/um/include/sysdep-ppc/sigcontext.h +++ b/arch/um/sys-ppc/shared/sysdep/sigcontext.h | |||
diff --git a/arch/um/include/sysdep-ppc/skas_ptrace.h b/arch/um/sys-ppc/shared/sysdep/skas_ptrace.h index d9fbbac10de0..d9fbbac10de0 100644 --- a/arch/um/include/sysdep-ppc/skas_ptrace.h +++ b/arch/um/sys-ppc/shared/sysdep/skas_ptrace.h | |||
diff --git a/arch/um/include/sysdep-ppc/syscalls.h b/arch/um/sys-ppc/shared/sysdep/syscalls.h index 679df351e19b..679df351e19b 100644 --- a/arch/um/include/sysdep-ppc/syscalls.h +++ b/arch/um/sys-ppc/shared/sysdep/syscalls.h | |||
diff --git a/arch/um/sys-x86_64/asm/archparam.h b/arch/um/sys-x86_64/asm/archparam.h new file mode 100644 index 000000000000..270ed9586b68 --- /dev/null +++ b/arch/um/sys-x86_64/asm/archparam.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_ARCHPARAM_X86_64_H | ||
8 | #define __UM_ARCHPARAM_X86_64_H | ||
9 | |||
10 | |||
11 | /* No user-accessible fixmap addresses, i.e. vsyscall */ | ||
12 | #define FIXADDR_USER_START 0 | ||
13 | #define FIXADDR_USER_END 0 | ||
14 | |||
15 | #endif | ||
16 | |||
17 | /* | ||
18 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
19 | * Emacs will notice this stuff at the end of the file and automatically | ||
20 | * adjust the settings for this buffer only. This must remain at the end | ||
21 | * of the file. | ||
22 | * --------------------------------------------------------------------------- | ||
23 | * Local variables: | ||
24 | * c-file-style: "linux" | ||
25 | * End: | ||
26 | */ | ||
diff --git a/arch/um/sys-x86_64/asm/elf.h b/arch/um/sys-x86_64/asm/elf.h new file mode 100644 index 000000000000..6e8a9195e952 --- /dev/null +++ b/arch/um/sys-x86_64/asm/elf.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
4 | * | ||
5 | * Licensed under the GPL | ||
6 | */ | ||
7 | #ifndef __UM_ELF_X86_64_H | ||
8 | #define __UM_ELF_X86_64_H | ||
9 | |||
10 | #include <asm/user.h> | ||
11 | #include "skas.h" | ||
12 | |||
13 | /* x86-64 relocation types, taken from asm-x86_64/elf.h */ | ||
14 | #define R_X86_64_NONE 0 /* No reloc */ | ||
15 | #define R_X86_64_64 1 /* Direct 64 bit */ | ||
16 | #define R_X86_64_PC32 2 /* PC relative 32 bit signed */ | ||
17 | #define R_X86_64_GOT32 3 /* 32 bit GOT entry */ | ||
18 | #define R_X86_64_PLT32 4 /* 32 bit PLT address */ | ||
19 | #define R_X86_64_COPY 5 /* Copy symbol at runtime */ | ||
20 | #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ | ||
21 | #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ | ||
22 | #define R_X86_64_RELATIVE 8 /* Adjust by program base */ | ||
23 | #define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative | ||
24 | offset to GOT */ | ||
25 | #define R_X86_64_32 10 /* Direct 32 bit zero extended */ | ||
26 | #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ | ||
27 | #define R_X86_64_16 12 /* Direct 16 bit zero extended */ | ||
28 | #define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ | ||
29 | #define R_X86_64_8 14 /* Direct 8 bit sign extended */ | ||
30 | #define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ | ||
31 | |||
32 | #define R_X86_64_NUM 16 | ||
33 | |||
34 | typedef unsigned long elf_greg_t; | ||
35 | |||
36 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
37 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
38 | |||
39 | typedef struct user_i387_struct elf_fpregset_t; | ||
40 | |||
41 | /* | ||
42 | * This is used to ensure we don't load something for the wrong architecture. | ||
43 | */ | ||
44 | #define elf_check_arch(x) \ | ||
45 | ((x)->e_machine == EM_X86_64) | ||
46 | |||
47 | #define ELF_CLASS ELFCLASS64 | ||
48 | #define ELF_DATA ELFDATA2LSB | ||
49 | #define ELF_ARCH EM_X86_64 | ||
50 | |||
51 | #define ELF_PLAT_INIT(regs, load_addr) do { \ | ||
52 | PT_REGS_RBX(regs) = 0; \ | ||
53 | PT_REGS_RCX(regs) = 0; \ | ||
54 | PT_REGS_RDX(regs) = 0; \ | ||
55 | PT_REGS_RSI(regs) = 0; \ | ||
56 | PT_REGS_RDI(regs) = 0; \ | ||
57 | PT_REGS_RBP(regs) = 0; \ | ||
58 | PT_REGS_RAX(regs) = 0; \ | ||
59 | PT_REGS_R8(regs) = 0; \ | ||
60 | PT_REGS_R9(regs) = 0; \ | ||
61 | PT_REGS_R10(regs) = 0; \ | ||
62 | PT_REGS_R11(regs) = 0; \ | ||
63 | PT_REGS_R12(regs) = 0; \ | ||
64 | PT_REGS_R13(regs) = 0; \ | ||
65 | PT_REGS_R14(regs) = 0; \ | ||
66 | PT_REGS_R15(regs) = 0; \ | ||
67 | } while (0) | ||
68 | |||
69 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ | ||
70 | (pr_reg)[0] = (regs)->regs.gp[0]; \ | ||
71 | (pr_reg)[1] = (regs)->regs.gp[1]; \ | ||
72 | (pr_reg)[2] = (regs)->regs.gp[2]; \ | ||
73 | (pr_reg)[3] = (regs)->regs.gp[3]; \ | ||
74 | (pr_reg)[4] = (regs)->regs.gp[4]; \ | ||
75 | (pr_reg)[5] = (regs)->regs.gp[5]; \ | ||
76 | (pr_reg)[6] = (regs)->regs.gp[6]; \ | ||
77 | (pr_reg)[7] = (regs)->regs.gp[7]; \ | ||
78 | (pr_reg)[8] = (regs)->regs.gp[8]; \ | ||
79 | (pr_reg)[9] = (regs)->regs.gp[9]; \ | ||
80 | (pr_reg)[10] = (regs)->regs.gp[10]; \ | ||
81 | (pr_reg)[11] = (regs)->regs.gp[11]; \ | ||
82 | (pr_reg)[12] = (regs)->regs.gp[12]; \ | ||
83 | (pr_reg)[13] = (regs)->regs.gp[13]; \ | ||
84 | (pr_reg)[14] = (regs)->regs.gp[14]; \ | ||
85 | (pr_reg)[15] = (regs)->regs.gp[15]; \ | ||
86 | (pr_reg)[16] = (regs)->regs.gp[16]; \ | ||
87 | (pr_reg)[17] = (regs)->regs.gp[17]; \ | ||
88 | (pr_reg)[18] = (regs)->regs.gp[18]; \ | ||
89 | (pr_reg)[19] = (regs)->regs.gp[19]; \ | ||
90 | (pr_reg)[20] = (regs)->regs.gp[20]; \ | ||
91 | (pr_reg)[21] = current->thread.arch.fs; \ | ||
92 | (pr_reg)[22] = 0; \ | ||
93 | (pr_reg)[23] = 0; \ | ||
94 | (pr_reg)[24] = 0; \ | ||
95 | (pr_reg)[25] = 0; \ | ||
96 | (pr_reg)[26] = 0; | ||
97 | |||
98 | extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); | ||
99 | |||
100 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) | ||
101 | |||
102 | #ifdef TIF_IA32 /* XXX */ | ||
103 | #error XXX, indeed | ||
104 | clear_thread_flag(TIF_IA32); | ||
105 | #endif | ||
106 | |||
107 | #define USE_ELF_CORE_DUMP | ||
108 | #define ELF_EXEC_PAGESIZE 4096 | ||
109 | |||
110 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
111 | |||
112 | extern long elf_aux_hwcap; | ||
113 | #define ELF_HWCAP (elf_aux_hwcap) | ||
114 | |||
115 | #define ELF_PLATFORM "x86_64" | ||
116 | |||
117 | #define SET_PERSONALITY(ex) do ; while(0) | ||
118 | |||
119 | #endif | ||
diff --git a/arch/um/sys-x86_64/asm/module.h b/arch/um/sys-x86_64/asm/module.h new file mode 100644 index 000000000000..35b5491d3e96 --- /dev/null +++ b/arch/um/sys-x86_64/asm/module.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_MODULE_X86_64_H | ||
8 | #define __UM_MODULE_X86_64_H | ||
9 | |||
10 | /* UML is simple */ | ||
11 | struct mod_arch_specific | ||
12 | { | ||
13 | }; | ||
14 | |||
15 | #define Elf_Shdr Elf64_Shdr | ||
16 | #define Elf_Sym Elf64_Sym | ||
17 | #define Elf_Ehdr Elf64_Ehdr | ||
18 | |||
19 | #endif | ||
20 | |||
21 | /* | ||
22 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
23 | * Emacs will notice this stuff at the end of the file and automatically | ||
24 | * adjust the settings for this buffer only. This must remain at the end | ||
25 | * of the file. | ||
26 | * --------------------------------------------------------------------------- | ||
27 | * Local variables: | ||
28 | * c-file-style: "linux" | ||
29 | * End: | ||
30 | */ | ||
diff --git a/arch/um/sys-x86_64/asm/processor.h b/arch/um/sys-x86_64/asm/processor.h new file mode 100644 index 000000000000..875a26a62614 --- /dev/null +++ b/arch/um/sys-x86_64/asm/processor.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PROCESSOR_X86_64_H | ||
8 | #define __UM_PROCESSOR_X86_64_H | ||
9 | |||
10 | /* include faultinfo structure */ | ||
11 | #include "sysdep/faultinfo.h" | ||
12 | |||
13 | struct arch_thread { | ||
14 | unsigned long debugregs[8]; | ||
15 | int debugregs_seq; | ||
16 | unsigned long fs; | ||
17 | struct faultinfo faultinfo; | ||
18 | }; | ||
19 | |||
20 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | ||
21 | static inline void rep_nop(void) | ||
22 | { | ||
23 | __asm__ __volatile__("rep;nop": : :"memory"); | ||
24 | } | ||
25 | |||
26 | #define cpu_relax() rep_nop() | ||
27 | |||
28 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ | ||
29 | .debugregs_seq = 0, \ | ||
30 | .fs = 0, \ | ||
31 | .faultinfo = { 0, 0, 0 } } | ||
32 | |||
33 | static inline void arch_flush_thread(struct arch_thread *thread) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | static inline void arch_copy_thread(struct arch_thread *from, | ||
38 | struct arch_thread *to) | ||
39 | { | ||
40 | to->fs = from->fs; | ||
41 | } | ||
42 | |||
43 | #include <asm/user.h> | ||
44 | |||
45 | #define current_text_addr() \ | ||
46 | ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) | ||
47 | |||
48 | #define ARCH_IS_STACKGROW(address) \ | ||
49 | (address + 128 >= UPT_SP(¤t->thread.regs.regs)) | ||
50 | |||
51 | #define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) | ||
52 | #define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) | ||
53 | |||
54 | #include "asm/processor-generic.h" | ||
55 | |||
56 | #endif | ||
diff --git a/arch/um/sys-x86_64/asm/ptrace.h b/arch/um/sys-x86_64/asm/ptrace.h new file mode 100644 index 000000000000..83d8c473b905 --- /dev/null +++ b/arch/um/sys-x86_64/asm/ptrace.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PTRACE_X86_64_H | ||
8 | #define __UM_PTRACE_X86_64_H | ||
9 | |||
10 | #include "linux/compiler.h" | ||
11 | #include "asm/errno.h" | ||
12 | |||
13 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | ||
14 | #include "asm/ptrace-generic.h" | ||
15 | |||
16 | #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64 | ||
17 | |||
18 | #define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) | ||
19 | #define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) | ||
20 | #define PT_REGS_RDX(r) UPT_RDX(&(r)->regs) | ||
21 | #define PT_REGS_RSI(r) UPT_RSI(&(r)->regs) | ||
22 | #define PT_REGS_RDI(r) UPT_RDI(&(r)->regs) | ||
23 | #define PT_REGS_RBP(r) UPT_RBP(&(r)->regs) | ||
24 | #define PT_REGS_RAX(r) UPT_RAX(&(r)->regs) | ||
25 | #define PT_REGS_R8(r) UPT_R8(&(r)->regs) | ||
26 | #define PT_REGS_R9(r) UPT_R9(&(r)->regs) | ||
27 | #define PT_REGS_R10(r) UPT_R10(&(r)->regs) | ||
28 | #define PT_REGS_R11(r) UPT_R11(&(r)->regs) | ||
29 | #define PT_REGS_R12(r) UPT_R12(&(r)->regs) | ||
30 | #define PT_REGS_R13(r) UPT_R13(&(r)->regs) | ||
31 | #define PT_REGS_R14(r) UPT_R14(&(r)->regs) | ||
32 | #define PT_REGS_R15(r) UPT_R15(&(r)->regs) | ||
33 | |||
34 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | ||
35 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | ||
36 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | ||
37 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | ||
38 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | ||
39 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | ||
40 | |||
41 | #define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs) | ||
42 | #define PT_REGS_RIP(r) UPT_IP(&(r)->regs) | ||
43 | #define PT_REGS_RSP(r) UPT_SP(&(r)->regs) | ||
44 | |||
45 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | ||
46 | |||
47 | /* XXX */ | ||
48 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
49 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_RAX(r) | ||
50 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_RAX(r) | ||
51 | |||
52 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | ||
53 | |||
54 | #define profile_pc(regs) PT_REGS_IP(regs) | ||
55 | |||
56 | struct user_desc; | ||
57 | |||
58 | static inline int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
59 | struct user_desc __user *user_desc) | ||
60 | { | ||
61 | return -ENOSYS; | ||
62 | } | ||
63 | |||
64 | static inline int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
65 | struct user_desc __user *user_desc) | ||
66 | { | ||
67 | return -ENOSYS; | ||
68 | } | ||
69 | |||
70 | extern long arch_prctl(struct task_struct *task, int code, | ||
71 | unsigned long __user *addr); | ||
72 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/archsetjmp.h b/arch/um/sys-x86_64/shared/sysdep/archsetjmp.h index 2af8f12ca161..2af8f12ca161 100644 --- a/arch/um/include/sysdep-x86_64/archsetjmp.h +++ b/arch/um/sys-x86_64/shared/sysdep/archsetjmp.h | |||
diff --git a/arch/um/include/sysdep-x86_64/barrier.h b/arch/um/sys-x86_64/shared/sysdep/barrier.h index 7b610befdc8f..7b610befdc8f 100644 --- a/arch/um/include/sysdep-x86_64/barrier.h +++ b/arch/um/sys-x86_64/shared/sysdep/barrier.h | |||
diff --git a/arch/um/include/sysdep-x86_64/checksum.h b/arch/um/sys-x86_64/shared/sysdep/checksum.h index a5be9031ea85..a5be9031ea85 100644 --- a/arch/um/include/sysdep-x86_64/checksum.h +++ b/arch/um/sys-x86_64/shared/sysdep/checksum.h | |||
diff --git a/arch/um/include/sysdep-x86_64/faultinfo.h b/arch/um/sys-x86_64/shared/sysdep/faultinfo.h index cb917b0d5660..cb917b0d5660 100644 --- a/arch/um/include/sysdep-x86_64/faultinfo.h +++ b/arch/um/sys-x86_64/shared/sysdep/faultinfo.h | |||
diff --git a/arch/um/sys-x86_64/shared/sysdep/host_ldt.h b/arch/um/sys-x86_64/shared/sysdep/host_ldt.h new file mode 100644 index 000000000000..e8b1be1e154f --- /dev/null +++ b/arch/um/sys-x86_64/shared/sysdep/host_ldt.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef __ASM_HOST_LDT_X86_64_H | ||
2 | #define __ASM_HOST_LDT_X86_64_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-x86_64/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | /* Don't allow setting of the lm bit. It is useless anyways because | ||
13 | * 64bit system calls require __USER_CS. */ | ||
14 | #define LDT_entry_b(info) \ | ||
15 | (((info)->base_addr & 0xff000000) | \ | ||
16 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
17 | ((info)->limit & 0xf0000) | \ | ||
18 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
19 | ((info)->contents << 10) | \ | ||
20 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
21 | ((info)->seg_32bit << 22) | \ | ||
22 | ((info)->limit_in_pages << 23) | \ | ||
23 | ((info)->useable << 20) | \ | ||
24 | /* ((info)->lm << 21) | */ \ | ||
25 | 0x7000) | ||
26 | |||
27 | #define LDT_empty(info) (\ | ||
28 | (info)->base_addr == 0 && \ | ||
29 | (info)->limit == 0 && \ | ||
30 | (info)->contents == 0 && \ | ||
31 | (info)->read_exec_only == 1 && \ | ||
32 | (info)->seg_32bit == 0 && \ | ||
33 | (info)->limit_in_pages == 0 && \ | ||
34 | (info)->seg_not_present == 1 && \ | ||
35 | (info)->useable == 0 && \ | ||
36 | (info)->lm == 0) | ||
37 | |||
38 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h index a307237b7964..a307237b7964 100644 --- a/arch/um/include/sysdep-x86_64/kernel-offsets.h +++ b/arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h | |||
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/sys-x86_64/shared/sysdep/ptrace.h index 9ea44d111f33..fdba5457947a 100644 --- a/arch/um/include/sysdep-x86_64/ptrace.h +++ b/arch/um/sys-x86_64/shared/sysdep/ptrace.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #ifndef __SYSDEP_X86_64_PTRACE_H | 8 | #ifndef __SYSDEP_X86_64_PTRACE_H |
9 | #define __SYSDEP_X86_64_PTRACE_H | 9 | #define __SYSDEP_X86_64_PTRACE_H |
10 | 10 | ||
11 | #include "uml-config.h" | ||
12 | #include "user_constants.h" | 11 | #include "user_constants.h" |
13 | #include "sysdep/faultinfo.h" | 12 | #include "sysdep/faultinfo.h" |
14 | 13 | ||
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/sys-x86_64/shared/sysdep/ptrace_user.h index 4dbccdb58f48..4dbccdb58f48 100644 --- a/arch/um/include/sysdep-x86_64/ptrace_user.h +++ b/arch/um/sys-x86_64/shared/sysdep/ptrace_user.h | |||
diff --git a/arch/um/include/sysdep-x86_64/sc.h b/arch/um/sys-x86_64/shared/sysdep/sc.h index 8aee45b07434..8aee45b07434 100644 --- a/arch/um/include/sysdep-x86_64/sc.h +++ b/arch/um/sys-x86_64/shared/sysdep/sc.h | |||
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/sys-x86_64/shared/sysdep/sigcontext.h index 0155133b1458..0155133b1458 100644 --- a/arch/um/include/sysdep-x86_64/sigcontext.h +++ b/arch/um/sys-x86_64/shared/sysdep/sigcontext.h | |||
diff --git a/arch/um/include/sysdep-x86_64/skas_ptrace.h b/arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h index 95db4be786e4..95db4be786e4 100644 --- a/arch/um/include/sysdep-x86_64/skas_ptrace.h +++ b/arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h | |||
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/sys-x86_64/shared/sysdep/stub.h index 655f9c2de3ac..3432aa249970 100644 --- a/arch/um/include/sysdep-x86_64/stub.h +++ b/arch/um/sys-x86_64/shared/sysdep/stub.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include "as-layout.h" | 12 | #include "as-layout.h" |
13 | #include "stub-data.h" | 13 | #include "stub-data.h" |
14 | #include "kern_constants.h" | 14 | #include "kern_constants.h" |
15 | #include "uml-config.h" | ||
16 | 15 | ||
17 | extern void stub_segv_handler(int sig); | 16 | extern void stub_segv_handler(int sig); |
18 | extern void stub_clone_handler(void); | 17 | extern void stub_clone_handler(void); |
diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/sys-x86_64/shared/sysdep/syscalls.h index 7cfb0b085655..7cfb0b085655 100644 --- a/arch/um/include/sysdep-x86_64/syscalls.h +++ b/arch/um/sys-x86_64/shared/sysdep/syscalls.h | |||
diff --git a/arch/um/sys-x86_64/shared/sysdep/system.h b/arch/um/sys-x86_64/shared/sysdep/system.h new file mode 100644 index 000000000000..d1b93c436200 --- /dev/null +++ b/arch/um/sys-x86_64/shared/sysdep/system.h | |||
@@ -0,0 +1,132 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_H_ | ||
2 | #define _ASM_X86_SYSTEM_H_ | ||
3 | |||
4 | #include <asm/asm.h> | ||
5 | #include <asm/segment.h> | ||
6 | #include <asm/cpufeature.h> | ||
7 | #include <asm/cmpxchg.h> | ||
8 | #include <asm/nops.h> | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/irqflags.h> | ||
12 | |||
13 | /* entries in ARCH_DLINFO: */ | ||
14 | #ifdef CONFIG_IA32_EMULATION | ||
15 | # define AT_VECTOR_SIZE_ARCH 2 | ||
16 | #else | ||
17 | # define AT_VECTOR_SIZE_ARCH 1 | ||
18 | #endif | ||
19 | |||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | void default_idle(void); | ||
23 | |||
24 | /* | ||
25 | * Force strict CPU ordering. | ||
26 | * And yes, this is required on UP too when we're talking | ||
27 | * to devices. | ||
28 | */ | ||
29 | #ifdef CONFIG_X86_32 | ||
30 | /* | ||
31 | * Some non-Intel clones support out of order store. wmb() ceases to be a | ||
32 | * nop for these. | ||
33 | */ | ||
34 | #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) | ||
35 | #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) | ||
36 | #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) | ||
37 | #else | ||
38 | #define mb() asm volatile("mfence":::"memory") | ||
39 | #define rmb() asm volatile("lfence":::"memory") | ||
40 | #define wmb() asm volatile("sfence" ::: "memory") | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * read_barrier_depends - Flush all pending reads that subsequents reads | ||
45 | * depend on. | ||
46 | * | ||
47 | * No data-dependent reads from memory-like regions are ever reordered | ||
48 | * over this barrier. All reads preceding this primitive are guaranteed | ||
49 | * to access memory (but not necessarily other CPUs' caches) before any | ||
50 | * reads following this primitive that depend on the data return by | ||
51 | * any of the preceding reads. This primitive is much lighter weight than | ||
52 | * rmb() on most CPUs, and is never heavier weight than is | ||
53 | * rmb(). | ||
54 | * | ||
55 | * These ordering constraints are respected by both the local CPU | ||
56 | * and the compiler. | ||
57 | * | ||
58 | * Ordering is not guaranteed by anything other than these primitives, | ||
59 | * not even by data dependencies. See the documentation for | ||
60 | * memory_barrier() for examples and URLs to more information. | ||
61 | * | ||
62 | * For example, the following code would force ordering (the initial | ||
63 | * value of "a" is zero, "b" is one, and "p" is "&a"): | ||
64 | * | ||
65 | * <programlisting> | ||
66 | * CPU 0 CPU 1 | ||
67 | * | ||
68 | * b = 2; | ||
69 | * memory_barrier(); | ||
70 | * p = &b; q = p; | ||
71 | * read_barrier_depends(); | ||
72 | * d = *q; | ||
73 | * </programlisting> | ||
74 | * | ||
75 | * because the read of "*q" depends on the read of "p" and these | ||
76 | * two reads are separated by a read_barrier_depends(). However, | ||
77 | * the following code, with the same initial values for "a" and "b": | ||
78 | * | ||
79 | * <programlisting> | ||
80 | * CPU 0 CPU 1 | ||
81 | * | ||
82 | * a = 2; | ||
83 | * memory_barrier(); | ||
84 | * b = 3; y = b; | ||
85 | * read_barrier_depends(); | ||
86 | * x = a; | ||
87 | * </programlisting> | ||
88 | * | ||
89 | * does not enforce ordering, since there is no data dependency between | ||
90 | * the read of "a" and the read of "b". Therefore, on some CPUs, such | ||
91 | * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() | ||
92 | * in cases like this where there are no data dependencies. | ||
93 | **/ | ||
94 | |||
95 | #define read_barrier_depends() do { } while (0) | ||
96 | |||
97 | #ifdef CONFIG_SMP | ||
98 | #define smp_mb() mb() | ||
99 | #ifdef CONFIG_X86_PPRO_FENCE | ||
100 | # define smp_rmb() rmb() | ||
101 | #else | ||
102 | # define smp_rmb() barrier() | ||
103 | #endif | ||
104 | #ifdef CONFIG_X86_OOSTORE | ||
105 | # define smp_wmb() wmb() | ||
106 | #else | ||
107 | # define smp_wmb() barrier() | ||
108 | #endif | ||
109 | #define smp_read_barrier_depends() read_barrier_depends() | ||
110 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
111 | #else | ||
112 | #define smp_mb() barrier() | ||
113 | #define smp_rmb() barrier() | ||
114 | #define smp_wmb() barrier() | ||
115 | #define smp_read_barrier_depends() do { } while (0) | ||
116 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | ||
117 | #endif | ||
118 | |||
119 | /* | ||
120 | * Stop RDTSC speculation. This is needed when you need to use RDTSC | ||
121 | * (or get_cycles or vread that possibly accesses the TSC) in a defined | ||
122 | * code region. | ||
123 | * | ||
124 | * (Could use an alternative three way for this if there was one.) | ||
125 | */ | ||
126 | static inline void rdtsc_barrier(void) | ||
127 | { | ||
128 | alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); | ||
129 | alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); | ||
130 | } | ||
131 | |||
132 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/tls.h b/arch/um/sys-x86_64/shared/sysdep/tls.h index 35f19f25bd3b..18c000d0357a 100644 --- a/arch/um/include/sysdep-x86_64/tls.h +++ b/arch/um/sys-x86_64/shared/sysdep/tls.h | |||
@@ -22,7 +22,7 @@ typedef struct um_dup_user_desc { | |||
22 | 22 | ||
23 | # else /* __KERNEL__ */ | 23 | # else /* __KERNEL__ */ |
24 | 24 | ||
25 | # include <asm/ldt.h> | 25 | # include <ldt.h> |
26 | typedef struct user_desc user_desc_t; | 26 | typedef struct user_desc user_desc_t; |
27 | 27 | ||
28 | # endif /* __KERNEL__ */ | 28 | # endif /* __KERNEL__ */ |
diff --git a/arch/um/sys-x86_64/shared/sysdep/vm-flags.h b/arch/um/sys-x86_64/shared/sysdep/vm-flags.h new file mode 100644 index 000000000000..3213edfa7888 --- /dev/null +++ b/arch/um/sys-x86_64/shared/sysdep/vm-flags.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __VM_FLAGS_X86_64_H | ||
8 | #define __VM_FLAGS_X86_64_H | ||
9 | |||
10 | #define __VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
11 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
12 | #define __VM_STACK_FLAGS (VM_GROWSDOWN | VM_READ | VM_WRITE | \ | ||
13 | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | \ | ||
14 | VM_MAYEXEC) | ||
15 | |||
16 | extern unsigned long vm_stack_flags, vm_stack_flags32; | ||
17 | extern unsigned long vm_data_default_flags, vm_data_default_flags32; | ||
18 | extern unsigned long vm_force_exec32; | ||
19 | |||
20 | #ifdef TIF_IA32 | ||
21 | #define VM_DATA_DEFAULT_FLAGS \ | ||
22 | (test_thread_flag(TIF_IA32) ? vm_data_default_flags32 : \ | ||
23 | vm_data_default_flags) | ||
24 | |||
25 | #define VM_STACK_DEFAULT_FLAGS \ | ||
26 | (test_thread_flag(TIF_IA32) ? vm_stack_flags32 : vm_stack_flags) | ||
27 | #endif | ||
28 | |||
29 | #define VM_DATA_DEFAULT_FLAGS vm_data_default_flags | ||
30 | |||
31 | #define VM_STACK_DEFAULT_FLAGS vm_stack_flags | ||
32 | |||
33 | #endif | ||
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S index 568768763155..6d9edf9fabce 100644 --- a/arch/um/sys-x86_64/stub.S +++ b/arch/um/sys-x86_64/stub.S | |||
@@ -1,4 +1,3 @@ | |||
1 | #include "uml-config.h" | ||
2 | #include "as-layout.h" | 1 | #include "as-layout.h" |
3 | 2 | ||
4 | .globl syscall_stub | 3 | .globl syscall_stub |
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c index c128eb897008..dd21d69715e6 100644 --- a/arch/um/sys-x86_64/syscall_table.c +++ b/arch/um/sys-x86_64/syscall_table.c | |||
@@ -41,12 +41,12 @@ | |||
41 | #define stub_rt_sigreturn sys_rt_sigreturn | 41 | #define stub_rt_sigreturn sys_rt_sigreturn |
42 | 42 | ||
43 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; | 43 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; |
44 | #undef _ASM_X86_64_UNISTD_H_ | 44 | #undef _ASM_X86_UNISTD_64_H |
45 | #include <asm-x86/unistd_64.h> | 45 | #include "../../x86/include/asm/unistd_64.h" |
46 | 46 | ||
47 | #undef __SYSCALL | 47 | #undef __SYSCALL |
48 | #define __SYSCALL(nr, sym) [ nr ] = sym, | 48 | #define __SYSCALL(nr, sym) [ nr ] = sym, |
49 | #undef _ASM_X86_64_UNISTD_H_ | 49 | #undef _ASM_X86_UNISTD_64_H |
50 | 50 | ||
51 | typedef void (*sys_call_ptr_t)(void); | 51 | typedef void (*sys_call_ptr_t)(void); |
52 | 52 | ||
@@ -64,7 +64,7 @@ extern void sys_ni_syscall(void); | |||
64 | */ | 64 | */ |
65 | 65 | ||
66 | sys_call_ptr_t sys_call_table[] __cacheline_aligned = { | 66 | sys_call_ptr_t sys_call_table[] __cacheline_aligned = { |
67 | #include <asm-x86/unistd_64.h> | 67 | #include "../../x86/include/asm/unistd_64.h" |
68 | }; | 68 | }; |
69 | 69 | ||
70 | int syscall_table_size = sizeof(sys_call_table); | 70 | int syscall_table_size = sizeof(sys_call_table); |