aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 12:45:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 12:45:39 -0400
commitde0a5345a55b8dd5a4695181275df0e691176830 (patch)
tree17530e824f7f46ce0b1757657179fb5957a6add5
parent994c0e992522c123298b4a91b72f5e67ba2d1123 (diff)
parent8535639810e578960233ad39def3ac2157b0c3ec (diff)
Merge branch 'for-linus' of git://github.com/richardweinberger/linux
* 'for-linus' of git://github.com/richardweinberger/linux: (90 commits) um: fix ubd cow size um: Fix kmalloc argument order in um/vdso/vma.c um: switch to use of drivers/Kconfig UserModeLinux-HOWTO.txt: fix a typo UserModeLinux-HOWTO.txt: remove ^H characters um: we need sys/user.h only on i386 um: merge delay_{32,64}.c um: distribute exports to where exported stuff is defined um: kill system-um.h um: generic ftrace.h will do... um: segment.h is x86-only and needed only there um: asm/pda.h is not needed anymore um: hw_irq.h can go generic as well um: switch to generic-y um: clean Kconfig up a bit um: a couple of missing dependencies... um: kill useless argument of free_chan() and free_one_chan() um: unify ptrace_user.h um: unify KSTK_... um: fix gcov build breakage ...
-rw-r--r--Documentation/virtual/uml/UserModeLinux-HOWTO.txt532
-rw-r--r--arch/um/Kconfig.char114
-rw-r--r--arch/um/Kconfig.rest23
-rw-r--r--arch/um/Kconfig.um6
-rw-r--r--arch/um/Makefile49
-rw-r--r--arch/um/Makefile-x86_6426
-rw-r--r--arch/um/drivers/chan.h (renamed from arch/um/include/shared/chan_kern.h)6
-rw-r--r--arch/um/drivers/chan_kern.c12
-rw-r--r--arch/um/drivers/chan_user.c9
-rw-r--r--arch/um/drivers/chan_user.h (renamed from arch/um/include/shared/chan_user.h)0
-rw-r--r--arch/um/drivers/cow_sys.h1
-rw-r--r--arch/um/drivers/daemon_user.c1
-rw-r--r--arch/um/drivers/fd.c2
-rw-r--r--arch/um/drivers/harddog_user.c1
-rw-r--r--arch/um/drivers/line.c2
-rw-r--r--arch/um/drivers/line.h (renamed from arch/um/include/shared/line.h)0
-rw-r--r--arch/um/drivers/mconsole.h (renamed from arch/um/include/shared/mconsole.h)0
-rw-r--r--arch/um/drivers/mconsole_kern.h (renamed from arch/um/include/shared/mconsole_kern.h)0
-rw-r--r--arch/um/drivers/mconsole_user.c2
-rw-r--r--arch/um/drivers/net_user.c2
-rw-r--r--arch/um/drivers/pcap_user.c2
-rw-r--r--arch/um/drivers/port_user.c2
-rw-r--r--arch/um/drivers/pty.c2
-rw-r--r--arch/um/drivers/slip_user.c2
-rw-r--r--arch/um/drivers/slirp_user.c2
-rw-r--r--arch/um/drivers/ssl.c4
-rw-r--r--arch/um/drivers/stdio_console.c3
-rw-r--r--arch/um/drivers/tty.c2
-rw-r--r--arch/um/drivers/ubd_kern.c33
-rw-r--r--arch/um/drivers/ubd_user.c1
-rw-r--r--arch/um/drivers/ubd_user.h (renamed from arch/um/include/shared/ubd_user.h)0
-rw-r--r--arch/um/drivers/umcast_user.c2
-rw-r--r--arch/um/drivers/vde_user.c2
-rw-r--r--arch/um/drivers/xterm.c2
-rw-r--r--arch/um/include/asm/Kbuild3
-rw-r--r--arch/um/include/asm/bug.h6
-rw-r--r--arch/um/include/asm/checksum.h6
-rw-r--r--arch/um/include/asm/cputime.h6
-rw-r--r--arch/um/include/asm/device.h7
-rw-r--r--arch/um/include/asm/emergency-restart.h6
-rw-r--r--arch/um/include/asm/ftrace.h1
-rw-r--r--arch/um/include/asm/futex.h6
-rw-r--r--arch/um/include/asm/hardirq.h1
-rw-r--r--arch/um/include/asm/hw_irq.h7
-rw-r--r--arch/um/include/asm/irq_regs.h1
-rw-r--r--arch/um/include/asm/irqflags.h38
-rw-r--r--arch/um/include/asm/kdebug.h1
-rw-r--r--arch/um/include/asm/mmu.h22
-rw-r--r--arch/um/include/asm/mmu_context.h7
-rw-r--r--arch/um/include/asm/page.h2
-rw-r--r--arch/um/include/asm/page_offset.h1
-rw-r--r--arch/um/include/asm/pda.h21
-rw-r--r--arch/um/include/asm/percpu.h6
-rw-r--r--arch/um/include/asm/ptrace-generic.h7
-rw-r--r--arch/um/include/asm/sections.h7
-rw-r--r--arch/um/include/asm/system.h47
-rw-r--r--arch/um/include/asm/topology.h6
-rw-r--r--arch/um/include/asm/uaccess.h89
-rw-r--r--arch/um/include/asm/xor.h6
-rw-r--r--arch/um/include/shared/as-layout.h2
-rw-r--r--arch/um/include/shared/common-offsets.h1
-rw-r--r--arch/um/include/shared/initrd.h12
-rw-r--r--arch/um/include/shared/kern.h18
-rw-r--r--arch/um/include/shared/kern_util.h1
-rw-r--r--arch/um/include/shared/ldt.h37
-rw-r--r--arch/um/include/shared/mem_kern.h20
-rw-r--r--arch/um/include/shared/os.h13
-rw-r--r--arch/um/include/shared/process.h17
-rw-r--r--arch/um/include/shared/ptrace_user.h3
-rw-r--r--arch/um/include/shared/skas_ptregs.h6
-rw-r--r--arch/um/include/shared/syscall.h12
-rw-r--r--arch/um/include/shared/task.h9
-rw-r--r--arch/um/include/shared/tlb.h15
-rw-r--r--arch/um/include/shared/um_malloc.h2
-rw-r--r--arch/um/include/shared/um_mmu.h24
-rw-r--r--arch/um/include/shared/um_uaccess.h97
-rw-r--r--arch/um/include/shared/user.h7
-rw-r--r--arch/um/kernel/Makefile2
-rw-r--r--arch/um/kernel/exec.c18
-rw-r--r--arch/um/kernel/gmon_syms.c15
-rw-r--r--arch/um/kernel/initrd.c4
-rw-r--r--arch/um/kernel/irq.c1
-rw-r--r--arch/um/kernel/ksyms.c38
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/physmem.c21
-rw-r--r--arch/um/kernel/process.c4
-rw-r--r--arch/um/kernel/signal.c1
-rw-r--r--arch/um/kernel/skas/clone.c1
-rw-r--r--arch/um/kernel/skas/uaccess.c6
-rw-r--r--arch/um/kernel/tlb.c5
-rw-r--r--arch/um/kernel/trap.c3
-rw-r--r--arch/um/kernel/uaccess.c33
-rw-r--r--arch/um/kernel/um_arch.c2
-rw-r--r--arch/um/os-Linux/Makefile6
-rw-r--r--arch/um/os-Linux/aio.c2
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c2
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c2
-rw-r--r--arch/um/os-Linux/elf_aux.c1
-rw-r--r--arch/um/os-Linux/file.c2
-rw-r--r--arch/um/os-Linux/helper.c2
-rw-r--r--arch/um/os-Linux/internal.h1
-rw-r--r--arch/um/os-Linux/irq.c3
-rw-r--r--arch/um/os-Linux/main.c1
-rw-r--r--arch/um/os-Linux/mem.c2
-rw-r--r--arch/um/os-Linux/process.c23
-rw-r--r--arch/um/os-Linux/sigio.c3
-rw-r--r--arch/um/os-Linux/signal.c72
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c21
-rw-r--r--arch/um/os-Linux/start_up.c10
-rw-r--r--arch/um/os-Linux/sys-i386/signal.c13
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile10
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c52
-rw-r--r--arch/um/os-Linux/sys-x86_64/signal.c16
-rw-r--r--arch/um/os-Linux/sys-x86_64/task_size.c5
-rw-r--r--arch/um/os-Linux/time.c4
-rw-r--r--arch/um/os-Linux/tls.c35
-rw-r--r--arch/um/os-Linux/tty.c2
-rw-r--r--arch/um/os-Linux/uaccess.c32
-rw-r--r--arch/um/os-Linux/umid.c2
-rw-r--r--arch/um/os-Linux/util.c2
-rw-r--r--arch/um/scripts/Makefile.rules7
-rw-r--r--arch/um/sys-i386/Makefile24
-rw-r--r--arch/um/sys-i386/asm/elf.h125
-rw-r--r--arch/um/sys-i386/asm/module.h13
-rw-r--r--arch/um/sys-i386/atomic64_cx8_32.S225
-rw-r--r--arch/um/sys-i386/bug.c21
-rw-r--r--arch/um/sys-i386/ksyms.c5
-rw-r--r--arch/um/sys-i386/shared/sysdep/barrier.h9
-rw-r--r--arch/um/sys-i386/shared/sysdep/host_ldt.h34
-rw-r--r--arch/um/sys-i386/shared/sysdep/ptrace_user.h50
-rw-r--r--arch/um/sys-i386/shared/sysdep/sc.h44
-rw-r--r--arch/um/sys-i386/shared/sysdep/sigcontext.h26
-rw-r--r--arch/um/sys-i386/shared/sysdep/vm-flags.h14
-rw-r--r--arch/um/sys-i386/stub_segv.c17
-rw-r--r--arch/um/sys-i386/user-offsets.c53
-rw-r--r--arch/um/sys-x86_64/Makefile27
-rw-r--r--arch/um/sys-x86_64/asm/archparam.h16
-rw-r--r--arch/um/sys-x86_64/asm/module.h20
-rw-r--r--arch/um/sys-x86_64/delay.c60
-rw-r--r--arch/um/sys-x86_64/fault.c28
-rw-r--r--arch/um/sys-x86_64/ptrace_user.c22
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/barrier.h7
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/host_ldt.h38
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h23
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/ptrace_user.h77
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/sc.h45
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/sigcontext.h27
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h22
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/system.h132
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/tls.h29
-rw-r--r--arch/um/sys-x86_64/signal.c290
-rw-r--r--arch/x86/Makefile.um (renamed from arch/um/Makefile-i386)37
-rw-r--r--arch/x86/um/Kconfig (renamed from arch/um/Kconfig.x86)0
-rw-r--r--arch/x86/um/Makefile45
-rw-r--r--arch/x86/um/asm/apic.h (renamed from arch/um/include/asm/apic.h)0
-rw-r--r--arch/x86/um/asm/arch_hweight.h (renamed from arch/um/include/asm/arch_hweight.h)0
-rw-r--r--arch/x86/um/asm/archparam.h (renamed from arch/um/sys-i386/asm/archparam.h)8
-rw-r--r--arch/x86/um/asm/checksum.h10
-rw-r--r--arch/x86/um/asm/checksum_32.h (renamed from arch/um/sys-i386/shared/sysdep/checksum.h)2
-rw-r--r--arch/x86/um/asm/checksum_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/checksum.h)0
-rw-r--r--arch/x86/um/asm/desc.h (renamed from arch/um/include/asm/desc.h)0
-rw-r--r--arch/x86/um/asm/elf.h (renamed from arch/um/sys-x86_64/asm/elf.h)145
-rw-r--r--arch/x86/um/asm/irq_vectors.h (renamed from arch/um/include/asm/irq_vectors.h)0
-rw-r--r--arch/x86/um/asm/mm_context.h72
-rw-r--r--arch/x86/um/asm/module.h23
-rw-r--r--arch/x86/um/asm/processor.h22
-rw-r--r--arch/x86/um/asm/processor_32.h (renamed from arch/um/sys-i386/asm/processor.h)18
-rw-r--r--arch/x86/um/asm/processor_64.h (renamed from arch/um/sys-x86_64/asm/processor.h)11
-rw-r--r--arch/x86/um/asm/ptrace.h5
-rw-r--r--arch/x86/um/asm/ptrace_32.h (renamed from arch/um/sys-i386/asm/ptrace.h)0
-rw-r--r--arch/x86/um/asm/ptrace_64.h (renamed from arch/um/sys-x86_64/asm/ptrace.h)2
-rw-r--r--arch/x86/um/asm/required-features.h (renamed from arch/um/include/asm/required-features.h)0
-rw-r--r--arch/x86/um/asm/segment.h (renamed from arch/um/include/asm/segment.h)0
-rw-r--r--arch/x86/um/asm/system.h (renamed from arch/um/sys-i386/shared/sysdep/system.h)3
-rw-r--r--arch/x86/um/asm/vm-flags.h (renamed from arch/um/sys-x86_64/shared/sysdep/vm-flags.h)14
-rw-r--r--arch/x86/um/bug.c (renamed from arch/um/sys-x86_64/bug.c)0
-rw-r--r--arch/x86/um/bugs_32.c (renamed from arch/um/sys-i386/bugs.c)6
-rw-r--r--arch/x86/um/bugs_64.c (renamed from arch/um/sys-x86_64/bugs.c)0
-rw-r--r--arch/x86/um/checksum_32.S (renamed from arch/um/sys-i386/checksum.S)0
-rw-r--r--arch/x86/um/delay.c (renamed from arch/um/sys-i386/delay.c)0
-rw-r--r--arch/x86/um/elfcore.c (renamed from arch/um/sys-i386/elfcore.c)0
-rw-r--r--arch/x86/um/fault.c (renamed from arch/um/sys-i386/fault.c)0
-rw-r--r--arch/x86/um/ksyms.c (renamed from arch/um/sys-x86_64/ksyms.c)2
-rw-r--r--arch/x86/um/ldt.c (renamed from arch/um/sys-i386/ldt.c)36
-rw-r--r--arch/x86/um/mem_32.c (renamed from arch/um/sys-i386/mem.c)0
-rw-r--r--arch/x86/um/mem_64.c (renamed from arch/um/sys-x86_64/mem.c)0
-rw-r--r--arch/x86/um/os-Linux/Makefile (renamed from arch/um/os-Linux/sys-i386/Makefile)5
-rw-r--r--arch/x86/um/os-Linux/mcontext.c31
-rw-r--r--arch/x86/um/os-Linux/prctl.c (renamed from arch/um/os-Linux/sys-x86_64/prctl.c)0
-rw-r--r--arch/x86/um/os-Linux/registers.c (renamed from arch/um/os-Linux/sys-i386/registers.c)62
-rw-r--r--arch/x86/um/os-Linux/task_size.c (renamed from arch/um/os-Linux/sys-i386/task_size.c)13
-rw-r--r--arch/x86/um/os-Linux/tls.c (renamed from arch/um/os-Linux/sys-i386/tls.c)35
-rw-r--r--arch/x86/um/ptrace_32.c (renamed from arch/um/sys-i386/ptrace.c)69
-rw-r--r--arch/x86/um/ptrace_64.c (renamed from arch/um/sys-x86_64/ptrace.c)103
-rw-r--r--arch/x86/um/ptrace_user.c (renamed from arch/um/sys-i386/ptrace_user.c)2
-rw-r--r--arch/x86/um/setjmp_32.S (renamed from arch/um/sys-i386/setjmp.S)0
-rw-r--r--arch/x86/um/setjmp_64.S (renamed from arch/um/sys-x86_64/setjmp.S)0
-rw-r--r--arch/x86/um/shared/sysdep/archsetjmp.h5
-rw-r--r--arch/x86/um/shared/sysdep/archsetjmp_32.h (renamed from arch/um/sys-i386/shared/sysdep/archsetjmp.h)0
-rw-r--r--arch/x86/um/shared/sysdep/archsetjmp_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/archsetjmp.h)0
-rw-r--r--arch/x86/um/shared/sysdep/faultinfo.h5
-rw-r--r--arch/x86/um/shared/sysdep/faultinfo_32.h (renamed from arch/um/sys-i386/shared/sysdep/faultinfo.h)6
-rw-r--r--arch/x86/um/shared/sysdep/faultinfo_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/faultinfo.h)6
-rw-r--r--arch/x86/um/shared/sysdep/kernel-offsets.h (renamed from arch/um/sys-i386/shared/sysdep/kernel-offsets.h)0
-rw-r--r--arch/x86/um/shared/sysdep/mcontext.h31
-rw-r--r--arch/x86/um/shared/sysdep/ptrace.h5
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_32.h (renamed from arch/um/sys-i386/shared/sysdep/ptrace.h)75
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/ptrace.h)103
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_user.h27
-rw-r--r--arch/x86/um/shared/sysdep/skas_ptrace.h (renamed from arch/um/sys-i386/shared/sysdep/skas_ptrace.h)4
-rw-r--r--arch/x86/um/shared/sysdep/stub.h14
-rw-r--r--arch/x86/um/shared/sysdep/stub_32.h (renamed from arch/um/sys-i386/shared/sysdep/stub.h)8
-rw-r--r--arch/x86/um/shared/sysdep/stub_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/stub.h)8
-rw-r--r--arch/x86/um/shared/sysdep/syscalls.h5
-rw-r--r--arch/x86/um/shared/sysdep/syscalls_32.h (renamed from arch/um/sys-i386/shared/sysdep/syscalls.h)0
-rw-r--r--arch/x86/um/shared/sysdep/syscalls_64.h (renamed from arch/um/sys-x86_64/shared/sysdep/syscalls.h)1
-rw-r--r--arch/x86/um/shared/sysdep/tls.h (renamed from arch/um/sys-i386/shared/sysdep/tls.h)9
-rw-r--r--arch/x86/um/signal.c (renamed from arch/um/sys-i386/signal.c)304
-rw-r--r--arch/x86/um/stub_32.S (renamed from arch/um/sys-i386/stub.S)0
-rw-r--r--arch/x86/um/stub_64.S (renamed from arch/um/sys-x86_64/stub.S)0
-rw-r--r--arch/x86/um/stub_segv.c (renamed from arch/um/sys-x86_64/stub_segv.c)11
-rw-r--r--arch/x86/um/sys_call_table_32.S (renamed from arch/um/sys-i386/sys_call_table.S)4
-rw-r--r--arch/x86/um/sys_call_table_64.c (renamed from arch/um/sys-x86_64/syscall_table.c)3
-rw-r--r--arch/x86/um/syscalls_32.c (renamed from arch/um/sys-i386/syscalls.c)0
-rw-r--r--arch/x86/um/syscalls_64.c (renamed from arch/um/sys-x86_64/syscalls.c)0
-rw-r--r--arch/x86/um/sysrq_32.c (renamed from arch/um/sys-i386/sysrq.c)0
-rw-r--r--arch/x86/um/sysrq_64.c (renamed from arch/um/sys-x86_64/sysrq.c)2
-rw-r--r--arch/x86/um/tls_32.c (renamed from arch/um/sys-i386/tls.c)0
-rw-r--r--arch/x86/um/tls_64.c (renamed from arch/um/sys-x86_64/tls.c)0
-rw-r--r--arch/x86/um/user-offsets.c (renamed from arch/um/sys-x86_64/user-offsets.c)51
-rw-r--r--arch/x86/um/vdso/Makefile (renamed from arch/um/sys-x86_64/vdso/Makefile)4
-rw-r--r--arch/x86/um/vdso/checkundef.sh (renamed from arch/um/sys-x86_64/vdso/checkundef.sh)0
-rw-r--r--arch/x86/um/vdso/um_vdso.c (renamed from arch/um/sys-x86_64/vdso/um_vdso.c)0
-rw-r--r--arch/x86/um/vdso/vdso-layout.lds.S (renamed from arch/um/sys-x86_64/vdso/vdso-layout.lds.S)0
-rw-r--r--arch/x86/um/vdso/vdso-note.S (renamed from arch/um/sys-x86_64/vdso/vdso-note.S)0
-rw-r--r--arch/x86/um/vdso/vdso.S (renamed from arch/um/sys-x86_64/vdso/vdso.S)2
-rw-r--r--arch/x86/um/vdso/vdso.lds.S (renamed from arch/um/sys-x86_64/vdso/vdso.lds.S)0
-rw-r--r--arch/x86/um/vdso/vma.c (renamed from arch/um/sys-x86_64/vdso/vma.c)2
-rw-r--r--drivers/char/Kconfig6
-rw-r--r--drivers/char/hw_random/Kconfig15
-rw-r--r--drivers/char/ttyprintk.c2
-rw-r--r--drivers/input/Kconfig2
-rw-r--r--drivers/isdn/Kconfig2
-rw-r--r--drivers/net/wireless/ath/Kconfig2
-rw-r--r--drivers/net/wireless/rtlwifi/Kconfig4
-rw-r--r--drivers/power/Kconfig1
-rw-r--r--drivers/rtc/Kconfig2
-rw-r--r--drivers/tty/Kconfig2
-rw-r--r--drivers/watchdog/Kconfig6
-rw-r--r--fs/hostfs/hostfs_user.c1
-rw-r--r--security/integrity/ima/Kconfig2
-rw-r--r--sound/Kconfig2
253 files changed, 1666 insertions, 3326 deletions
diff --git a/Documentation/virtual/uml/UserModeLinux-HOWTO.txt b/Documentation/virtual/uml/UserModeLinux-HOWTO.txt
index 5d0fc8bfcdb9..77dfecf4e2d6 100644
--- a/Documentation/virtual/uml/UserModeLinux-HOWTO.txt
+++ b/Documentation/virtual/uml/UserModeLinux-HOWTO.txt
@@ -134,13 +134,13 @@
134 134
135 ______________________________________________________________________ 135 ______________________________________________________________________
136 136
137 11.. IInnttrroodduuccttiioonn 137 1. Introduction
138 138
139 Welcome to User Mode Linux. It's going to be fun. 139 Welcome to User Mode Linux. It's going to be fun.
140 140
141 141
142 142
143 11..11.. HHooww iiss UUsseerr MMooddee LLiinnuuxx DDiiffffeerreenntt?? 143 1.1. How is User Mode Linux Different?
144 144
145 Normally, the Linux Kernel talks straight to your hardware (video 145 Normally, the Linux Kernel talks straight to your hardware (video
146 card, keyboard, hard drives, etc), and any programs which run ask the 146 card, keyboard, hard drives, etc), and any programs which run ask the
@@ -181,7 +181,7 @@
181 181
182 182
183 183
184 11..22.. WWhhyy WWoouulldd II WWaanntt UUsseerr MMooddee LLiinnuuxx?? 184 1.2. Why Would I Want User Mode Linux?
185 185
186 186
187 1. If User Mode Linux crashes, your host kernel is still fine. 187 1. If User Mode Linux crashes, your host kernel is still fine.
@@ -206,12 +206,12 @@
206 206
207 207
208 208
209 22.. CCoommppiilliinngg tthhee kkeerrnneell aanndd mmoodduulleess 209 2. Compiling the kernel and modules
210 210
211 211
212 212
213 213
214 22..11.. CCoommppiilliinngg tthhee kkeerrnneell 214 2.1. Compiling the kernel
215 215
216 216
217 Compiling the user mode kernel is just like compiling any other 217 Compiling the user mode kernel is just like compiling any other
@@ -322,7 +322,7 @@
322 bug fixes and enhancements that have gone into subsequent releases. 322 bug fixes and enhancements that have gone into subsequent releases.
323 323
324 324
325 22..22.. CCoommppiilliinngg aanndd iinnssttaalllliinngg kkeerrnneell mmoodduulleess 325 2.2. Compiling and installing kernel modules
326 326
327 UML modules are built in the same way as the native kernel (with the 327 UML modules are built in the same way as the native kernel (with the
328 exception of the 'ARCH=um' that you always need for UML): 328 exception of the 'ARCH=um' that you always need for UML):
@@ -386,19 +386,19 @@
386 386
387 387
388 388
389 22..33.. CCoommppiilliinngg aanndd iinnssttaalllliinngg uummll__uuttiilliittiieess 389 2.3. Compiling and installing uml_utilities
390 390
391 Many features of the UML kernel require a user-space helper program, 391 Many features of the UML kernel require a user-space helper program,
392 so a uml_utilities package is distributed separately from the kernel 392 so a uml_utilities package is distributed separately from the kernel
393 patch which provides these helpers. Included within this is: 393 patch which provides these helpers. Included within this is:
394 394
395 +o port-helper - Used by consoles which connect to xterms or ports 395 o port-helper - Used by consoles which connect to xterms or ports
396 396
397 +o tunctl - Configuration tool to create and delete tap devices 397 o tunctl - Configuration tool to create and delete tap devices
398 398
399 +o uml_net - Setuid binary for automatic tap device configuration 399 o uml_net - Setuid binary for automatic tap device configuration
400 400
401 +o uml_switch - User-space virtual switch required for daemon 401 o uml_switch - User-space virtual switch required for daemon
402 transport 402 transport
403 403
404 The uml_utilities tree is compiled with: 404 The uml_utilities tree is compiled with:
@@ -423,11 +423,11 @@
423 423
424 424
425 425
426 33.. RRuunnnniinngg UUMMLL aanndd llooggggiinngg iinn 426 3. Running UML and logging in
427 427
428 428
429 429
430 33..11.. RRuunnnniinngg UUMMLL 430 3.1. Running UML
431 431
432 It runs on 2.2.15 or later, and all 2.4 kernels. 432 It runs on 2.2.15 or later, and all 2.4 kernels.
433 433
@@ -454,7 +454,7 @@
454 454
455 455
456 456
457 33..22.. LLooggggiinngg iinn 457 3.2. Logging in
458 458
459 459
460 460
@@ -468,7 +468,7 @@
468 468
469 There are a couple of other ways to log in: 469 There are a couple of other ways to log in:
470 470
471 +o On a virtual console 471 o On a virtual console
472 472
473 473
474 474
@@ -480,7 +480,7 @@
480 480
481 481
482 482
483 +o Over the serial line 483 o Over the serial line
484 484
485 485
486 In the boot output, find a line that looks like: 486 In the boot output, find a line that looks like:
@@ -503,7 +503,7 @@
503 503
504 504
505 505
506 +o Over the net 506 o Over the net
507 507
508 508
509 If the network is running, then you can telnet to the virtual 509 If the network is running, then you can telnet to the virtual
@@ -514,13 +514,13 @@
514 down and the process will exit. 514 down and the process will exit.
515 515
516 516
517 33..33.. EExxaammpplleess 517 3.3. Examples
518 518
519 Here are some examples of UML in action: 519 Here are some examples of UML in action:
520 520
521 +o A login session <http://user-mode-linux.sourceforge.net/login.html> 521 o A login session <http://user-mode-linux.sourceforge.net/login.html>
522 522
523 +o A virtual network <http://user-mode-linux.sourceforge.net/net.html> 523 o A virtual network <http://user-mode-linux.sourceforge.net/net.html>
524 524
525 525
526 526
@@ -528,12 +528,12 @@
528 528
529 529
530 530
531 44.. UUMMLL oonn 22GG//22GG hhoossttss 531 4. UML on 2G/2G hosts
532 532
533 533
534 534
535 535
536 44..11.. IInnttrroodduuccttiioonn 536 4.1. Introduction
537 537
538 538
539 Most Linux machines are configured so that the kernel occupies the 539 Most Linux machines are configured so that the kernel occupies the
@@ -546,7 +546,7 @@
546 546
547 547
548 548
549 44..22.. TThhee pprroobblleemm 549 4.2. The problem
550 550
551 551
552 The prebuilt UML binaries on this site will not run on 2G/2G hosts 552 The prebuilt UML binaries on this site will not run on 2G/2G hosts
@@ -558,7 +558,7 @@
558 558
559 559
560 560
561 44..33.. TThhee ssoolluuttiioonn 561 4.3. The solution
562 562
563 563
564 The fix for this is to rebuild UML from source after enabling 564 The fix for this is to rebuild UML from source after enabling
@@ -576,7 +576,7 @@
576 576
577 577
578 578
579 55.. SSeettttiinngg uupp sseerriiaall lliinneess aanndd ccoonnssoolleess 579 5. Setting up serial lines and consoles
580 580
581 581
582 It is possible to attach UML serial lines and consoles to many types 582 It is possible to attach UML serial lines and consoles to many types
@@ -586,12 +586,12 @@
586 You can attach them to host ptys, ttys, file descriptors, and ports. 586 You can attach them to host ptys, ttys, file descriptors, and ports.
587 This allows you to do things like 587 This allows you to do things like
588 588
589 +o have a UML console appear on an unused host console, 589 o have a UML console appear on an unused host console,
590 590
591 +o hook two virtual machines together by having one attach to a pty 591 o hook two virtual machines together by having one attach to a pty
592 and having the other attach to the corresponding tty 592 and having the other attach to the corresponding tty
593 593
594 +o make a virtual machine accessible from the net by attaching a 594 o make a virtual machine accessible from the net by attaching a
595 console to a port on the host. 595 console to a port on the host.
596 596
597 597
@@ -599,7 +599,7 @@
599 599
600 600
601 601
602 55..11.. SSppeecciiffyyiinngg tthhee ddeevviiccee 602 5.1. Specifying the device
603 603
604 Devices are specified with "con" or "ssl" (console or serial line, 604 Devices are specified with "con" or "ssl" (console or serial line,
605 respectively), optionally with a device number if you are talking 605 respectively), optionally with a device number if you are talking
@@ -626,13 +626,13 @@
626 626
627 627
628 628
629 55..22.. SSppeecciiffyyiinngg tthhee cchhaannnneell 629 5.2. Specifying the channel
630 630
631 There are a number of different types of channels to attach a UML 631 There are a number of different types of channels to attach a UML
632 device to, each with a different way of specifying exactly what to 632 device to, each with a different way of specifying exactly what to
633 attach to. 633 attach to.
634 634
635 +o pseudo-terminals - device=pty pts terminals - device=pts 635 o pseudo-terminals - device=pty pts terminals - device=pts
636 636
637 637
638 This will cause UML to allocate a free host pseudo-terminal for the 638 This will cause UML to allocate a free host pseudo-terminal for the
@@ -640,20 +640,20 @@
640 log. You access it by attaching a terminal program to the 640 log. You access it by attaching a terminal program to the
641 corresponding tty: 641 corresponding tty:
642 642
643 +o screen /dev/pts/n 643 o screen /dev/pts/n
644 644
645 +o screen /dev/ttyxx 645 o screen /dev/ttyxx
646 646
647 +o minicom -o -p /dev/ttyxx - minicom seems not able to handle pts 647 o minicom -o -p /dev/ttyxx - minicom seems not able to handle pts
648 devices 648 devices
649 649
650 +o kermit - start it up, 'open' the device, then 'connect' 650 o kermit - start it up, 'open' the device, then 'connect'
651 651
652 652
653 653
654 654
655 655
656 +o terminals - device=tty:tty device file 656 o terminals - device=tty:tty device file
657 657
658 658
659 This will make UML attach the device to the specified tty (i.e 659 This will make UML attach the device to the specified tty (i.e
@@ -672,7 +672,7 @@
672 672
673 673
674 674
675 +o xterms - device=xterm 675 o xterms - device=xterm
676 676
677 677
678 UML will run an xterm and the device will be attached to it. 678 UML will run an xterm and the device will be attached to it.
@@ -681,7 +681,7 @@
681 681
682 682
683 683
684 +o Port - device=port:port number 684 o Port - device=port:port number
685 685
686 686
687 This will attach the UML devices to the specified host port. 687 This will attach the UML devices to the specified host port.
@@ -725,7 +725,7 @@
725 725
726 726
727 727
728 +o already-existing file descriptors - device=file descriptor 728 o already-existing file descriptors - device=file descriptor
729 729
730 730
731 If you set up a file descriptor on the UML command line, you can 731 If you set up a file descriptor on the UML command line, you can
@@ -743,7 +743,7 @@
743 743
744 744
745 745
746 +o Nothing - device=null 746 o Nothing - device=null
747 747
748 748
749 This allows the device to be opened, in contrast to 'none', but 749 This allows the device to be opened, in contrast to 'none', but
@@ -754,7 +754,7 @@
754 754
755 755
756 756
757 +o None - device=none 757 o None - device=none
758 758
759 759
760 This causes the device to disappear. 760 This causes the device to disappear.
@@ -770,7 +770,7 @@
770 770
771 771
772 772
773 will cause serial line 3 to accept input on the host's /dev/tty3 and 773 will cause serial line 3 to accept input on the host's /dev/tty2 and
774 display output on an xterm. That's a silly example - the most common 774 display output on an xterm. That's a silly example - the most common
775 use of this syntax is to reattach the main console to stdin and stdout 775 use of this syntax is to reattach the main console to stdin and stdout
776 as shown above. 776 as shown above.
@@ -785,7 +785,7 @@
785 785
786 786
787 787
788 55..33.. EExxaammpplleess 788 5.3. Examples
789 789
790 There are a number of interesting things you can do with this 790 There are a number of interesting things you can do with this
791 capability. 791 capability.
@@ -838,7 +838,7 @@
838 prompt of the other virtual machine. 838 prompt of the other virtual machine.
839 839
840 840
841 66.. SSeettttiinngg uupp tthhee nneettwwoorrkk 841 6. Setting up the network
842 842
843 843
844 844
@@ -858,19 +858,19 @@
858 There are currently five transport types available for a UML virtual 858 There are currently five transport types available for a UML virtual
859 machine to exchange packets with other hosts: 859 machine to exchange packets with other hosts:
860 860
861 +o ethertap 861 o ethertap
862 862
863 +o TUN/TAP 863 o TUN/TAP
864 864
865 +o Multicast 865 o Multicast
866 866
867 +o a switch daemon 867 o a switch daemon
868 868
869 +o slip 869 o slip
870 870
871 +o slirp 871 o slirp
872 872
873 +o pcap 873 o pcap
874 874
875 The TUN/TAP, ethertap, slip, and slirp transports allow a UML 875 The TUN/TAP, ethertap, slip, and slirp transports allow a UML
876 instance to exchange packets with the host. They may be directed 876 instance to exchange packets with the host. They may be directed
@@ -893,28 +893,28 @@
893 With so many host transports, which one should you use? Here's when 893 With so many host transports, which one should you use? Here's when
894 you should use each one: 894 you should use each one:
895 895
896 +o ethertap - if you want access to the host networking and it is 896 o ethertap - if you want access to the host networking and it is
897 running 2.2 897 running 2.2
898 898
899 +o TUN/TAP - if you want access to the host networking and it is 899 o TUN/TAP - if you want access to the host networking and it is
900 running 2.4. Also, the TUN/TAP transport is able to use a 900 running 2.4. Also, the TUN/TAP transport is able to use a
901 preconfigured device, allowing it to avoid using the setuid uml_net 901 preconfigured device, allowing it to avoid using the setuid uml_net
902 helper, which is a security advantage. 902 helper, which is a security advantage.
903 903
904 +o Multicast - if you want a purely virtual network and you don't want 904 o Multicast - if you want a purely virtual network and you don't want
905 to set up anything but the UML 905 to set up anything but the UML
906 906
907 +o a switch daemon - if you want a purely virtual network and you 907 o a switch daemon - if you want a purely virtual network and you
908 don't mind running the daemon in order to get somewhat better 908 don't mind running the daemon in order to get somewhat better
909 performance 909 performance
910 910
911 +o slip - there is no particular reason to run the slip backend unless 911 o slip - there is no particular reason to run the slip backend unless
912 ethertap and TUN/TAP are just not available for some reason 912 ethertap and TUN/TAP are just not available for some reason
913 913
914 +o slirp - if you don't have root access on the host to setup 914 o slirp - if you don't have root access on the host to setup
915 networking, or if you don't want to allocate an IP to your UML 915 networking, or if you don't want to allocate an IP to your UML
916 916
917 +o pcap - not much use for actual network connectivity, but great for 917 o pcap - not much use for actual network connectivity, but great for
918 monitoring traffic on the host 918 monitoring traffic on the host
919 919
920 Ethertap is available on 2.4 and works fine. TUN/TAP is preferred 920 Ethertap is available on 2.4 and works fine. TUN/TAP is preferred
@@ -926,7 +926,7 @@
926 exploit the helper's root privileges. 926 exploit the helper's root privileges.
927 927
928 928
929 66..11.. GGeenneerraall sseettuupp 929 6.1. General setup
930 930
931 First, you must have the virtual network enabled in your UML. If are 931 First, you must have the virtual network enabled in your UML. If are
932 running a prebuilt kernel from this site, everything is already 932 running a prebuilt kernel from this site, everything is already
@@ -995,7 +995,7 @@
995 995
996 996
997 997
998 66..22.. UUsseerrssppaaccee ddaaeemmoonnss 998 6.2. Userspace daemons
999 999
1000 You will likely need the setuid helper, or the switch daemon, or both. 1000 You will likely need the setuid helper, or the switch daemon, or both.
1001 They are both installed with the RPM and deb, so if you've installed 1001 They are both installed with the RPM and deb, so if you've installed
@@ -1011,7 +1011,7 @@
1011 1011
1012 1012
1013 1013
1014 66..33.. SSppeecciiffyyiinngg eetthheerrnneett aaddddrreesssseess 1014 6.3. Specifying ethernet addresses
1015 1015
1016 Below, you will see that the TUN/TAP, ethertap, and daemon interfaces 1016 Below, you will see that the TUN/TAP, ethertap, and daemon interfaces
1017 allow you to specify hardware addresses for the virtual ethernet 1017 allow you to specify hardware addresses for the virtual ethernet
@@ -1023,11 +1023,11 @@
1023 sufficient to guarantee a unique hardware address for the device. A 1023 sufficient to guarantee a unique hardware address for the device. A
1024 couple of exceptions are: 1024 couple of exceptions are:
1025 1025
1026 +o Another set of virtual ethernet devices are on the same network and 1026 o Another set of virtual ethernet devices are on the same network and
1027 they are assigned hardware addresses using a different scheme which 1027 they are assigned hardware addresses using a different scheme which
1028 may conflict with the UML IP address-based scheme 1028 may conflict with the UML IP address-based scheme
1029 1029
1030 +o You aren't going to use the device for IP networking, so you don't 1030 o You aren't going to use the device for IP networking, so you don't
1031 assign the device an IP address 1031 assign the device an IP address
1032 1032
1033 If you let the driver provide the hardware address, you should make 1033 If you let the driver provide the hardware address, you should make
@@ -1049,7 +1049,7 @@
1049 1049
1050 1050
1051 1051
1052 66..44.. UUMMLL iinntteerrffaaccee sseettuupp 1052 6.4. UML interface setup
1053 1053
1054 Once the network devices have been described on the command line, you 1054 Once the network devices have been described on the command line, you
1055 should boot UML and log in. 1055 should boot UML and log in.
@@ -1131,7 +1131,7 @@
1131 1131
1132 1132
1133 1133
1134 66..55.. MMuullttiiccaasstt 1134 6.5. Multicast
1135 1135
1136 The simplest way to set up a virtual network between multiple UMLs is 1136 The simplest way to set up a virtual network between multiple UMLs is
1137 to use the mcast transport. This was written by Harald Welte and is 1137 to use the mcast transport. This was written by Harald Welte and is
@@ -1194,7 +1194,7 @@
1194 1194
1195 1195
1196 1196
1197 66..66.. TTUUNN//TTAAPP wwiitthh tthhee uummll__nneett hheellppeerr 1197 6.6. TUN/TAP with the uml_net helper
1198 1198
1199 TUN/TAP is the preferred mechanism on 2.4 to exchange packets with the 1199 TUN/TAP is the preferred mechanism on 2.4 to exchange packets with the
1200 host. The TUN/TAP backend has been in UML since 2.4.9-3um. 1200 host. The TUN/TAP backend has been in UML since 2.4.9-3um.
@@ -1247,10 +1247,10 @@
1247 There are a couple potential problems with running the TUN/TAP 1247 There are a couple potential problems with running the TUN/TAP
1248 transport on a 2.4 host kernel 1248 transport on a 2.4 host kernel
1249 1249
1250 +o TUN/TAP seems not to work on 2.4.3 and earlier. Upgrade the host 1250 o TUN/TAP seems not to work on 2.4.3 and earlier. Upgrade the host
1251 kernel or use the ethertap transport. 1251 kernel or use the ethertap transport.
1252 1252
1253 +o With an upgraded kernel, TUN/TAP may fail with 1253 o With an upgraded kernel, TUN/TAP may fail with
1254 1254
1255 1255
1256 File descriptor in bad state 1256 File descriptor in bad state
@@ -1269,7 +1269,7 @@
1269 1269
1270 1270
1271 1271
1272 66..77.. TTUUNN//TTAAPP wwiitthh aa pprreeccoonnffiigguurreedd ttaapp ddeevviiccee 1272 6.7. TUN/TAP with a preconfigured tap device
1273 1273
1274 If you prefer not to have UML use uml_net (which is somewhat 1274 If you prefer not to have UML use uml_net (which is somewhat
1275 insecure), with UML 2.4.17-11, you can set up a TUN/TAP device 1275 insecure), with UML 2.4.17-11, you can set up a TUN/TAP device
@@ -1277,7 +1277,7 @@
1277 there is no need for root assistance. Setting up the device is done 1277 there is no need for root assistance. Setting up the device is done
1278 as follows: 1278 as follows:
1279 1279
1280 +o Create the device with tunctl (available from the UML utilities 1280 o Create the device with tunctl (available from the UML utilities
1281 tarball) 1281 tarball)
1282 1282
1283 1283
@@ -1291,7 +1291,7 @@
1291 where uid is the user id or username that UML will be run as. This 1291 where uid is the user id or username that UML will be run as. This
1292 will tell you what device was created. 1292 will tell you what device was created.
1293 1293
1294 +o Configure the device IP (change IP addresses and device name to 1294 o Configure the device IP (change IP addresses and device name to
1295 suit) 1295 suit)
1296 1296
1297 1297
@@ -1303,7 +1303,7 @@
1303 1303
1304 1304
1305 1305
1306 +o Set up routing and arping if desired - this is my recipe, there are 1306 o Set up routing and arping if desired - this is my recipe, there are
1307 other ways of doing the same thing 1307 other ways of doing the same thing
1308 1308
1309 1309
@@ -1338,7 +1338,7 @@
1338 utility which reads the information from a config file and sets up 1338 utility which reads the information from a config file and sets up
1339 devices at boot time. 1339 devices at boot time.
1340 1340
1341 +o Rather than using up two IPs and ARPing for one of them, you can 1341 o Rather than using up two IPs and ARPing for one of them, you can
1342 also provide direct access to your LAN by the UML by using a 1342 also provide direct access to your LAN by the UML by using a
1343 bridge. 1343 bridge.
1344 1344
@@ -1417,7 +1417,7 @@
1417 Note that 'br0' should be setup using ifconfig with the existing IP 1417 Note that 'br0' should be setup using ifconfig with the existing IP
1418 address of eth0, as eth0 no longer has its own IP. 1418 address of eth0, as eth0 no longer has its own IP.
1419 1419
1420 +o 1420 o
1421 1421
1422 1422
1423 Also, the /dev/net/tun device must be writable by the user running 1423 Also, the /dev/net/tun device must be writable by the user running
@@ -1438,11 +1438,11 @@
1438 devices and chgrp /dev/net/tun to that group with mode 664 or 660. 1438 devices and chgrp /dev/net/tun to that group with mode 664 or 660.
1439 1439
1440 1440
1441 +o Once the device is set up, run UML with 'eth0=tuntap,device name' 1441 o Once the device is set up, run UML with 'eth0=tuntap,device name'
1442 (i.e. 'eth0=tuntap,tap0') on the command line (or do it with the 1442 (i.e. 'eth0=tuntap,tap0') on the command line (or do it with the
1443 mconsole config command). 1443 mconsole config command).
1444 1444
1445 +o Bring the eth device up in UML and you're in business. 1445 o Bring the eth device up in UML and you're in business.
1446 1446
1447 If you don't want that tap device any more, you can make it non- 1447 If you don't want that tap device any more, you can make it non-
1448 persistent with 1448 persistent with
@@ -1465,7 +1465,7 @@
1465 1465
1466 1466
1467 1467
1468 66..88.. EEtthheerrttaapp 1468 6.8. Ethertap
1469 1469
1470 Ethertap is the general mechanism on 2.2 for userspace processes to 1470 Ethertap is the general mechanism on 2.2 for userspace processes to
1471 exchange packets with the kernel. 1471 exchange packets with the kernel.
@@ -1561,9 +1561,9 @@
1561 1561
1562 1562
1563 1563
1564 66..99.. TThhee sswwiittcchh ddaaeemmoonn 1564 6.9. The switch daemon
1565 1565
1566 NNoottee: This is the daemon formerly known as uml_router, but which was 1566 Note: This is the daemon formerly known as uml_router, but which was
1567 renamed so the network weenies of the world would stop growling at me. 1567 renamed so the network weenies of the world would stop growling at me.
1568 1568
1569 1569
@@ -1649,7 +1649,7 @@
1649 1649
1650 1650
1651 1651
1652 66..1100.. SSlliipp 1652 6.10. Slip
1653 1653
1654 Slip is another, less general, mechanism for a process to communicate 1654 Slip is another, less general, mechanism for a process to communicate
1655 with the host networking. In contrast to the ethertap interface, 1655 with the host networking. In contrast to the ethertap interface,
@@ -1681,7 +1681,7 @@
1681 1681
1682 1682
1683 1683
1684 66..1111.. SSlliirrpp 1684 6.11. Slirp
1685 1685
1686 slirp uses an external program, usually /usr/bin/slirp, to provide IP 1686 slirp uses an external program, usually /usr/bin/slirp, to provide IP
1687 only networking connectivity through the host. This is similar to IP 1687 only networking connectivity through the host. This is similar to IP
@@ -1737,7 +1737,7 @@
1737 1737
1738 1738
1739 1739
1740 66..1122.. ppccaapp 1740 6.12. pcap
1741 1741
1742 The pcap transport is attached to a UML ethernet device on the command 1742 The pcap transport is attached to a UML ethernet device on the command
1743 line or with uml_mconsole with the following syntax: 1743 line or with uml_mconsole with the following syntax:
@@ -1777,7 +1777,7 @@
1777 1777
1778 1778
1779 1779
1780 66..1133.. SSeettttiinngg uupp tthhee hhoosstt yyoouurrsseellff 1780 6.13. Setting up the host yourself
1781 1781
1782 If you don't specify an address for the host side of the ethertap or 1782 If you don't specify an address for the host side of the ethertap or
1783 slip device, UML won't do any setup on the host. So this is what is 1783 slip device, UML won't do any setup on the host. So this is what is
@@ -1785,7 +1785,7 @@
1785 192.168.0.251 and a UML-side IP of 192.168.0.250 - adjust to suit your 1785 192.168.0.251 and a UML-side IP of 192.168.0.250 - adjust to suit your
1786 own network): 1786 own network):
1787 1787
1788 +o The device needs to be configured with its IP address. Tap devices 1788 o The device needs to be configured with its IP address. Tap devices
1789 are also configured with an mtu of 1484. Slip devices are 1789 are also configured with an mtu of 1484. Slip devices are
1790 configured with a point-to-point address pointing at the UML ip 1790 configured with a point-to-point address pointing at the UML ip
1791 address. 1791 address.
@@ -1805,7 +1805,7 @@
1805 1805
1806 1806
1807 1807
1808 +o If a tap device is being set up, a route is set to the UML IP. 1808 o If a tap device is being set up, a route is set to the UML IP.
1809 1809
1810 1810
1811 UML# route add -host 192.168.0.250 gw 192.168.0.251 1811 UML# route add -host 192.168.0.250 gw 192.168.0.251
@@ -1814,7 +1814,7 @@
1814 1814
1815 1815
1816 1816
1817 +o To allow other hosts on your network to see the virtual machine, 1817 o To allow other hosts on your network to see the virtual machine,
1818 proxy arp is set up for it. 1818 proxy arp is set up for it.
1819 1819
1820 1820
@@ -1824,7 +1824,7 @@
1824 1824
1825 1825
1826 1826
1827 +o Finally, the host is set up to route packets. 1827 o Finally, the host is set up to route packets.
1828 1828
1829 1829
1830 host# echo 1 > /proc/sys/net/ipv4/ip_forward 1830 host# echo 1 > /proc/sys/net/ipv4/ip_forward
@@ -1838,12 +1838,12 @@
1838 1838
1839 1839
1840 1840
1841 77.. SShhaarriinngg FFiilleessyysstteemmss bbeettwweeeenn VViirrttuuaall MMaacchhiinneess 1841 7. Sharing Filesystems between Virtual Machines
1842 1842
1843 1843
1844 1844
1845 1845
1846 77..11.. AA wwaarrnniinngg 1846 7.1. A warning
1847 1847
1848 Don't attempt to share filesystems simply by booting two UMLs from the 1848 Don't attempt to share filesystems simply by booting two UMLs from the
1849 same file. That's the same thing as booting two physical machines 1849 same file. That's the same thing as booting two physical machines
@@ -1851,7 +1851,7 @@
1851 1851
1852 1852
1853 1853
1854 77..22.. UUssiinngg llaayyeerreedd bblloocckk ddeevviicceess 1854 7.2. Using layered block devices
1855 1855
1856 The way to share a filesystem between two virtual machines is to use 1856 The way to share a filesystem between two virtual machines is to use
1857 the copy-on-write (COW) layering capability of the ubd block driver. 1857 the copy-on-write (COW) layering capability of the ubd block driver.
@@ -1896,7 +1896,7 @@
1896 1896
1897 1897
1898 1898
1899 77..33.. NNoottee!! 1899 7.3. Note!
1900 1900
1901 When checking the size of the COW file in order to see the gobs of 1901 When checking the size of the COW file in order to see the gobs of
1902 space that you're saving, make sure you use 'ls -ls' to see the actual 1902 space that you're saving, make sure you use 'ls -ls' to see the actual
@@ -1926,7 +1926,7 @@
1926 1926
1927 1927
1928 1928
1929 77..44.. AAnnootthheerr wwaarrnniinngg 1929 7.4. Another warning
1930 1930
1931 Once a filesystem is being used as a readonly backing file for a COW 1931 Once a filesystem is being used as a readonly backing file for a COW
1932 file, do not boot directly from it or modify it in any way. Doing so 1932 file, do not boot directly from it or modify it in any way. Doing so
@@ -1952,7 +1952,7 @@
1952 1952
1953 1953
1954 1954
1955 77..55.. uummll__mmoooo :: MMeerrggiinngg aa CCOOWW ffiillee wwiitthh iittss bbaacckkiinngg ffiillee 1955 7.5. uml_moo : Merging a COW file with its backing file
1956 1956
1957 Depending on how you use UML and COW devices, it may be advisable to 1957 Depending on how you use UML and COW devices, it may be advisable to
1958 merge the changes in the COW file into the backing file every once in 1958 merge the changes in the COW file into the backing file every once in
@@ -2001,7 +2001,7 @@
2001 2001
2002 2002
2003 2003
2004 88.. CCrreeaattiinngg ffiilleessyysstteemmss 2004 8. Creating filesystems
2005 2005
2006 2006
2007 You may want to create and mount new UML filesystems, either because 2007 You may want to create and mount new UML filesystems, either because
@@ -2015,7 +2015,7 @@
2015 should be easy to translate to the filesystem of your choice. 2015 should be easy to translate to the filesystem of your choice.
2016 2016
2017 2017
2018 88..11.. CCrreeaattee tthhee ffiilleessyysstteemm ffiillee 2018 8.1. Create the filesystem file
2019 2019
2020 dd is your friend. All you need to do is tell dd to create an empty 2020 dd is your friend. All you need to do is tell dd to create an empty
2021 file of the appropriate size. I usually make it sparse to save time 2021 file of the appropriate size. I usually make it sparse to save time
@@ -2032,7 +2032,7 @@
2032 2032
2033 2033
2034 2034
2035 88..22.. AAssssiiggnn tthhee ffiillee ttoo aa UUMMLL ddeevviiccee 2035 8.2. Assign the file to a UML device
2036 2036
2037 Add an argument like the following to the UML command line: 2037 Add an argument like the following to the UML command line:
2038 2038
@@ -2045,7 +2045,7 @@
2045 2045
2046 2046
2047 2047
2048 88..33.. CCrreeaattiinngg aanndd mmoouunnttiinngg tthhee ffiilleessyysstteemm 2048 8.3. Creating and mounting the filesystem
2049 2049
2050 Make sure that the filesystem is available, either by being built into 2050 Make sure that the filesystem is available, either by being built into
2051 the kernel, or available as a module, then boot up UML and log in. If 2051 the kernel, or available as a module, then boot up UML and log in. If
@@ -2096,7 +2096,7 @@
2096 2096
2097 2097
2098 2098
2099 99.. HHoosstt ffiillee aacccceessss 2099 9. Host file access
2100 2100
2101 2101
2102 If you want to access files on the host machine from inside UML, you 2102 If you want to access files on the host machine from inside UML, you
@@ -2112,7 +2112,7 @@
2112 files contained in it just as you would on the host. 2112 files contained in it just as you would on the host.
2113 2113
2114 2114
2115 99..11.. UUssiinngg hhoossttffss 2115 9.1. Using hostfs
2116 2116
2117 To begin with, make sure that hostfs is available inside the virtual 2117 To begin with, make sure that hostfs is available inside the virtual
2118 machine with 2118 machine with
@@ -2151,7 +2151,7 @@
2151 2151
2152 2152
2153 2153
2154 99..22.. hhoossttffss aass tthhee rroooott ffiilleessyysstteemm 2154 9.2. hostfs as the root filesystem
2155 2155
2156 It's possible to boot from a directory hierarchy on the host using 2156 It's possible to boot from a directory hierarchy on the host using
2157 hostfs rather than using the standard filesystem in a file. 2157 hostfs rather than using the standard filesystem in a file.
@@ -2194,20 +2194,20 @@
2194 UML should then boot as it does normally. 2194 UML should then boot as it does normally.
2195 2195
2196 2196
2197 99..33.. BBuuiillddiinngg hhoossttffss 2197 9.3. Building hostfs
2198 2198
2199 If you need to build hostfs because it's not in your kernel, you have 2199 If you need to build hostfs because it's not in your kernel, you have
2200 two choices: 2200 two choices:
2201 2201
2202 2202
2203 2203
2204 +o Compiling hostfs into the kernel: 2204 o Compiling hostfs into the kernel:
2205 2205
2206 2206
2207 Reconfigure the kernel and set the 'Host filesystem' option under 2207 Reconfigure the kernel and set the 'Host filesystem' option under
2208 2208
2209 2209
2210 +o Compiling hostfs as a module: 2210 o Compiling hostfs as a module:
2211 2211
2212 2212
2213 Reconfigure the kernel and set the 'Host filesystem' option under 2213 Reconfigure the kernel and set the 'Host filesystem' option under
@@ -2228,7 +2228,7 @@
2228 2228
2229 2229
2230 2230
2231 1100.. TThhee MMaannaaggeemmeenntt CCoonnssoollee 2231 10. The Management Console
2232 2232
2233 2233
2234 2234
@@ -2240,15 +2240,15 @@
2240 2240
2241 There are a number of things you can do with the mconsole interface: 2241 There are a number of things you can do with the mconsole interface:
2242 2242
2243 +o get the kernel version 2243 o get the kernel version
2244 2244
2245 +o add and remove devices 2245 o add and remove devices
2246 2246
2247 +o halt or reboot the machine 2247 o halt or reboot the machine
2248 2248
2249 +o Send SysRq commands 2249 o Send SysRq commands
2250 2250
2251 +o Pause and resume the UML 2251 o Pause and resume the UML
2252 2252
2253 2253
2254 You need the mconsole client (uml_mconsole) which is present in CVS 2254 You need the mconsole client (uml_mconsole) which is present in CVS
@@ -2300,28 +2300,28 @@
2300 2300
2301 You'll get a prompt, at which you can run one of these commands: 2301 You'll get a prompt, at which you can run one of these commands:
2302 2302
2303 +o version 2303 o version
2304 2304
2305 +o halt 2305 o halt
2306 2306
2307 +o reboot 2307 o reboot
2308 2308
2309 +o config 2309 o config
2310 2310
2311 +o remove 2311 o remove
2312 2312
2313 +o sysrq 2313 o sysrq
2314 2314
2315 +o help 2315 o help
2316 2316
2317 +o cad 2317 o cad
2318 2318
2319 +o stop 2319 o stop
2320 2320
2321 +o go 2321 o go
2322 2322
2323 2323
2324 1100..11.. vveerrssiioonn 2324 10.1. version
2325 2325
2326 This takes no arguments. It prints the UML version. 2326 This takes no arguments. It prints the UML version.
2327 2327
@@ -2342,7 +2342,7 @@
2342 2342
2343 2343
2344 2344
2345 1100..22.. hhaalltt aanndd rreebboooott 2345 10.2. halt and reboot
2346 2346
2347 These take no arguments. They shut the machine down immediately, with 2347 These take no arguments. They shut the machine down immediately, with
2348 no syncing of disks and no clean shutdown of userspace. So, they are 2348 no syncing of disks and no clean shutdown of userspace. So, they are
@@ -2357,7 +2357,7 @@
2357 2357
2358 2358
2359 2359
2360 1100..33.. ccoonnffiigg 2360 10.3. config
2361 2361
2362 "config" adds a new device to the virtual machine. Currently the ubd 2362 "config" adds a new device to the virtual machine. Currently the ubd
2363 and network drivers support this. It takes one argument, which is the 2363 and network drivers support this. It takes one argument, which is the
@@ -2378,7 +2378,7 @@
2378 2378
2379 2379
2380 2380
2381 1100..44.. rreemmoovvee 2381 10.4. remove
2382 2382
2383 "remove" deletes a device from the system. Its argument is just the 2383 "remove" deletes a device from the system. Its argument is just the
2384 name of the device to be removed. The device must be idle in whatever 2384 name of the device to be removed. The device must be idle in whatever
@@ -2397,7 +2397,7 @@
2397 2397
2398 2398
2399 2399
2400 1100..55.. ssyyssrrqq 2400 10.5. sysrq
2401 2401
2402 This takes one argument, which is a single letter. It calls the 2402 This takes one argument, which is a single letter. It calls the
2403 generic kernel's SysRq driver, which does whatever is called for by 2403 generic kernel's SysRq driver, which does whatever is called for by
@@ -2407,14 +2407,14 @@
2407 2407
2408 2408
2409 2409
2410 1100..66.. hheellpp 2410 10.6. help
2411 2411
2412 "help" returns a string listing the valid commands and what each one 2412 "help" returns a string listing the valid commands and what each one
2413 does. 2413 does.
2414 2414
2415 2415
2416 2416
2417 1100..77.. ccaadd 2417 10.7. cad
2418 2418
2419 This invokes the Ctl-Alt-Del action on init. What exactly this ends 2419 This invokes the Ctl-Alt-Del action on init. What exactly this ends
2420 up doing is up to /etc/inittab. Normally, it reboots the machine. 2420 up doing is up to /etc/inittab. Normally, it reboots the machine.
@@ -2432,7 +2432,7 @@
2432 2432
2433 2433
2434 2434
2435 1100..88.. ssttoopp 2435 10.8. stop
2436 2436
2437 This puts the UML in a loop reading mconsole requests until a 'go' 2437 This puts the UML in a loop reading mconsole requests until a 'go'
2438 mconsole command is received. This is very useful for making backups 2438 mconsole command is received. This is very useful for making backups
@@ -2448,7 +2448,7 @@
2448 2448
2449 2449
2450 2450
2451 1100..99.. ggoo 2451 10.9. go
2452 2452
2453 This resumes a UML after being paused by a 'stop' command. Note that 2453 This resumes a UML after being paused by a 'stop' command. Note that
2454 when the UML has resumed, TCP connections may have timed out and if 2454 when the UML has resumed, TCP connections may have timed out and if
@@ -2462,10 +2462,10 @@
2462 2462
2463 2463
2464 2464
2465 1111.. KKeerrnneell ddeebbuuggggiinngg 2465 11. Kernel debugging
2466 2466
2467 2467
2468 NNoottee:: The interface that makes debugging, as described here, possible 2468 Note: The interface that makes debugging, as described here, possible
2469 is present in 2.4.0-test6 kernels and later. 2469 is present in 2.4.0-test6 kernels and later.
2470 2470
2471 2471
@@ -2485,7 +2485,7 @@
2485 2485
2486 2486
2487 2487
2488 1111..11.. SSttaarrttiinngg tthhee kkeerrnneell uunnddeerr ggddbb 2488 11.1. Starting the kernel under gdb
2489 2489
2490 You can have the kernel running under the control of gdb from the 2490 You can have the kernel running under the control of gdb from the
2491 beginning by putting 'debug' on the command line. You will get an 2491 beginning by putting 'debug' on the command line. You will get an
@@ -2498,7 +2498,7 @@
2498 There is a transcript of a debugging session here <debug- 2498 There is a transcript of a debugging session here <debug-
2499 session.html> , with breakpoints being set in the scheduler and in an 2499 session.html> , with breakpoints being set in the scheduler and in an
2500 interrupt handler. 2500 interrupt handler.
2501 1111..22.. EExxaammiinniinngg sslleeeeppiinngg pprroocceesssseess 2501 11.2. Examining sleeping processes
2502 2502
2503 Not every bug is evident in the currently running process. Sometimes, 2503 Not every bug is evident in the currently running process. Sometimes,
2504 processes hang in the kernel when they shouldn't because they've 2504 processes hang in the kernel when they shouldn't because they've
@@ -2516,7 +2516,7 @@
2516 2516
2517 Now what you do is this: 2517 Now what you do is this:
2518 2518
2519 +o detach from the current thread 2519 o detach from the current thread
2520 2520
2521 2521
2522 (UML gdb) det 2522 (UML gdb) det
@@ -2525,7 +2525,7 @@
2525 2525
2526 2526
2527 2527
2528 +o attach to the thread you are interested in 2528 o attach to the thread you are interested in
2529 2529
2530 2530
2531 (UML gdb) att <host pid> 2531 (UML gdb) att <host pid>
@@ -2534,7 +2534,7 @@
2534 2534
2535 2535
2536 2536
2537 +o look at its stack and anything else of interest 2537 o look at its stack and anything else of interest
2538 2538
2539 2539
2540 (UML gdb) bt 2540 (UML gdb) bt
@@ -2545,7 +2545,7 @@
2545 Note that you can't do anything at this point that requires that a 2545 Note that you can't do anything at this point that requires that a
2546 process execute, e.g. calling a function 2546 process execute, e.g. calling a function
2547 2547
2548 +o when you're done looking at that process, reattach to the current 2548 o when you're done looking at that process, reattach to the current
2549 thread and continue it 2549 thread and continue it
2550 2550
2551 2551
@@ -2569,12 +2569,12 @@
2569 2569
2570 2570
2571 2571
2572 1111..33.. RRuunnnniinngg dddddd oonn UUMMLL 2572 11.3. Running ddd on UML
2573 2573
2574 ddd works on UML, but requires a special kludge. The process goes 2574 ddd works on UML, but requires a special kludge. The process goes
2575 like this: 2575 like this:
2576 2576
2577 +o Start ddd 2577 o Start ddd
2578 2578
2579 2579
2580 host% ddd linux 2580 host% ddd linux
@@ -2583,14 +2583,14 @@
2583 2583
2584 2584
2585 2585
2586 +o With ps, get the pid of the gdb that ddd started. You can ask the 2586 o With ps, get the pid of the gdb that ddd started. You can ask the
2587 gdb to tell you, but for some reason that confuses things and 2587 gdb to tell you, but for some reason that confuses things and
2588 causes a hang. 2588 causes a hang.
2589 2589
2590 +o run UML with 'debug=parent gdb-pid=<pid>' added to the command line 2590 o run UML with 'debug=parent gdb-pid=<pid>' added to the command line
2591 - it will just sit there after you hit return 2591 - it will just sit there after you hit return
2592 2592
2593 +o type 'att 1' to the ddd gdb and you will see something like 2593 o type 'att 1' to the ddd gdb and you will see something like
2594 2594
2595 2595
2596 0xa013dc51 in __kill () 2596 0xa013dc51 in __kill ()
@@ -2602,12 +2602,12 @@
2602 2602
2603 2603
2604 2604
2605 +o At this point, type 'c', UML will boot up, and you can use ddd just 2605 o At this point, type 'c', UML will boot up, and you can use ddd just
2606 as you do on any other process. 2606 as you do on any other process.
2607 2607
2608 2608
2609 2609
2610 1111..44.. DDeebbuuggggiinngg mmoodduulleess 2610 11.4. Debugging modules
2611 2611
2612 gdb has support for debugging code which is dynamically loaded into 2612 gdb has support for debugging code which is dynamically loaded into
2613 the process. This support is what is needed to debug kernel modules 2613 the process. This support is what is needed to debug kernel modules
@@ -2823,7 +2823,7 @@
2823 2823
2824 2824
2825 2825
2826 1111..55.. AAttttaacchhiinngg ggddbb ttoo tthhee kkeerrnneell 2826 11.5. Attaching gdb to the kernel
2827 2827
2828 If you don't have the kernel running under gdb, you can attach gdb to 2828 If you don't have the kernel running under gdb, you can attach gdb to
2829 it later by sending the tracing thread a SIGUSR1. The first line of 2829 it later by sending the tracing thread a SIGUSR1. The first line of
@@ -2857,7 +2857,7 @@
2857 2857
2858 2858
2859 2859
2860 1111..66.. UUssiinngg aalltteerrnnaattee ddeebbuuggggeerrss 2860 11.6. Using alternate debuggers
2861 2861
2862 UML has support for attaching to an already running debugger rather 2862 UML has support for attaching to an already running debugger rather
2863 than starting gdb itself. This is present in CVS as of 17 Apr 2001. 2863 than starting gdb itself. This is present in CVS as of 17 Apr 2001.
@@ -2886,7 +2886,7 @@
2886 An example of an alternate debugger is strace. You can strace the 2886 An example of an alternate debugger is strace. You can strace the
2887 actual kernel as follows: 2887 actual kernel as follows:
2888 2888
2889 +o Run the following in a shell 2889 o Run the following in a shell
2890 2890
2891 2891
2892 host% 2892 host%
@@ -2894,10 +2894,10 @@
2894 2894
2895 2895
2896 2896
2897 +o Run UML with 'debug' and 'gdb-pid=<pid>' with the pid printed out 2897 o Run UML with 'debug' and 'gdb-pid=<pid>' with the pid printed out
2898 by the previous command 2898 by the previous command
2899 2899
2900 +o Hit return in the shell, and UML will start running, and strace 2900 o Hit return in the shell, and UML will start running, and strace
2901 output will start accumulating in the output file. 2901 output will start accumulating in the output file.
2902 2902
2903 Note that this is different from running 2903 Note that this is different from running
@@ -2917,9 +2917,9 @@
2917 2917
2918 2918
2919 2919
2920 1122.. KKeerrnneell ddeebbuuggggiinngg eexxaammpplleess 2920 12. Kernel debugging examples
2921 2921
2922 1122..11.. TThhee ccaassee ooff tthhee hhuunngg ffsscckk 2922 12.1. The case of the hung fsck
2923 2923
2924 When booting up the kernel, fsck failed, and dropped me into a shell 2924 When booting up the kernel, fsck failed, and dropped me into a shell
2925 to fix things up. I ran fsck -y, which hung: 2925 to fix things up. I ran fsck -y, which hung:
@@ -3154,9 +3154,9 @@
3154 3154
3155 The interesting things here are : 3155 The interesting things here are :
3156 3156
3157 +o There are two segfaults on this stack (frames 9 and 14) 3157 o There are two segfaults on this stack (frames 9 and 14)
3158 3158
3159 +o The first faulting address (frame 11) is 0x50000800 3159 o The first faulting address (frame 11) is 0x50000800
3160 3160
3161 (gdb) p (void *)1342179328 3161 (gdb) p (void *)1342179328
3162 $16 = (void *) 0x50000800 3162 $16 = (void *) 0x50000800
@@ -3399,7 +3399,7 @@
3399 on will be somewhat clearer. 3399 on will be somewhat clearer.
3400 3400
3401 3401
3402 1122..22.. EEppiissooddee 22:: TThhee ccaassee ooff tthhee hhuunngg ffsscckk 3402 12.2. Episode 2: The case of the hung fsck
3403 3403
3404 After setting a trap in the SEGV handler for accesses to the signal 3404 After setting a trap in the SEGV handler for accesses to the signal
3405 thread's stack, I reran the kernel. 3405 thread's stack, I reran the kernel.
@@ -3788,12 +3788,12 @@
3788 3788
3789 3789
3790 3790
3791 1133.. WWhhaatt ttoo ddoo wwhheenn UUMMLL ddooeessnn''tt wwoorrkk 3791 13. What to do when UML doesn't work
3792 3792
3793 3793
3794 3794
3795 3795
3796 1133..11.. SSttrraannggee ccoommppiillaattiioonn eerrrroorrss wwhheenn yyoouu bbuuiilldd ffrroomm ssoouurrccee 3796 13.1. Strange compilation errors when you build from source
3797 3797
3798 As of test11, it is necessary to have "ARCH=um" in the environment or 3798 As of test11, it is necessary to have "ARCH=um" in the environment or
3799 on the make command line for all steps in building UML, including 3799 on the make command line for all steps in building UML, including
@@ -3824,8 +3824,8 @@
3824 3824
3825 3825
3826 3826
3827 1133..33.. AA vvaarriieettyy ooff ppaanniiccss aanndd hhaannggss wwiitthh //ttmmpp oonn aa rreeiisseerrffss ffiilleessyyss-- 3827 13.3. A variety of panics and hangs with /tmp on a reiserfs filesys-
3828 tteemm 3828 tem
3829 3829
3830 I saw this on reiserfs 3.5.21 and it seems to be fixed in 3.5.27. 3830 I saw this on reiserfs 3.5.21 and it seems to be fixed in 3.5.27.
3831 Panics preceded by 3831 Panics preceded by
@@ -3842,8 +3842,8 @@
3842 3842
3843 3843
3844 3844
3845 1133..44.. TThhee ccoommppiillee ffaaiillss wwiitthh eerrrroorrss aabboouutt ccoonnfflliiccttiinngg ttyyppeess ffoorr 3845 13.4. The compile fails with errors about conflicting types for
3846 ''ooppeenn'',, ''dduupp'',, aanndd ''wwaaiittppiidd'' 3846 'open', 'dup', and 'waitpid'
3847 3847
3848 This happens when you build in /usr/src/linux. The UML build makes 3848 This happens when you build in /usr/src/linux. The UML build makes
3849 the include/asm link point to include/asm-um. /usr/include/asm points 3849 the include/asm link point to include/asm-um. /usr/include/asm points
@@ -3854,14 +3854,14 @@
3854 3854
3855 3855
3856 3856
3857 1133..55.. UUMMLL ddooeessnn''tt wwoorrkk wwhheenn //ttmmpp iiss aann NNFFSS ffiilleessyysstteemm 3857 13.5. UML doesn't work when /tmp is an NFS filesystem
3858 3858
3859 This seems to be a similar situation with the ReiserFS problem above. 3859 This seems to be a similar situation with the ReiserFS problem above.
3860 Some versions of NFS seems not to handle mmap correctly, which UML 3860 Some versions of NFS seems not to handle mmap correctly, which UML
3861 depends on. The workaround is have /tmp be a non-NFS directory. 3861 depends on. The workaround is have /tmp be a non-NFS directory.
3862 3862
3863 3863
3864 1133..66.. UUMMLL hhaannggss oonn bboooott wwhheenn ccoommppiilleedd wwiitthh ggpprrooff ssuuppppoorrtt 3864 13.6. UML hangs on boot when compiled with gprof support
3865 3865
3866 If you build UML with gprof support and, early in the boot, it does 3866 If you build UML with gprof support and, early in the boot, it does
3867 this 3867 this
@@ -3878,7 +3878,7 @@
3878 3878
3879 3879
3880 3880
3881 1133..77.. ssyyssllooggdd ddiieess wwiitthh aa SSIIGGTTEERRMM oonn ssttaarrttuupp 3881 13.7. syslogd dies with a SIGTERM on startup
3882 3882
3883 The exact boot error depends on the distribution that you're booting, 3883 The exact boot error depends on the distribution that you're booting,
3884 but Debian produces this: 3884 but Debian produces this:
@@ -3897,17 +3897,17 @@
3897 3897
3898 3898
3899 3899
3900 1133..88.. TTUUNN//TTAAPP nneettwwoorrkkiinngg ddooeessnn''tt wwoorrkk oonn aa 22..44 hhoosstt 3900 13.8. TUN/TAP networking doesn't work on a 2.4 host
3901 3901
3902 There are a couple of problems which were 3902 There are a couple of problems which were
3903 <http://www.geocrawler.com/lists/3/SourceForge/597/0/> name="pointed 3903 <http://www.geocrawler.com/lists/3/SourceForge/597/0/> name="pointed
3904 out"> by Tim Robinson <timro at trkr dot net> 3904 out"> by Tim Robinson <timro at trkr dot net>
3905 3905
3906 +o It doesn't work on hosts running 2.4.7 (or thereabouts) or earlier. 3906 o It doesn't work on hosts running 2.4.7 (or thereabouts) or earlier.
3907 The fix is to upgrade to something more recent and then read the 3907 The fix is to upgrade to something more recent and then read the
3908 next item. 3908 next item.
3909 3909
3910 +o If you see 3910 o If you see
3911 3911
3912 3912
3913 File descriptor in bad state 3913 File descriptor in bad state
@@ -3921,8 +3921,8 @@
3921 3921
3922 3922
3923 3923
3924 1133..99.. YYoouu ccaann nneettwwoorrkk ttoo tthhee hhoosstt bbuutt nnoott ttoo ootthheerr mmaacchhiinneess oonn tthhee 3924 13.9. You can network to the host but not to other machines on the
3925 nneett 3925 net
3926 3926
3927 If you can connect to the host, and the host can connect to UML, but 3927 If you can connect to the host, and the host can connect to UML, but
3928 you cannot connect to any other machines, then you may need to enable 3928 you cannot connect to any other machines, then you may need to enable
@@ -3972,7 +3972,7 @@
3972 3972
3973 3973
3974 3974
3975 1133..1100.. II hhaavvee nnoo rroooott aanndd II wwaanntt ttoo ssccrreeaamm 3975 13.10. I have no root and I want to scream
3976 3976
3977 Thanks to Birgit Wahlich for telling me about this strange one. It 3977 Thanks to Birgit Wahlich for telling me about this strange one. It
3978 turns out that there's a limit of six environment variables on the 3978 turns out that there's a limit of six environment variables on the
@@ -3987,7 +3987,7 @@
3987 3987
3988 3988
3989 3989
3990 1133..1111.. UUMMLL bbuuiilldd ccoonnfflliicctt bbeettwweeeenn ppttrraaccee..hh aanndd uuccoonntteexxtt..hh 3990 13.11. UML build conflict between ptrace.h and ucontext.h
3991 3991
3992 On some older systems, /usr/include/asm/ptrace.h and 3992 On some older systems, /usr/include/asm/ptrace.h and
3993 /usr/include/sys/ucontext.h define the same names. So, when they're 3993 /usr/include/sys/ucontext.h define the same names. So, when they're
@@ -4007,7 +4007,7 @@
4007 4007
4008 4008
4009 4009
4010 1133..1122.. TThhee UUMMLL BBooggooMMiippss iiss eexxaaccttllyy hhaallff tthhee hhoosstt''ss BBooggooMMiippss 4010 13.12. The UML BogoMips is exactly half the host's BogoMips
4011 4011
4012 On i386 kernels, there are two ways of running the loop that is used 4012 On i386 kernels, there are two ways of running the loop that is used
4013 to calculate the BogoMips rating, using the TSC if it's there or using 4013 to calculate the BogoMips rating, using the TSC if it's there or using
@@ -4019,7 +4019,7 @@
4019 4019
4020 4020
4021 4021
4022 1133..1133.. WWhheenn yyoouu rruunn UUMMLL,, iitt iimmmmeeddiiaatteellyy sseeggffaauullttss 4022 13.13. When you run UML, it immediately segfaults
4023 4023
4024 If the host is configured with the 2G/2G address space split, that's 4024 If the host is configured with the 2G/2G address space split, that's
4025 why. See ``UML on 2G/2G hosts'' for the details on getting UML to 4025 why. See ``UML on 2G/2G hosts'' for the details on getting UML to
@@ -4027,7 +4027,7 @@
4027 4027
4028 4028
4029 4029
4030 1133..1144.. xxtteerrmmss aappppeeaarr,, tthheenn iimmmmeeddiiaatteellyy ddiissaappppeeaarr 4030 13.14. xterms appear, then immediately disappear
4031 4031
4032 If you're running an up to date kernel with an old release of 4032 If you're running an up to date kernel with an old release of
4033 uml_utilities, the port-helper program will not work properly, so 4033 uml_utilities, the port-helper program will not work properly, so
@@ -4039,7 +4039,7 @@
4039 4039
4040 4040
4041 4041
4042 1133..1155.. AAnnyy ootthheerr ppaanniicc,, hhaanngg,, oorr ssttrraannggee bbeehhaavviioorr 4042 13.15. Any other panic, hang, or strange behavior
4043 4043
4044 If you're seeing truly strange behavior, such as hangs or panics that 4044 If you're seeing truly strange behavior, such as hangs or panics that
4045 happen in random places, or you try running the debugger to see what's 4045 happen in random places, or you try running the debugger to see what's
@@ -4059,7 +4059,7 @@
4059 4059
4060 If you want to be super-helpful, read ``Diagnosing Problems'' and 4060 If you want to be super-helpful, read ``Diagnosing Problems'' and
4061 follow the instructions contained therein. 4061 follow the instructions contained therein.
4062 1144.. DDiiaaggnnoossiinngg PPrroobblleemmss 4062 14. Diagnosing Problems
4063 4063
4064 4064
4065 If you get UML to crash, hang, or otherwise misbehave, you should 4065 If you get UML to crash, hang, or otherwise misbehave, you should
@@ -4078,7 +4078,7 @@
4078 ``Kernel debugging'' UML first. 4078 ``Kernel debugging'' UML first.
4079 4079
4080 4080
4081 1144..11.. CCaassee 11 :: NNoorrmmaall kkeerrnneell ppaanniiccss 4081 14.1. Case 1 : Normal kernel panics
4082 4082
4083 The most common case is for a normal thread to panic. To debug this, 4083 The most common case is for a normal thread to panic. To debug this,
4084 you will need to run it under the debugger (add 'debug' to the command 4084 you will need to run it under the debugger (add 'debug' to the command
@@ -4128,7 +4128,7 @@
4128 to get that information from the faulting ip. 4128 to get that information from the faulting ip.
4129 4129
4130 4130
4131 1144..22.. CCaassee 22 :: TTrraacciinngg tthhrreeaadd ppaanniiccss 4131 14.2. Case 2 : Tracing thread panics
4132 4132
4133 The less common and more painful case is when the tracing thread 4133 The less common and more painful case is when the tracing thread
4134 panics. In this case, the kernel debugger will be useless because it 4134 panics. In this case, the kernel debugger will be useless because it
@@ -4161,7 +4161,7 @@
4161 backtrace in and wait for our crack debugging team to fix the problem. 4161 backtrace in and wait for our crack debugging team to fix the problem.
4162 4162
4163 4163
4164 1144..33.. CCaassee 33 :: TTrraacciinngg tthhrreeaadd ppaanniiccss ccaauusseedd bbyy ootthheerr tthhrreeaaddss 4164 14.3. Case 3 : Tracing thread panics caused by other threads
4165 4165
4166 However, there are cases where the misbehavior of another thread 4166 However, there are cases where the misbehavior of another thread
4167 caused the problem. The most common panic of this type is: 4167 caused the problem. The most common panic of this type is:
@@ -4227,7 +4227,7 @@
4227 4227
4228 4228
4229 4229
4230 1144..44.. CCaassee 44 :: HHaannggss 4230 14.4. Case 4 : Hangs
4231 4231
4232 Hangs seem to be fairly rare, but they sometimes happen. When a hang 4232 Hangs seem to be fairly rare, but they sometimes happen. When a hang
4233 happens, we need a backtrace from the offending process. Run the 4233 happens, we need a backtrace from the offending process. Run the
@@ -4257,7 +4257,7 @@
4257 4257
4258 4258
4259 4259
4260 1155.. TThhaannkkss 4260 15. Thanks
4261 4261
4262 4262
4263 A number of people have helped this project in various ways, and this 4263 A number of people have helped this project in various ways, and this
@@ -4274,20 +4274,20 @@
4274 bookkeeping lapses and I forget about contributions. 4274 bookkeeping lapses and I forget about contributions.
4275 4275
4276 4276
4277 1155..11.. CCooddee aanndd DDooccuummeennttaattiioonn 4277 15.1. Code and Documentation
4278 4278
4279 Rusty Russell <rusty at linuxcare.com.au> - 4279 Rusty Russell <rusty at linuxcare.com.au> -
4280 4280
4281 +o wrote the HOWTO <http://user-mode- 4281 o wrote the HOWTO <http://user-mode-
4282 linux.sourceforge.net/UserModeLinux-HOWTO.html> 4282 linux.sourceforge.net/UserModeLinux-HOWTO.html>
4283 4283
4284 +o prodded me into making this project official and putting it on 4284 o prodded me into making this project official and putting it on
4285 SourceForge 4285 SourceForge
4286 4286
4287 +o came up with the way cool UML logo <http://user-mode- 4287 o came up with the way cool UML logo <http://user-mode-
4288 linux.sourceforge.net/uml-small.png> 4288 linux.sourceforge.net/uml-small.png>
4289 4289
4290 +o redid the config process 4290 o redid the config process
4291 4291
4292 4292
4293 Peter Moulder <reiter at netspace.net.au> - Fixed my config and build 4293 Peter Moulder <reiter at netspace.net.au> - Fixed my config and build
@@ -4296,18 +4296,18 @@
4296 4296
4297 Bill Stearns <wstearns at pobox.com> - 4297 Bill Stearns <wstearns at pobox.com> -
4298 4298
4299 +o HOWTO updates 4299 o HOWTO updates
4300 4300
4301 +o lots of bug reports 4301 o lots of bug reports
4302 4302
4303 +o lots of testing 4303 o lots of testing
4304 4304
4305 +o dedicated a box (uml.ists.dartmouth.edu) to support UML development 4305 o dedicated a box (uml.ists.dartmouth.edu) to support UML development
4306 4306
4307 +o wrote the mkrootfs script, which allows bootable filesystems of 4307 o wrote the mkrootfs script, which allows bootable filesystems of
4308 RPM-based distributions to be cranked out 4308 RPM-based distributions to be cranked out
4309 4309
4310 +o cranked out a large number of filesystems with said script 4310 o cranked out a large number of filesystems with said script
4311 4311
4312 4312
4313 Jim Leu <jleu at mindspring.com> - Wrote the virtual ethernet driver 4313 Jim Leu <jleu at mindspring.com> - Wrote the virtual ethernet driver
@@ -4375,176 +4375,176 @@
4375 4375
4376 David Coulson <http://davidcoulson.net> - 4376 David Coulson <http://davidcoulson.net> -
4377 4377
4378 +o Set up the usermodelinux.org <http://usermodelinux.org> site, 4378 o Set up the usermodelinux.org <http://usermodelinux.org> site,
4379 which is a great way of keeping the UML user community on top of 4379 which is a great way of keeping the UML user community on top of
4380 UML goings-on. 4380 UML goings-on.
4381 4381
4382 +o Site documentation and updates 4382 o Site documentation and updates
4383 4383
4384 +o Nifty little UML management daemon UMLd 4384 o Nifty little UML management daemon UMLd
4385 <http://uml.openconsultancy.com/umld/> 4385 <http://uml.openconsultancy.com/umld/>
4386 4386
4387 +o Lots of testing and bug reports 4387 o Lots of testing and bug reports
4388 4388
4389 4389
4390 4390
4391 4391
4392 1155..22.. FFlluusshhiinngg oouutt bbuuggss 4392 15.2. Flushing out bugs
4393 4393
4394 4394
4395 4395
4396 +o Yuri Pudgorodsky 4396 o Yuri Pudgorodsky
4397 4397
4398 +o Gerald Britton 4398 o Gerald Britton
4399 4399
4400 +o Ian Wehrman 4400 o Ian Wehrman
4401 4401
4402 +o Gord Lamb 4402 o Gord Lamb
4403 4403
4404 +o Eugene Koontz 4404 o Eugene Koontz
4405 4405
4406 +o John H. Hartman 4406 o John H. Hartman
4407 4407
4408 +o Anders Karlsson 4408 o Anders Karlsson
4409 4409
4410 +o Daniel Phillips 4410 o Daniel Phillips
4411 4411
4412 +o John Fremlin 4412 o John Fremlin
4413 4413
4414 +o Rainer Burgstaller 4414 o Rainer Burgstaller
4415 4415
4416 +o James Stevenson 4416 o James Stevenson
4417 4417
4418 +o Matt Clay 4418 o Matt Clay
4419 4419
4420 +o Cliff Jefferies 4420 o Cliff Jefferies
4421 4421
4422 +o Geoff Hoff 4422 o Geoff Hoff
4423 4423
4424 +o Lennert Buytenhek 4424 o Lennert Buytenhek
4425 4425
4426 +o Al Viro 4426 o Al Viro
4427 4427
4428 +o Frank Klingenhoefer 4428 o Frank Klingenhoefer
4429 4429
4430 +o Livio Baldini Soares 4430 o Livio Baldini Soares
4431 4431
4432 +o Jon Burgess 4432 o Jon Burgess
4433 4433
4434 +o Petru Paler 4434 o Petru Paler
4435 4435
4436 +o Paul 4436 o Paul
4437 4437
4438 +o Chris Reahard 4438 o Chris Reahard
4439 4439
4440 +o Sverker Nilsson 4440 o Sverker Nilsson
4441 4441
4442 +o Gong Su 4442 o Gong Su
4443 4443
4444 +o johan verrept 4444 o johan verrept
4445 4445
4446 +o Bjorn Eriksson 4446 o Bjorn Eriksson
4447 4447
4448 +o Lorenzo Allegrucci 4448 o Lorenzo Allegrucci
4449 4449
4450 +o Muli Ben-Yehuda 4450 o Muli Ben-Yehuda
4451 4451
4452 +o David Mansfield 4452 o David Mansfield
4453 4453
4454 +o Howard Goff 4454 o Howard Goff
4455 4455
4456 +o Mike Anderson 4456 o Mike Anderson
4457 4457
4458 +o John Byrne 4458 o John Byrne
4459 4459
4460 +o Sapan J. Batia 4460 o Sapan J. Batia
4461 4461
4462 +o Iris Huang 4462 o Iris Huang
4463 4463
4464 +o Jan Hudec 4464 o Jan Hudec
4465 4465
4466 +o Voluspa 4466 o Voluspa
4467 4467
4468 4468
4469 4469
4470 4470
4471 1155..33.. BBuugglleettss aanndd cclleeaann--uuppss 4471 15.3. Buglets and clean-ups
4472 4472
4473 4473
4474 4474
4475 +o Dave Zarzycki 4475 o Dave Zarzycki
4476 4476
4477 +o Adam Lazur 4477 o Adam Lazur
4478 4478
4479 +o Boria Feigin 4479 o Boria Feigin
4480 4480
4481 +o Brian J. Murrell 4481 o Brian J. Murrell
4482 4482
4483 +o JS 4483 o JS
4484 4484
4485 +o Roman Zippel 4485 o Roman Zippel
4486 4486
4487 +o Wil Cooley 4487 o Wil Cooley
4488 4488
4489 +o Ayelet Shemesh 4489 o Ayelet Shemesh
4490 4490
4491 +o Will Dyson 4491 o Will Dyson
4492 4492
4493 +o Sverker Nilsson 4493 o Sverker Nilsson
4494 4494
4495 +o dvorak 4495 o dvorak
4496 4496
4497 +o v.naga srinivas 4497 o v.naga srinivas
4498 4498
4499 +o Shlomi Fish 4499 o Shlomi Fish
4500 4500
4501 +o Roger Binns 4501 o Roger Binns
4502 4502
4503 +o johan verrept 4503 o johan verrept
4504 4504
4505 +o MrChuoi 4505 o MrChuoi
4506 4506
4507 +o Peter Cleve 4507 o Peter Cleve
4508 4508
4509 +o Vincent Guffens 4509 o Vincent Guffens
4510 4510
4511 +o Nathan Scott 4511 o Nathan Scott
4512 4512
4513 +o Patrick Caulfield 4513 o Patrick Caulfield
4514 4514
4515 +o jbearce 4515 o jbearce
4516 4516
4517 +o Catalin Marinas 4517 o Catalin Marinas
4518 4518
4519 +o Shane Spencer 4519 o Shane Spencer
4520 4520
4521 +o Zou Min 4521 o Zou Min
4522 4522
4523 4523
4524 +o Ryan Boder 4524 o Ryan Boder
4525 4525
4526 +o Lorenzo Colitti 4526 o Lorenzo Colitti
4527 4527
4528 +o Gwendal Grignou 4528 o Gwendal Grignou
4529 4529
4530 +o Andre' Breiler 4530 o Andre' Breiler
4531 4531
4532 +o Tsutomu Yasuda 4532 o Tsutomu Yasuda
4533 4533
4534 4534
4535 4535
4536 1155..44.. CCaassee SSttuuddiieess 4536 15.4. Case Studies
4537 4537
4538 4538
4539 +o Jon Wright 4539 o Jon Wright
4540 4540
4541 +o William McEwan 4541 o William McEwan
4542 4542
4543 +o Michael Richardson 4543 o Michael Richardson
4544 4544
4545 4545
4546 4546
4547 1155..55.. OOtthheerr ccoonnttrriibbuuttiioonnss 4547 15.5. Other contributions
4548 4548
4549 4549
4550 Bill Carr <Bill.Carr at compaq.com> made the Red Hat mkrootfs script 4550 Bill Carr <Bill.Carr at compaq.com> made the Red Hat mkrootfs script
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 70dabd1e0652..b9d7c4276682 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -1,5 +1,4 @@
1 1menu "UML Character Devices"
2menu "Character Devices"
3 2
4config STDERR_CONSOLE 3config STDERR_CONSOLE
5 bool "stderr console" 4 bool "stderr console"
@@ -105,92 +104,6 @@ config SSL_CHAN
105 this if you expect the UML that you build to be run in environments 104 this if you expect the UML that you build to be run in environments
106 which don't have a set of /dev/pty* devices. 105 which don't have a set of /dev/pty* devices.
107 106
108config UNIX98_PTYS
109 bool "Unix98 PTY support"
110 help
111 A pseudo terminal (PTY) is a software device consisting of two
112 halves: a master and a slave. The slave device behaves identical to
113 a physical terminal; the master device is used by a process to
114 read data from and write data to the slave, thereby emulating a
115 terminal. Typical programs for the master side are telnet servers
116 and xterms.
117
118 Linux has traditionally used the BSD-like names /dev/ptyxx for
119 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
120 has a number of problems. The GNU C library glibc 2.1 and later,
121 however, supports the Unix98 naming standard: in order to acquire a
122 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
123 terminal is then made available to the process and the pseudo
124 terminal slave can be accessed as /dev/pts/<number>. What was
125 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
126
127 All modern Linux systems use the Unix98 ptys. Say Y unless
128 you're on an embedded system and want to conserve memory.
129
130config LEGACY_PTYS
131 bool "Legacy (BSD) PTY support"
132 default y
133 help
134 A pseudo terminal (PTY) is a software device consisting of two
135 halves: a master and a slave. The slave device behaves identical to
136 a physical terminal; the master device is used by a process to
137 read data from and write data to the slave, thereby emulating a
138 terminal. Typical programs for the master side are telnet servers
139 and xterms.
140
141 Linux has traditionally used the BSD-like names /dev/ptyxx
142 for masters and /dev/ttyxx for slaves of pseudo
143 terminals. This scheme has a number of problems, including
144 security. This option enables these legacy devices; on most
145 systems, it is safe to say N.
146
147config RAW_DRIVER
148 tristate "RAW driver (/dev/raw/rawN)"
149 depends on BLOCK
150 help
151 The raw driver permits block devices to be bound to /dev/raw/rawN.
152 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
153 See the raw(8) manpage for more details.
154
155 Applications should preferably open the device (eg /dev/hda1)
156 with the O_DIRECT flag.
157
158config MAX_RAW_DEVS
159 int "Maximum number of RAW devices to support (1-8192)"
160 depends on RAW_DRIVER
161 default "256"
162 help
163 The maximum number of RAW devices that are supported.
164 Default is 256. Increase this number in case you need lots of
165 raw devices.
166
167config LEGACY_PTY_COUNT
168 int "Maximum number of legacy PTY in use"
169 depends on LEGACY_PTYS
170 default "256"
171 help
172 The maximum number of legacy PTYs that can be used at any one time.
173 The default is 256, and should be more than enough. Embedded
174 systems may want to reduce this to save memory.
175
176 When not in use, each legacy PTY occupies 12 bytes on 32-bit
177 architectures and 24 bytes on 64-bit architectures.
178
179config WATCHDOG
180 bool "Watchdog Timer Support"
181
182config WATCHDOG_NOWAYOUT
183 bool "Disable watchdog shutdown on close"
184 depends on WATCHDOG
185
186config SOFT_WATCHDOG
187 tristate "Software Watchdog"
188 depends on WATCHDOG
189
190config UML_WATCHDOG
191 tristate "UML watchdog"
192 depends on WATCHDOG
193
194config UML_SOUND 107config UML_SOUND
195 tristate "Sound support" 108 tristate "Sound support"
196 help 109 help
@@ -211,29 +124,4 @@ config HOSTAUDIO
211 tristate 124 tristate
212 default UML_SOUND 125 default UML_SOUND
213 126
214#It is selected elsewhere, so kconfig would warn without this.
215config HW_RANDOM
216 tristate
217 default n
218
219config UML_RANDOM
220 tristate "Hardware random number generator"
221 help
222 This option enables UML's "hardware" random number generator. It
223 attaches itself to the host's /dev/random, supplying as much entropy
224 as the host has, rather than the small amount the UML gets from its
225 own drivers. It registers itself as a standard hardware random number
226 generator, major 10, minor 183, and the canonical device name is
227 /dev/hwrng.
228 The way to make use of this is to install the rng-tools package
229 (check your distro, or download from
230 http://sourceforge.net/projects/gkernel/). rngd periodically reads
231 /dev/hwrng and injects the entropy into /dev/random.
232
233config MMAPPER
234 tristate "iomem emulation driver"
235 help
236 This driver allows a host file to be used as emulated IO memory inside
237 UML.
238
239endmenu 127endmenu
diff --git a/arch/um/Kconfig.rest b/arch/um/Kconfig.rest
index 0ccad0ff6d6e..567eb5fc21df 100644
--- a/arch/um/Kconfig.rest
+++ b/arch/um/Kconfig.rest
@@ -2,20 +2,14 @@ source "init/Kconfig"
2 2
3source "kernel/Kconfig.freezer" 3source "kernel/Kconfig.freezer"
4 4
5source "drivers/block/Kconfig"
6
7source "arch/um/Kconfig.char" 5source "arch/um/Kconfig.char"
8 6
9source "drivers/base/Kconfig" 7source "drivers/Kconfig"
10 8
11source "net/Kconfig" 9source "net/Kconfig"
12 10
13source "arch/um/Kconfig.net" 11source "arch/um/Kconfig.net"
14 12
15source "drivers/net/Kconfig"
16
17source "drivers/connector/Kconfig"
18
19source "fs/Kconfig" 13source "fs/Kconfig"
20 14
21source "security/Kconfig" 15source "security/Kconfig"
@@ -24,19 +18,4 @@ source "crypto/Kconfig"
24 18
25source "lib/Kconfig" 19source "lib/Kconfig"
26 20
27source "drivers/scsi/Kconfig"
28
29source "drivers/md/Kconfig"
30
31if BROKEN
32 source "drivers/mtd/Kconfig"
33endif
34
35source "drivers/leds/Kconfig"
36
37#This is just to shut up some Kconfig warnings, so no prompt.
38config INPUT
39 tristate
40 default n
41
42source "arch/um/Kconfig.debug" 21source "arch/um/Kconfig.debug"
diff --git a/arch/um/Kconfig.um b/arch/um/Kconfig.um
index b5e675e370c6..70fd690964e4 100644
--- a/arch/um/Kconfig.um
+++ b/arch/um/Kconfig.um
@@ -148,5 +148,11 @@ config KERNEL_STACK_ORDER
148 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
149 on UML, in which case, set this to 3. 149 on UML, in which case, set this to 3.
150 150
151config MMAPPER
152 tristate "iomem emulation driver"
153 help
154 This driver allows a host file to be used as emulated IO memory inside
155 UML.
156
151config NO_DMA 157config NO_DMA
152 def_bool y 158 def_bool y
diff --git a/arch/um/Makefile b/arch/um/Makefile
index c0f712cc7c5f..7730af6ec13f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -20,15 +20,27 @@ core-y += $(ARCH_DIR)/kernel/ \
20 20
21MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas 21MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
22 22
23HEADER_ARCH := $(SUBARCH)
24
25# Additional ARCH settings for x86
26ifeq ($(SUBARCH),i386)
27 HEADER_ARCH := x86
28endif
29ifeq ($(SUBARCH),x86_64)
30 HEADER_ARCH := x86
31endif
32
33HOST_DIR := arch/$(HEADER_ARCH)
34
23include $(srctree)/$(ARCH_DIR)/Makefile-skas 35include $(srctree)/$(ARCH_DIR)/Makefile-skas
36include $(srctree)/$(HOST_DIR)/Makefile.um
37
38core-y += $(HOST_DIR)/um/
24 39
25SHARED_HEADERS := $(ARCH_DIR)/include/shared 40SHARED_HEADERS := $(ARCH_DIR)/include/shared
26ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS) 41ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
27ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared 42ARCH_INCLUDE += -I$(srctree)/$(HOST_DIR)/um/shared
28ifneq ($(KBUILD_SRC),) 43KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
29ARCH_INCLUDE += -I$(SHARED_HEADERS)
30endif
31KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)
32 44
33# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so 45# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
34# named - it's a common symbol in libpcap, so we get a binary which crashes. 46# named - it's a common symbol in libpcap, so we get a binary which crashes.
@@ -47,14 +59,12 @@ KBUILD_AFLAGS += $(ARCH_INCLUDE)
47 59
48USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ 60USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
49 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \ 61 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
50 $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 62 $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
51
52include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
53 63
54#This will adjust *FLAGS accordingly to the platform. 64#This will adjust *FLAGS accordingly to the platform.
55include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) 65include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
56 66
57KBUILD_CPPFLAGS += -I$(srctree)/arch/$(HEADER_ARCH)/include 67KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include
58 68
59# -Derrno=kernel_errno - This turns all kernel references to errno into 69# -Derrno=kernel_errno - This turns all kernel references to errno into
60# kernel_errno to separate them from the libc errno. This allows -fno-common 70# kernel_errno to separate them from the libc errno. This allows -fno-common
@@ -84,10 +94,9 @@ define archhelp
84 echo ' find in the kernel root.' 94 echo ' find in the kernel root.'
85endef 95endef
86 96
87KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) 97KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
88 98
89archprepare: $(SHARED_HEADERS)/user_constants.h 99archprepare: include/generated/user_constants.h
90archprepare: $(SHARED_HEADERS)/kern_constants.h
91 100
92LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 101LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
93LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 102LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -118,9 +127,7 @@ endef
118 127
119# When cleaning we don't include .config, so we don't include 128# When cleaning we don't include .config, so we don't include
120# TT or skas makefiles and don't clean skas_ptregs.h. 129# TT or skas makefiles and don't clean skas_ptregs.h.
121CLEAN_FILES += linux x.i gmon.out \ 130CLEAN_FILES += linux x.i gmon.out
122 $(SHARED_HEADERS)/user_constants.h \
123 $(SHARED_HEADERS)/kern_constants.h
124 131
125archclean: 132archclean:
126 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 133 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
@@ -128,8 +135,8 @@ archclean:
128 135
129# Generated files 136# Generated files
130 137
131$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE 138$(HOST_DIR)/um/user-offsets.s: FORCE
132 $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(SUBARCH) $@ 139 $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
133 140
134define filechk_gen-asm-offsets 141define filechk_gen-asm-offsets
135 (set -e; \ 142 (set -e; \
@@ -144,11 +151,7 @@ define filechk_gen-asm-offsets
144 echo ""; ) 151 echo ""; )
145endef 152endef
146 153
147$(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s 154include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
148 $(call filechk,gen-asm-offsets) 155 $(call filechk,gen-asm-offsets)
149 156
150$(SHARED_HEADERS)/kern_constants.h: 157export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
151 $(Q)mkdir -p $(dir $@)
152 $(Q)echo '#include "../../../../include/generated/asm-offsets.h"' >$@
153
154export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
deleted file mode 100644
index a9cd7e77a7ab..000000000000
--- a/arch/um/Makefile-x86_64
+++ /dev/null
@@ -1,26 +0,0 @@
1# Copyright 2003 - 2004 Pathscale, Inc
2# Released under the GPL
3
4core-y += arch/um/sys-x86_64/ arch/x86/crypto/
5START := 0x60000000
6
7_extra_flags_ = -fno-builtin -m64
8
9KBUILD_CFLAGS += $(_extra_flags_)
10
11CHECKFLAGS += -m64 -D__x86_64__
12KBUILD_AFLAGS += -m64
13LDFLAGS += -m elf_x86_64
14KBUILD_CPPFLAGS += -m64
15
16ELF_ARCH := i386:x86-64
17ELF_FORMAT := elf64-x86-64
18HEADER_ARCH := x86
19
20# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
21
22LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
23LINK-y += -m64
24
25# Do unit-at-a-time unconditionally on x86_64, following the host
26KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
diff --git a/arch/um/include/shared/chan_kern.h b/arch/um/drivers/chan.h
index 1e651457e049..8df0fd9024dc 100644
--- a/arch/um/include/shared/chan_kern.h
+++ b/arch/um/drivers/chan.h
@@ -6,9 +6,9 @@
6#ifndef __CHAN_KERN_H__ 6#ifndef __CHAN_KERN_H__
7#define __CHAN_KERN_H__ 7#define __CHAN_KERN_H__
8 8
9#include "linux/tty.h" 9#include <linux/tty.h>
10#include "linux/list.h" 10#include <linux/list.h>
11#include "linux/console.h" 11#include <linux/console.h>
12#include "chan_user.h" 12#include "chan_user.h"
13#include "line.h" 13#include "line.h"
14 14
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index d4191fe1cede..420e2c800799 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -6,7 +6,7 @@
6#include <linux/slab.h> 6#include <linux/slab.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/tty_flip.h> 8#include <linux/tty_flip.h>
9#include "chan_kern.h" 9#include "chan.h"
10#include "os.h" 10#include "os.h"
11 11
12#ifdef CONFIG_NOCONFIG_CHAN 12#ifdef CONFIG_NOCONFIG_CHAN
@@ -358,11 +358,11 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
358 return 0; 358 return 0;
359} 359}
360 360
361static void free_one_chan(struct chan *chan, int delay_free_irq) 361static void free_one_chan(struct chan *chan)
362{ 362{
363 list_del(&chan->list); 363 list_del(&chan->list);
364 364
365 close_one_chan(chan, delay_free_irq); 365 close_one_chan(chan, 0);
366 366
367 if (chan->ops->free != NULL) 367 if (chan->ops->free != NULL)
368 (*chan->ops->free)(chan->data); 368 (*chan->ops->free)(chan->data);
@@ -372,14 +372,14 @@ static void free_one_chan(struct chan *chan, int delay_free_irq)
372 kfree(chan); 372 kfree(chan);
373} 373}
374 374
375static void free_chan(struct list_head *chans, int delay_free_irq) 375static void free_chan(struct list_head *chans)
376{ 376{
377 struct list_head *ele, *next; 377 struct list_head *ele, *next;
378 struct chan *chan; 378 struct chan *chan;
379 379
380 list_for_each_safe(ele, next, chans) { 380 list_for_each_safe(ele, next, chans) {
381 chan = list_entry(ele, struct chan, list); 381 chan = list_entry(ele, struct chan, list);
382 free_one_chan(chan, delay_free_irq); 382 free_one_chan(chan);
383 } 383 }
384} 384}
385 385
@@ -547,7 +547,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
547 char *in, *out; 547 char *in, *out;
548 548
549 if (!list_empty(chans)) { 549 if (!list_empty(chans)) {
550 free_chan(chans, 0); 550 free_chan(chans);
551 INIT_LIST_HEAD(chans); 551 INIT_LIST_HEAD(chans);
552 } 552 }
553 553
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index cfeb3f4a44af..f180813ce2c7 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -11,10 +11,8 @@
11#include <termios.h> 11#include <termios.h>
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
15#include "os.h" 14#include "os.h"
16#include "um_malloc.h" 15#include "um_malloc.h"
17#include "user.h"
18 16
19void generic_close(int fd, void *unused) 17void generic_close(int fd, void *unused)
20{ 18{
@@ -283,7 +281,12 @@ void register_winch(int fd, struct tty_struct *tty)
283 return; 281 return;
284 282
285 pid = tcgetpgrp(fd); 283 pid = tcgetpgrp(fd);
286 if (!is_skas_winch(pid, fd, tty) && (pid == -1)) { 284 if (is_skas_winch(pid, fd, tty)) {
285 register_winch_irq(-1, fd, -1, tty, 0);
286 return;
287 }
288
289 if (pid == -1) {
287 thread = winch_tramp(fd, tty, &thread_fd, &stack); 290 thread = winch_tramp(fd, tty, &thread_fd, &stack);
288 if (thread < 0) 291 if (thread < 0)
289 return; 292 return;
diff --git a/arch/um/include/shared/chan_user.h b/arch/um/drivers/chan_user.h
index 9b9ced85b703..9b9ced85b703 100644
--- a/arch/um/include/shared/chan_user.h
+++ b/arch/um/drivers/chan_user.h
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index f5701fd2ef90..7f2ed0b8824a 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -3,7 +3,6 @@
3 3
4#include "kern_util.h" 4#include "kern_util.h"
5#include "os.h" 5#include "os.h"
6#include "user.h"
7#include "um_malloc.h" 6#include "um_malloc.h"
8 7
9static inline void *cow_malloc(int size) 8static inline void *cow_malloc(int size)
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index f8e85e0bdace..a4fd7bc14af7 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -17,7 +17,6 @@
17#include "net_user.h" 17#include "net_user.h"
18#include "os.h" 18#include "os.h"
19#include "um_malloc.h" 19#include "um_malloc.h"
20#include "user.h"
21 20
22enum request_type { REQ_NEW_CONTROL }; 21enum request_type { REQ_NEW_CONTROL };
23 22
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index f5a981a16240..5b81d2574415 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -9,10 +9,8 @@
9#include <errno.h> 9#include <errno.h>
10#include <termios.h> 10#include <termios.h>
11#include "chan_user.h" 11#include "chan_user.h"
12#include "kern_constants.h"
13#include "os.h" 12#include "os.h"
14#include "um_malloc.h" 13#include "um_malloc.h"
15#include "user.h"
16 14
17struct fd_chan { 15struct fd_chan {
18 int fd; 16 int fd;
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index 84dce3fc590c..0345d6206d40 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -7,7 +7,6 @@
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include "os.h" 9#include "os.h"
10#include "user.h"
11 10
12struct dog_data { 11struct dog_data {
13 int stdin; 12 int stdin;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 364c8a15c4c3..c1cf2206b84b 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -7,7 +7,7 @@
7#include "linux/kd.h" 7#include "linux/kd.h"
8#include "linux/sched.h" 8#include "linux/sched.h"
9#include "linux/slab.h" 9#include "linux/slab.h"
10#include "chan_kern.h" 10#include "chan.h"
11#include "irq_kern.h" 11#include "irq_kern.h"
12#include "irq_user.h" 12#include "irq_user.h"
13#include "kern_util.h" 13#include "kern_util.h"
diff --git a/arch/um/include/shared/line.h b/arch/um/drivers/line.h
index 63df3ca02ac2..63df3ca02ac2 100644
--- a/arch/um/include/shared/line.h
+++ b/arch/um/drivers/line.h
diff --git a/arch/um/include/shared/mconsole.h b/arch/um/drivers/mconsole.h
index c139ae1d6826..c139ae1d6826 100644
--- a/arch/um/include/shared/mconsole.h
+++ b/arch/um/drivers/mconsole.h
diff --git a/arch/um/include/shared/mconsole_kern.h b/arch/um/drivers/mconsole_kern.h
index d2fe07e78958..d2fe07e78958 100644
--- a/arch/um/include/shared/mconsole_kern.h
+++ b/arch/um/drivers/mconsole_kern.h
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index f8cf4c8bedef..99209826adb1 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -10,9 +10,7 @@
10#include <sys/socket.h> 10#include <sys/socket.h>
11#include <sys/uio.h> 11#include <sys/uio.h>
12#include <sys/un.h> 12#include <sys/un.h>
13#include "kern_constants.h"
14#include "mconsole.h" 13#include "mconsole.h"
15#include "user.h"
16 14
17static struct mconsole_command commands[] = { 15static struct mconsole_command commands[] = {
18 /* 16 /*
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 520118888f16..05090c37fa84 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -12,10 +12,8 @@
12#include <sys/socket.h> 12#include <sys/socket.h>
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include "net_user.h" 14#include "net_user.h"
15#include "kern_constants.h"
16#include "os.h" 15#include "os.h"
17#include "um_malloc.h" 16#include "um_malloc.h"
18#include "user.h"
19 17
20int tap_open_common(void *dev, char *gate_addr) 18int tap_open_common(void *dev, char *gate_addr)
21{ 19{
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index 5f903587d69e..702a75b190ee 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -9,9 +9,7 @@
9#include <asm/types.h> 9#include <asm/types.h>
10#include "net_user.h" 10#include "net_user.h"
11#include "pcap_user.h" 11#include "pcap_user.h"
12#include "kern_constants.h"
13#include "um_malloc.h" 12#include "um_malloc.h"
14#include "user.h"
15 13
16#define PCAP_FD(p) (*(int *)(p)) 14#define PCAP_FD(p) (*(int *)(p))
17 15
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index b49bf56a56aa..7b010b76ddf0 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -10,11 +10,9 @@
10#include <unistd.h> 10#include <unistd.h>
11#include <netinet/in.h> 11#include <netinet/in.h>
12#include "chan_user.h" 12#include "chan_user.h"
13#include "kern_constants.h"
14#include "os.h" 13#include "os.h"
15#include "port.h" 14#include "port.h"
16#include "um_malloc.h" 15#include "um_malloc.h"
17#include "user.h"
18 16
19struct port_chan { 17struct port_chan {
20 int raw; 18 int raw;
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 1113911dcb2b..cff2b75d31fd 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -12,10 +12,8 @@
12#include <termios.h> 12#include <termios.h>
13#include <sys/stat.h> 13#include <sys/stat.h>
14#include "chan_user.h" 14#include "chan_user.h"
15#include "kern_constants.h"
16#include "os.h" 15#include "os.h"
17#include "um_malloc.h" 16#include "um_malloc.h"
18#include "user.h"
19 17
20struct pty_chan { 18struct pty_chan {
21 void (*announce)(char *dev_name, int dev); 19 void (*announce)(char *dev_name, int dev);
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index cbacfc4e63e6..932b4d69bec2 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -11,12 +11,10 @@
11#include <string.h> 11#include <string.h>
12#include <sys/termios.h> 12#include <sys/termios.h>
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include "kern_constants.h"
15#include "net_user.h" 14#include "net_user.h"
16#include "os.h" 15#include "os.h"
17#include "slip.h" 16#include "slip.h"
18#include "um_malloc.h" 17#include "um_malloc.h"
19#include "user.h"
20 18
21static int slip_user_init(void *data, void *dev) 19static int slip_user_init(void *data, void *dev)
22{ 20{
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c
index a0ada8fec72a..db4adb639ff8 100644
--- a/arch/um/drivers/slirp_user.c
+++ b/arch/um/drivers/slirp_user.c
@@ -7,11 +7,9 @@
7#include <errno.h> 7#include <errno.h>
8#include <string.h> 8#include <string.h>
9#include <sys/wait.h> 9#include <sys/wait.h>
10#include "kern_constants.h"
11#include "net_user.h" 10#include "net_user.h"
12#include "os.h" 11#include "os.h"
13#include "slirp.h" 12#include "slirp.h"
14#include "user.h"
15 13
16static int slirp_user_init(void *data, void *dev) 14static int slirp_user_init(void *data, void *dev)
17{ 15{
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index f1786e64607f..9d8c20af6f80 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -12,10 +12,8 @@
12#include "linux/console.h" 12#include "linux/console.h"
13#include "asm/termbits.h" 13#include "asm/termbits.h"
14#include "asm/irq.h" 14#include "asm/irq.h"
15#include "line.h"
16#include "ssl.h" 15#include "ssl.h"
17#include "chan_kern.h" 16#include "chan.h"
18#include "kern.h"
19#include "init.h" 17#include "init.h"
20#include "irq_user.h" 18#include "irq_user.h"
21#include "mconsole_kern.h" 19#include "mconsole_kern.h"
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 49266f6108c4..088776f01908 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -20,8 +20,7 @@
20#include "asm/current.h" 20#include "asm/current.h"
21#include "asm/irq.h" 21#include "asm/irq.h"
22#include "stdio_console.h" 22#include "stdio_console.h"
23#include "line.h" 23#include "chan.h"
24#include "chan_kern.h"
25#include "irq_user.h" 24#include "irq_user.h"
26#include "mconsole_kern.h" 25#include "mconsole_kern.h"
27#include "init.h" 26#include "init.h"
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index 495858a090e4..a97391f9ec54 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -7,10 +7,8 @@
7#include <fcntl.h> 7#include <fcntl.h>
8#include <termios.h> 8#include <termios.h>
9#include "chan_user.h" 9#include "chan_user.h"
10#include "kern_constants.h"
11#include "os.h" 10#include "os.h"
12#include "um_malloc.h" 11#include "um_malloc.h"
13#include "user.h"
14 12
15struct tty_chan { 13struct tty_chan {
16 char *dev; 14 char *dev;
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 620f5b70957d..944453a3ec99 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -46,7 +46,6 @@
46#include "asm/tlbflush.h" 46#include "asm/tlbflush.h"
47#include "mem_user.h" 47#include "mem_user.h"
48#include "kern_util.h" 48#include "kern_util.h"
49#include "kern.h"
50#include "mconsole_kern.h" 49#include "mconsole_kern.h"
51#include "init.h" 50#include "init.h"
52#include "irq_user.h" 51#include "irq_user.h"
@@ -54,7 +53,6 @@
54#include "ubd_user.h" 53#include "ubd_user.h"
55#include "os.h" 54#include "os.h"
56#include "mem.h" 55#include "mem.h"
57#include "mem_kern.h"
58#include "cow.h" 56#include "cow.h"
59 57
60enum ubd_req { UBD_READ, UBD_WRITE }; 58enum ubd_req { UBD_READ, UBD_WRITE };
@@ -513,8 +511,37 @@ __uml_exitcall(kill_io_thread);
513static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) 511static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out)
514{ 512{
515 char *file; 513 char *file;
514 int fd;
515 int err;
516
517 __u32 version;
518 __u32 align;
519 char *backing_file;
520 time_t mtime;
521 unsigned long long size;
522 int sector_size;
523 int bitmap_offset;
524
525 if (ubd_dev->file && ubd_dev->cow.file) {
526 file = ubd_dev->cow.file;
527
528 goto out;
529 }
516 530
517 file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file; 531 fd = os_open_file(ubd_dev->file, global_openflags, 0);
532 if (fd < 0)
533 return fd;
534
535 err = read_cow_header(file_reader, &fd, &version, &backing_file, \
536 &mtime, &size, &sector_size, &align, &bitmap_offset);
537 os_close_file(fd);
538
539 if(err == -EINVAL)
540 file = ubd_dev->file;
541 else
542 file = backing_file;
543
544out:
518 return os_file_size(file, size_out); 545 return os_file_size(file, size_out);
519} 546}
520 547
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index b591bb9c41dd..007b94d97726 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -16,7 +16,6 @@
16#include <sys/mman.h> 16#include <sys/mman.h>
17#include <sys/param.h> 17#include <sys/param.h>
18#include "asm/types.h" 18#include "asm/types.h"
19#include "user.h"
20#include "ubd_user.h" 19#include "ubd_user.h"
21#include "os.h" 20#include "os.h"
22#include "cow.h" 21#include "cow.h"
diff --git a/arch/um/include/shared/ubd_user.h b/arch/um/drivers/ubd_user.h
index 3845051f1b10..3845051f1b10 100644
--- a/arch/um/include/shared/ubd_user.h
+++ b/arch/um/drivers/ubd_user.h
diff --git a/arch/um/drivers/umcast_user.c b/arch/um/drivers/umcast_user.c
index 59c56fd6f52a..010fa2d849ec 100644
--- a/arch/um/drivers/umcast_user.c
+++ b/arch/um/drivers/umcast_user.c
@@ -15,11 +15,9 @@
15#include <unistd.h> 15#include <unistd.h>
16#include <errno.h> 16#include <errno.h>
17#include <netinet/in.h> 17#include <netinet/in.h>
18#include "kern_constants.h"
19#include "umcast.h" 18#include "umcast.h"
20#include "net_user.h" 19#include "net_user.h"
21#include "um_malloc.h" 20#include "um_malloc.h"
22#include "user.h"
23 21
24static struct sockaddr_in *new_addr(char *addr, unsigned short port) 22static struct sockaddr_in *new_addr(char *addr, unsigned short port)
25{ 23{
diff --git a/arch/um/drivers/vde_user.c b/arch/um/drivers/vde_user.c
index c5c43253e6ce..b8c286748d3d 100644
--- a/arch/um/drivers/vde_user.c
+++ b/arch/um/drivers/vde_user.c
@@ -6,10 +6,8 @@
6#include <stddef.h> 6#include <stddef.h>
7#include <errno.h> 7#include <errno.h>
8#include <libvdeplug.h> 8#include <libvdeplug.h>
9#include "kern_constants.h"
10#include "net_user.h" 9#include "net_user.h"
11#include "um_malloc.h" 10#include "um_malloc.h"
12#include "user.h"
13#include "vde.h" 11#include "vde.h"
14 12
15static int vde_user_init(void *data, void *dev) 13static int vde_user_init(void *data, void *dev)
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 2e1de5728604..969110e56487 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -11,10 +11,8 @@
11#include <string.h> 11#include <string.h>
12#include <termios.h> 12#include <termios.h>
13#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
15#include "os.h" 14#include "os.h"
16#include "um_malloc.h" 15#include "um_malloc.h"
17#include "user.h"
18#include "xterm.h" 16#include "xterm.h"
19 17
20struct xterm_chan { 18struct xterm_chan {
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
new file mode 100644
index 000000000000..451f4517b334
--- /dev/null
+++ b/arch/um/include/asm/Kbuild
@@ -0,0 +1,3 @@
1generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
3generic-y += ftrace.h
diff --git a/arch/um/include/asm/bug.h b/arch/um/include/asm/bug.h
deleted file mode 100644
index 9e33b864c359..000000000000
--- a/arch/um/include/asm/bug.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_BUG_H
2#define __UM_BUG_H
3
4#include <asm-generic/bug.h>
5
6#endif
diff --git a/arch/um/include/asm/checksum.h b/arch/um/include/asm/checksum.h
deleted file mode 100644
index 5b501361e361..000000000000
--- a/arch/um/include/asm/checksum.h
+++ /dev/null
@@ -1,6 +0,0 @@
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/cputime.h b/arch/um/include/asm/cputime.h
deleted file mode 100644
index c84acbadfa2f..000000000000
--- a/arch/um/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
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/device.h b/arch/um/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/um/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
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/emergency-restart.h b/arch/um/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/um/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
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/ftrace.h b/arch/um/include/asm/ftrace.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/um/include/asm/ftrace.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/um/include/asm/futex.h b/arch/um/include/asm/futex.h
deleted file mode 100644
index 6a332a9f099c..000000000000
--- a/arch/um/include/asm/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
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
deleted file mode 100644
index fb3c05a0cbbf..000000000000
--- a/arch/um/include/asm/hardirq.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/hardirq.h>
diff --git a/arch/um/include/asm/hw_irq.h b/arch/um/include/asm/hw_irq.h
deleted file mode 100644
index 1cf84cf5f21a..000000000000
--- a/arch/um/include/asm/hw_irq.h
+++ /dev/null
@@ -1,7 +0,0 @@
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/irq_regs.h b/arch/um/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/um/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h
index 659b9abdfdba..c780d8a16773 100644
--- a/arch/um/include/asm/irqflags.h
+++ b/arch/um/include/asm/irqflags.h
@@ -1,6 +1,42 @@
1#ifndef __UM_IRQFLAGS_H 1#ifndef __UM_IRQFLAGS_H
2#define __UM_IRQFLAGS_H 2#define __UM_IRQFLAGS_H
3 3
4/* Empty for now */ 4extern int get_signals(void);
5extern int set_signals(int enable);
6extern void block_signals(void);
7extern void unblock_signals(void);
8
9static inline unsigned long arch_local_save_flags(void)
10{
11 return get_signals();
12}
13
14static inline void arch_local_irq_restore(unsigned long flags)
15{
16 set_signals(flags);
17}
18
19static inline void arch_local_irq_enable(void)
20{
21 unblock_signals();
22}
23
24static inline void arch_local_irq_disable(void)
25{
26 block_signals();
27}
28
29static inline unsigned long arch_local_irq_save(void)
30{
31 unsigned long flags;
32 flags = arch_local_save_flags();
33 arch_local_irq_disable();
34 return flags;
35}
36
37static inline bool arch_irqs_disabled(void)
38{
39 return arch_local_save_flags() == 0;
40}
5 41
6#endif 42#endif
diff --git a/arch/um/include/asm/kdebug.h b/arch/um/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/um/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
index cf259de51531..30509b9f37fd 100644
--- a/arch/um/include/asm/mmu.h
+++ b/arch/um/include/asm/mmu.h
@@ -1,12 +1,24 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __MMU_H 6#ifndef __ARCH_UM_MMU_H
7#define __MMU_H 7#define __ARCH_UM_MMU_H
8 8
9#include "um_mmu.h" 9#include "mm_id.h"
10#include <asm/mm_context.h>
10 11
11#endif 12typedef struct mm_context {
13 struct mm_id id;
14 struct uml_arch_mm_context arch;
15 struct page **stub_pages;
16} mm_context_t;
17
18extern void __switch_mm(struct mm_id * mm_idp);
12 19
20/* Avoid tangled inclusion with asm/ldt.h */
21extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
22extern void free_ldt(struct mm_context *mm);
23
24#endif
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index 34d813011b7a..591b3d8d7614 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -6,15 +6,12 @@
6#ifndef __UM_MMU_CONTEXT_H 6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H 7#define __UM_MMU_CONTEXT_H
8 8
9#include "linux/sched.h" 9#include <linux/sched.h>
10#include "um_mmu.h" 10#include <asm/mmu.h>
11 11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); 12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm); 13extern void arch_exit_mmap(struct mm_struct *mm);
14 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) 15#define deactivate_mm(tsk,mm) do { } while (0)
19 16
20extern void force_flush_all(void); 17extern void force_flush_all(void);
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
index 4cc9b6cf480a..7cfc3cedce84 100644
--- a/arch/um/include/asm/page.h
+++ b/arch/um/include/asm/page.h
@@ -19,7 +19,7 @@
19struct page; 19struct page;
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <sysdep/vm-flags.h> 22#include <asm/vm-flags.h>
23 23
24/* 24/*
25 * These are used to make use of C type-checking.. 25 * These are used to make use of C type-checking..
diff --git a/arch/um/include/asm/page_offset.h b/arch/um/include/asm/page_offset.h
deleted file mode 100644
index 1c168dfbf359..000000000000
--- a/arch/um/include/asm/page_offset.h
+++ /dev/null
@@ -1 +0,0 @@
1#define PAGE_OFFSET_RAW (uml_physmem)
diff --git a/arch/um/include/asm/pda.h b/arch/um/include/asm/pda.h
deleted file mode 100644
index ddcd774fc2a0..000000000000
--- a/arch/um/include/asm/pda.h
+++ /dev/null
@@ -1,21 +0,0 @@
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 */
11struct foo {
12 unsigned int __softirq_pending;
13 unsigned int __nmi_count;
14};
15
16extern struct foo me;
17
18#define read_pda(me) (&me)
19
20#endif
21
diff --git a/arch/um/include/asm/percpu.h b/arch/um/include/asm/percpu.h
deleted file mode 100644
index efe7508d8abd..000000000000
--- a/arch/um/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_PERCPU_H
2#define __UM_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __UM_PERCPU_H */
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
index 1a7d2757fe05..f605d3c4844c 100644
--- a/arch/um/include/asm/ptrace-generic.h
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -23,17 +23,10 @@ struct pt_regs {
23#define PT_REGS_IP(r) UPT_IP(&(r)->regs) 23#define PT_REGS_IP(r) UPT_IP(&(r)->regs)
24#define PT_REGS_SP(r) UPT_SP(&(r)->regs) 24#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
25 25
26#define PT_REG(r, reg) UPT_REG(&(r)->regs, reg)
27#define PT_REGS_SET(r, reg, val) UPT_SET(&(r)->regs, reg, val)
28
29#define PT_REGS_SET_SYSCALL_RETURN(r, res) \
30 UPT_SET_SYSCALL_RETURN(&(r)->regs, res)
31#define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs) 26#define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs)
32 27
33#define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs) 28#define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs)
34 29
35#define PT_REGS_SC(r) UPT_SC(&(r)->regs)
36
37#define instruction_pointer(regs) PT_REGS_IP(regs) 30#define instruction_pointer(regs) PT_REGS_IP(regs)
38 31
39struct task_struct; 32struct task_struct;
diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h
deleted file mode 100644
index 6b0231eefea8..000000000000
--- a/arch/um/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
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/system.h b/arch/um/include/asm/system.h
deleted file mode 100644
index 68a90ecd1450..000000000000
--- a/arch/um/include/asm/system.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef __UM_SYSTEM_GENERIC_H
2#define __UM_SYSTEM_GENERIC_H
3
4#include "sysdep/system.h"
5
6extern int get_signals(void);
7extern int set_signals(int enable);
8extern void block_signals(void);
9extern void unblock_signals(void);
10
11static inline unsigned long arch_local_save_flags(void)
12{
13 return get_signals();
14}
15
16static inline void arch_local_irq_restore(unsigned long flags)
17{
18 set_signals(flags);
19}
20
21static inline void arch_local_irq_enable(void)
22{
23 unblock_signals();
24}
25
26static inline void arch_local_irq_disable(void)
27{
28 block_signals();
29}
30
31static inline unsigned long arch_local_irq_save(void)
32{
33 unsigned long flags;
34 flags = arch_local_save_flags();
35 arch_local_irq_disable();
36 return flags;
37}
38
39static inline bool arch_irqs_disabled(void)
40{
41 return arch_local_save_flags() == 0;
42}
43
44extern void *_switch_to(void *prev, void *next, void *last);
45#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
46
47#endif
diff --git a/arch/um/include/asm/topology.h b/arch/um/include/asm/topology.h
deleted file mode 100644
index 0905e4f21d42..000000000000
--- a/arch/um/include/asm/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
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
index b9a895d6fa1d..3f22fbf7ca1d 100644
--- a/arch/um/include/asm/uaccess.h
+++ b/arch/um/include/asm/uaccess.h
@@ -6,15 +6,15 @@
6#ifndef __UM_UACCESS_H 6#ifndef __UM_UACCESS_H
7#define __UM_UACCESS_H 7#define __UM_UACCESS_H
8 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 */ 9/* thread_info has a mm_segment_t in it, so put the definition up here */
13typedef struct { 10typedef struct {
14 unsigned long seg; 11 unsigned long seg;
15} mm_segment_t; 12} mm_segment_t;
16 13
17#include "linux/thread_info.h" 14#include <linux/thread_info.h>
15#include <linux/errno.h>
16#include <asm/processor.h>
17#include <asm/elf.h>
18 18
19#define VERIFY_READ 0 19#define VERIFY_READ 0
20#define VERIFY_WRITE 1 20#define VERIFY_WRITE 1
@@ -38,7 +38,86 @@ typedef struct {
38 38
39#define segment_eq(a, b) ((a).seg == (b).seg) 39#define segment_eq(a, b) ((a).seg == (b).seg)
40 40
41#include "um_uaccess.h" 41#define __under_task_size(addr, size) \
42 (((unsigned long) (addr) < TASK_SIZE) && \
43 (((unsigned long) (addr) + (size)) < TASK_SIZE))
44
45#define __access_ok_vsyscall(type, addr, size) \
46 ((type == VERIFY_READ) && \
47 ((unsigned long) (addr) >= FIXADDR_USER_START) && \
48 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
49 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))
50
51#define __addr_range_nowrap(addr, size) \
52 ((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))
53
54#define access_ok(type, addr, size) \
55 (__addr_range_nowrap(addr, size) && \
56 (__under_task_size(addr, size) || \
57 __access_ok_vsyscall(type, addr, size) || \
58 segment_eq(get_fs(), KERNEL_DS)))
59
60extern int copy_from_user(void *to, const void __user *from, int n);
61extern int copy_to_user(void __user *to, const void *from, int n);
62
63/*
64 * strncpy_from_user: - Copy a NUL terminated string from userspace.
65 * @dst: Destination address, in kernel space. This buffer must be at
66 * least @count bytes long.
67 * @src: Source address, in user space.
68 * @count: Maximum number of bytes to copy, including the trailing NUL.
69 *
70 * Copies a NUL-terminated string from userspace to kernel space.
71 *
72 * On success, returns the length of the string (not including the trailing
73 * NUL).
74 *
75 * If access to userspace fails, returns -EFAULT (some data may have been
76 * copied).
77 *
78 * If @count is smaller than the length of the string, copies @count bytes
79 * and returns @count.
80 */
81
82extern int strncpy_from_user(char *dst, const char __user *src, int count);
83
84/*
85 * __clear_user: - Zero a block of memory in user space, with less checking.
86 * @to: Destination address, in user space.
87 * @n: Number of bytes to zero.
88 *
89 * Zero a block of memory in user space. Caller must check
90 * the specified block with access_ok() before calling this function.
91 *
92 * Returns number of bytes that could not be cleared.
93 * On success, this will be zero.
94 */
95extern int __clear_user(void __user *mem, int len);
96
97/*
98 * clear_user: - Zero a block of memory in user space.
99 * @to: Destination address, in user space.
100 * @n: Number of bytes to zero.
101 *
102 * Zero a block of memory in user space.
103 *
104 * Returns number of bytes that could not be cleared.
105 * On success, this will be zero.
106 */
107extern int clear_user(void __user *mem, int len);
108
109/*
110 * strlen_user: - Get the size of a string in user space.
111 * @str: The string to measure.
112 * @n: The maximum valid length
113 *
114 * Get the size of a NUL-terminated string in user space.
115 *
116 * Returns the size of the string INCLUDING the terminating NUL.
117 * On exception, returns 0.
118 * If the string is too long, returns a value greater than @n.
119 */
120extern int strnlen_user(const void __user *str, int len);
42 121
43#define __copy_from_user(to, from, n) copy_from_user(to, from, n) 122#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
44 123
diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h
deleted file mode 100644
index a19db3e17241..000000000000
--- a/arch/um/include/asm/xor.h
+++ /dev/null
@@ -1,6 +0,0 @@
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/shared/as-layout.h b/arch/um/include/shared/as-layout.h
index a92b678503cf..896e16602176 100644
--- a/arch/um/include/shared/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
@@ -6,7 +6,7 @@
6#ifndef __START_H__ 6#ifndef __START_H__
7#define __START_H__ 7#define __START_H__
8 8
9#include "kern_constants.h" 9#include <generated/asm-offsets.h>
10 10
11/* 11/*
12 * Stolen from linux/const.h, which can't be directly included since 12 * Stolen from linux/const.h, which can't be directly included since
diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shared/common-offsets.h
index 72009c7e3210..d7fe563aa7e7 100644
--- a/arch/um/include/shared/common-offsets.h
+++ b/arch/um/include/shared/common-offsets.h
@@ -2,7 +2,6 @@
2 2
3DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); 3DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
4 4
5OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
6OFFSET(HOST_TASK_PID, task_struct, pid); 5OFFSET(HOST_TASK_PID, task_struct, pid);
7 6
8DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); 7DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
diff --git a/arch/um/include/shared/initrd.h b/arch/um/include/shared/initrd.h
deleted file mode 100644
index 22673bcc273d..000000000000
--- a/arch/um/include/shared/initrd.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __INITRD_USER_H__
7#define __INITRD_USER_H__
8
9extern int load_initrd(char *filename, void *buf, int size);
10
11#endif
12
diff --git a/arch/um/include/shared/kern.h b/arch/um/include/shared/kern.h
index 4ce3fc650e57..6cd01240bbf0 100644
--- a/arch/um/include/shared/kern.h
+++ b/arch/um/include/shared/kern.h
@@ -13,28 +13,10 @@
13 * includes. 13 * includes.
14 */ 14 */
15 15
16extern int errno;
17
18extern int clone(int (*proc)(void *), void *sp, int flags, void *data);
19extern int sleep(int);
20extern int printf(const char *fmt, ...); 16extern int printf(const char *fmt, ...);
21extern char *strerror(int errnum);
22extern char *ptsname(int __fd);
23extern int munmap(void *, int);
24extern void *sbrk(int increment); 17extern void *sbrk(int increment);
25extern void *malloc(int size);
26extern void perror(char *err);
27extern int kill(int pid, int sig);
28extern int getuid(void);
29extern int getgid(void);
30extern int pause(void); 18extern int pause(void);
31extern int write(int, const void *, int);
32extern void exit(int); 19extern void exit(int);
33extern int close(int);
34extern int read(unsigned int, char *, int);
35extern int pipe(int *);
36extern int sched_yield(void);
37extern int ptrace(int op, int pid, long addr, long data);
38 20
39#endif 21#endif
40 22
diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
index 3c341222d252..0f1483852460 100644
--- a/arch/um/include/shared/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
@@ -21,7 +21,6 @@ extern unsigned long alloc_stack(int order, int atomic);
21extern void free_stack(unsigned long stack, int order); 21extern void free_stack(unsigned long stack, int order);
22 22
23extern int do_signal(void); 23extern int do_signal(void);
24extern void copy_sc(struct uml_pt_regs *regs, void *from);
25extern void interrupt_end(void); 24extern void interrupt_end(void);
26extern void relay_signal(int sig, struct uml_pt_regs *regs); 25extern void relay_signal(int sig, struct uml_pt_regs *regs);
27 26
diff --git a/arch/um/include/shared/ldt.h b/arch/um/include/shared/ldt.h
deleted file mode 100644
index a7f999a58774..000000000000
--- a/arch/um/include/shared/ldt.h
+++ /dev/null
@@ -1,37 +0,0 @@
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
14extern 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
23struct ldt_entry {
24 __u32 a;
25 __u32 b;
26};
27
28typedef 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/shared/mem_kern.h b/arch/um/include/shared/mem_kern.h
deleted file mode 100644
index 69be0fd0ce4b..000000000000
--- a/arch/um/include/shared/mem_kern.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MEM_KERN_H__
7#define __MEM_KERN_H__
8
9#include "linux/list.h"
10#include "linux/types.h"
11
12struct remapper {
13 struct list_head list;
14 int (*proc)(int, unsigned long, int, __u64);
15};
16
17extern void register_remapper(struct remapper *info);
18
19#endif
20
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 83c7c2ecd614..89b686c1a3ea 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -10,7 +10,6 @@
10#include "irq_user.h" 10#include "irq_user.h"
11#include "longjmp.h" 11#include "longjmp.h"
12#include "mm_id.h" 12#include "mm_id.h"
13#include "sysdep/tls.h"
14 13
15#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) 14#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
16 15
@@ -203,12 +202,6 @@ extern int os_drop_memory(void *addr, int length);
203extern int can_drop_memory(void); 202extern int can_drop_memory(void);
204extern void os_flush_stdout(void); 203extern void os_flush_stdout(void);
205 204
206/* uaccess.c */
207extern unsigned long __do_user_copy(void *to, const void *from, int n,
208 void **fault_addr, jmp_buf **fault_catcher,
209 void (*op)(void *to, const void *from,
210 int n), int *faulted_out);
211
212/* execvp.c */ 205/* execvp.c */
213extern int execvp_noalloc(char *buf, const char *file, char *const argv[]); 206extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
214/* helper.c */ 207/* helper.c */
@@ -218,10 +211,6 @@ extern int run_helper_thread(int (*proc)(void *), void *arg,
218extern int helper_wait(int pid); 211extern int helper_wait(int pid);
219 212
220 213
221/* tls.c */
222extern int os_set_thread_area(user_desc_t *info, int pid);
223extern int os_get_thread_area(user_desc_t *info, int pid);
224
225/* umid.c */ 214/* umid.c */
226extern int umid_file_name(char *name, char *buf, int len); 215extern int umid_file_name(char *name, char *buf, int len);
227extern int set_umid(char *name); 216extern int set_umid(char *name);
@@ -231,7 +220,7 @@ extern char *get_umid(void);
231extern void timer_init(void); 220extern void timer_init(void);
232extern void set_sigstack(void *sig_stack, int size); 221extern void set_sigstack(void *sig_stack, int size);
233extern void remove_sigstack(void); 222extern void remove_sigstack(void);
234extern void set_handler(int sig, void (*handler)(int), int flags, ...); 223extern void set_handler(int sig);
235extern int change_sig(int signal, int on); 224extern int change_sig(int signal, int on);
236extern void block_signals(void); 225extern void block_signals(void);
237extern void unblock_signals(void); 226extern void unblock_signals(void);
diff --git a/arch/um/include/shared/process.h b/arch/um/include/shared/process.h
deleted file mode 100644
index bb873a51262e..000000000000
--- a/arch/um/include/shared/process.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __PROCESS_H__
7#define __PROCESS_H__
8
9#include <signal.h>
10
11/* Copied from linux/compiler-gcc.h since we can't include it directly */
12#define barrier() __asm__ __volatile__("": : :"memory")
13
14extern void sig_handler(int sig, struct sigcontext *sc);
15extern void alarm_handler(int sig, struct sigcontext *sc);
16
17#endif
diff --git a/arch/um/include/shared/ptrace_user.h b/arch/um/include/shared/ptrace_user.h
index 7fd8539bc19a..56b2f284b108 100644
--- a/arch/um/include/shared/ptrace_user.h
+++ b/arch/um/include/shared/ptrace_user.h
@@ -6,7 +6,8 @@
6#ifndef __PTRACE_USER_H__ 6#ifndef __PTRACE_USER_H__
7#define __PTRACE_USER_H__ 7#define __PTRACE_USER_H__
8 8
9#include "sysdep/ptrace_user.h" 9#include <sys/ptrace.h>
10#include <sysdep/ptrace_user.h>
10 11
11extern int ptrace_getregs(long pid, unsigned long *regs_out); 12extern int ptrace_getregs(long pid, unsigned long *regs_out);
12extern int ptrace_setregs(long pid, unsigned long *regs_in); 13extern int ptrace_setregs(long pid, unsigned long *regs_in);
diff --git a/arch/um/include/shared/skas_ptregs.h b/arch/um/include/shared/skas_ptregs.h
deleted file mode 100644
index 73db19e9c077..000000000000
--- a/arch/um/include/shared/skas_ptregs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __SKAS_PT_REGS_
2#define __SKAS_PT_REGS_
3
4#include <user_constants.h>
5
6#endif
diff --git a/arch/um/include/shared/syscall.h b/arch/um/include/shared/syscall.h
deleted file mode 100644
index dda1df901a08..000000000000
--- a/arch/um/include/shared/syscall.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSCALL_USER_H
7#define __SYSCALL_USER_H
8
9extern int record_syscall_start(int syscall);
10extern void record_syscall_end(int index, long result);
11
12#endif
diff --git a/arch/um/include/shared/task.h b/arch/um/include/shared/task.h
deleted file mode 100644
index 3fe726b3cf48..000000000000
--- a/arch/um/include/shared/task.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __TASK_H
2#define __TASK_H
3
4#include <kern_constants.h>
5
6#define TASK_REGS(task) ((struct uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS]))
7#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
8
9#endif
diff --git a/arch/um/include/shared/tlb.h b/arch/um/include/shared/tlb.h
deleted file mode 100644
index ecd2265b301b..000000000000
--- a/arch/um/include/shared/tlb.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TLB_H__
7#define __TLB_H__
8
9#include "um_mmu.h"
10
11extern void force_flush_all(void);
12extern int flush_tlb_kernel_range_common(unsigned long start,
13 unsigned long end);
14
15#endif
diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um_malloc.h
index c554d706d106..6395fef6b69b 100644
--- a/arch/um/include/shared/um_malloc.h
+++ b/arch/um/include/shared/um_malloc.h
@@ -6,7 +6,7 @@
6#ifndef __UM_MALLOC_H__ 6#ifndef __UM_MALLOC_H__
7#define __UM_MALLOC_H__ 7#define __UM_MALLOC_H__
8 8
9#include "kern_constants.h" 9#include <generated/asm-offsets.h>
10 10
11extern void *uml_kmalloc(int size, int flags); 11extern void *uml_kmalloc(int size, int flags);
12extern void kfree(const void *ptr); 12extern void kfree(const void *ptr);
diff --git a/arch/um/include/shared/um_mmu.h b/arch/um/include/shared/um_mmu.h
deleted file mode 100644
index b1a7e47d1027..000000000000
--- a/arch/um/include/shared/um_mmu.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __ARCH_UM_MMU_H
7#define __ARCH_UM_MMU_H
8
9#include "mm_id.h"
10#include "ldt.h"
11
12typedef struct mm_context {
13 struct mm_id id;
14 struct uml_ldt ldt;
15 struct page **stub_pages;
16} mm_context_t;
17
18extern void __switch_mm(struct mm_id * mm_idp);
19
20/* Avoid tangled inclusion with asm/ldt.h */
21extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
22extern void free_ldt(struct mm_context *mm);
23
24#endif
diff --git a/arch/um/include/shared/um_uaccess.h b/arch/um/include/shared/um_uaccess.h
deleted file mode 100644
index 45c04999d670..000000000000
--- a/arch/um/include/shared/um_uaccess.h
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __ARCH_UM_UACCESS_H
7#define __ARCH_UM_UACCESS_H
8
9#include <asm/elf.h>
10#include <asm/fixmap.h>
11#include "sysdep/archsetjmp.h"
12
13#define __under_task_size(addr, size) \
14 (((unsigned long) (addr) < TASK_SIZE) && \
15 (((unsigned long) (addr) + (size)) < TASK_SIZE))
16
17#define __access_ok_vsyscall(type, addr, size) \
18 ((type == VERIFY_READ) && \
19 ((unsigned long) (addr) >= FIXADDR_USER_START) && \
20 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
21 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))
22
23#define __addr_range_nowrap(addr, size) \
24 ((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))
25
26#define access_ok(type, addr, size) \
27 (__addr_range_nowrap(addr, size) && \
28 (__under_task_size(addr, size) || \
29 __access_ok_vsyscall(type, addr, size) || \
30 segment_eq(get_fs(), KERNEL_DS)))
31
32extern int copy_from_user(void *to, const void __user *from, int n);
33extern int copy_to_user(void __user *to, const void *from, int n);
34
35extern int __do_copy_to_user(void *to, const void *from, int n,
36 void **fault_addr, jmp_buf **fault_catcher);
37
38/*
39 * strncpy_from_user: - Copy a NUL terminated string from userspace.
40 * @dst: Destination address, in kernel space. This buffer must be at
41 * least @count bytes long.
42 * @src: Source address, in user space.
43 * @count: Maximum number of bytes to copy, including the trailing NUL.
44 *
45 * Copies a NUL-terminated string from userspace to kernel space.
46 *
47 * On success, returns the length of the string (not including the trailing
48 * NUL).
49 *
50 * If access to userspace fails, returns -EFAULT (some data may have been
51 * copied).
52 *
53 * If @count is smaller than the length of the string, copies @count bytes
54 * and returns @count.
55 */
56
57extern int strncpy_from_user(char *dst, const char __user *src, int count);
58
59/*
60 * __clear_user: - Zero a block of memory in user space, with less checking.
61 * @to: Destination address, in user space.
62 * @n: Number of bytes to zero.
63 *
64 * Zero a block of memory in user space. Caller must check
65 * the specified block with access_ok() before calling this function.
66 *
67 * Returns number of bytes that could not be cleared.
68 * On success, this will be zero.
69 */
70extern int __clear_user(void __user *mem, int len);
71
72/*
73 * clear_user: - Zero a block of memory in user space.
74 * @to: Destination address, in user space.
75 * @n: Number of bytes to zero.
76 *
77 * Zero a block of memory in user space.
78 *
79 * Returns number of bytes that could not be cleared.
80 * On success, this will be zero.
81 */
82extern int clear_user(void __user *mem, int len);
83
84/*
85 * strlen_user: - Get the size of a string in user space.
86 * @str: The string to measure.
87 * @n: The maximum valid length
88 *
89 * Get the size of a NUL-terminated string in user space.
90 *
91 * Returns the size of the string INCLUDING the terminating NUL.
92 * On exception, returns 0.
93 * If the string is too long, returns a value greater than @n.
94 */
95extern int strnlen_user(const void __user *str, int len);
96
97#endif
diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
index 293f7c794faa..4fa82c055aab 100644
--- a/arch/um/include/shared/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 "kern_constants.h" 9#include <generated/asm-offsets.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,
@@ -36,10 +36,11 @@ static inline int printk(const char *fmt, ...)
36} 36}
37#endif 37#endif
38 38
39extern void schedule(void);
40extern int in_aton(char *str); 39extern int in_aton(char *str);
41extern int open_gdb_chan(void);
42extern size_t strlcpy(char *, const char *, size_t); 40extern size_t strlcpy(char *, const char *, size_t);
43extern size_t strlcat(char *, const char *, size_t); 41extern size_t strlcat(char *, const char *, size_t);
44 42
43/* Copied from linux/compiler-gcc.h since we can't include it directly */
44#define barrier() __asm__ __volatile__("": : :"memory")
45
45#endif 46#endif
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index c4491c15afb2..bc494741b1f3 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -11,7 +11,7 @@ clean-files :=
11 11
12obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ 12obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \
13 physmem.o process.o ptrace.o reboot.o sigio.o \ 13 physmem.o process.o ptrace.o reboot.o sigio.o \
14 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o uaccess.o \ 14 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
15 um_arch.o umid.o skas/ 15 um_arch.o umid.o skas/
16 16
17obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 17obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 939a4a67f0fd..6cade9366364 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -3,14 +3,15 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/stddef.h" 6#include <linux/stddef.h>
7#include "linux/fs.h" 7#include <linux/module.h>
8#include "linux/ptrace.h" 8#include <linux/fs.h>
9#include "linux/sched.h" 9#include <linux/ptrace.h>
10#include "linux/slab.h" 10#include <linux/sched.h>
11#include "asm/current.h" 11#include <linux/slab.h>
12#include "asm/processor.h" 12#include <asm/current.h>
13#include "asm/uaccess.h" 13#include <asm/processor.h>
14#include <asm/uaccess.h>
14#include "as-layout.h" 15#include "as-layout.h"
15#include "mem_user.h" 16#include "mem_user.h"
16#include "skas.h" 17#include "skas.h"
@@ -41,6 +42,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
41 PT_REGS_IP(regs) = eip; 42 PT_REGS_IP(regs) = eip;
42 PT_REGS_SP(regs) = esp; 43 PT_REGS_SP(regs) = esp;
43} 44}
45EXPORT_SYMBOL(start_thread);
44 46
45static long execve1(const char *file, 47static long execve1(const char *file,
46 const char __user *const __user *argv, 48 const char __user *const __user *argv,
diff --git a/arch/um/kernel/gmon_syms.c b/arch/um/kernel/gmon_syms.c
index 72eccd2a4113..e9bcf247bcee 100644
--- a/arch/um/kernel/gmon_syms.c
+++ b/arch/um/kernel/gmon_syms.c
@@ -7,18 +7,3 @@
7 7
8extern void __bb_init_func(void *) __attribute__((weak)); 8extern void __bb_init_func(void *) __attribute__((weak));
9EXPORT_SYMBOL(__bb_init_func); 9EXPORT_SYMBOL(__bb_init_func);
10
11/*
12 * This is defined (and referred to in profiling stub code) only by some GCC
13 * versions in libgcov.
14 *
15 * Since SuSE backported the fix, we cannot handle it depending on GCC version.
16 * So, unconditionally export it. But also give it a weak declaration, which
17 * will be overridden by any other one.
18 */
19
20extern void __gcov_init(void *) __attribute__((weak));
21EXPORT_SYMBOL(__gcov_init);
22
23extern void __gcov_merge_add(void *) __attribute__((weak));
24EXPORT_SYMBOL(__gcov_merge_add);
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c
index d386c75c88eb..10cc18f729fd 100644
--- a/arch/um/kernel/initrd.c
+++ b/arch/um/kernel/initrd.c
@@ -7,12 +7,12 @@
7#include "linux/bootmem.h" 7#include "linux/bootmem.h"
8#include "linux/initrd.h" 8#include "linux/initrd.h"
9#include "asm/types.h" 9#include "asm/types.h"
10#include "initrd.h"
11#include "init.h" 10#include "init.h"
12#include "os.h" 11#include "os.h"
13 12
14/* Changed by uml_initrd_setup, which is a setup */ 13/* Changed by uml_initrd_setup, which is a setup */
15static char *initrd __initdata = NULL; 14static char *initrd __initdata = NULL;
15static int load_initrd(char *filename, void *buf, int size);
16 16
17static int __init read_initrd(void) 17static int __init read_initrd(void)
18{ 18{
@@ -62,7 +62,7 @@ __uml_setup("initrd=", uml_initrd_setup,
62" name of the file containing the image.\n\n" 62" name of the file containing the image.\n\n"
63); 63);
64 64
65int load_initrd(char *filename, void *buf, int size) 65static int load_initrd(char *filename, void *buf, int size)
66{ 66{
67 int fd, n; 67 int fd, n;
68 68
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 9e485c770308..71b8c947e5ef 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -258,6 +258,7 @@ void deactivate_fd(int fd, int irqnum)
258 258
259 ignore_sigio_fd(fd); 259 ignore_sigio_fd(fd);
260} 260}
261EXPORT_SYMBOL(deactivate_fd);
261 262
262/* 263/*
263 * Called just before shutdown in order to provide a clean exec 264 * Called just before shutdown in order to provide a clean exec
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 0ae0dfcfbffb..e17bea0b22e1 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -3,33 +3,11 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/module.h" 6#include <linux/module.h>
7#include "linux/syscalls.h"
8#include "asm/tlbflush.h"
9#include "asm/uaccess.h"
10#include "as-layout.h"
11#include "kern_util.h"
12#include "mem_user.h"
13#include "os.h" 7#include "os.h"
14 8
15EXPORT_SYMBOL(uml_physmem);
16EXPORT_SYMBOL(set_signals); 9EXPORT_SYMBOL(set_signals);
17EXPORT_SYMBOL(get_signals); 10EXPORT_SYMBOL(get_signals);
18EXPORT_SYMBOL(kernel_thread);
19EXPORT_SYMBOL(sys_waitpid);
20EXPORT_SYMBOL(flush_tlb_range);
21
22EXPORT_SYMBOL(high_physmem);
23EXPORT_SYMBOL(empty_zero_page);
24EXPORT_SYMBOL(handle_page_fault);
25EXPORT_SYMBOL(find_iomem);
26
27EXPORT_SYMBOL(strnlen_user);
28EXPORT_SYMBOL(strncpy_from_user);
29EXPORT_SYMBOL(copy_to_user);
30EXPORT_SYMBOL(copy_from_user);
31EXPORT_SYMBOL(clear_user);
32EXPORT_SYMBOL(uml_strdup);
33 11
34EXPORT_SYMBOL(os_stat_fd); 12EXPORT_SYMBOL(os_stat_fd);
35EXPORT_SYMBOL(os_stat_file); 13EXPORT_SYMBOL(os_stat_file);
@@ -57,24 +35,10 @@ EXPORT_SYMBOL(os_connect_socket);
57EXPORT_SYMBOL(os_accept_connection); 35EXPORT_SYMBOL(os_accept_connection);
58EXPORT_SYMBOL(os_rcv_fd); 36EXPORT_SYMBOL(os_rcv_fd);
59EXPORT_SYMBOL(run_helper); 37EXPORT_SYMBOL(run_helper);
60EXPORT_SYMBOL(start_thread);
61EXPORT_SYMBOL(os_major); 38EXPORT_SYMBOL(os_major);
62EXPORT_SYMBOL(os_minor); 39EXPORT_SYMBOL(os_minor);
63EXPORT_SYMBOL(os_makedev); 40EXPORT_SYMBOL(os_makedev);
64 41
65EXPORT_SYMBOL(add_sigio_fd); 42EXPORT_SYMBOL(add_sigio_fd);
66EXPORT_SYMBOL(ignore_sigio_fd); 43EXPORT_SYMBOL(ignore_sigio_fd);
67EXPORT_SYMBOL(deactivate_fd);
68EXPORT_SYMBOL(sigio_broken); 44EXPORT_SYMBOL(sigio_broken);
69
70#ifdef CONFIG_SMP
71
72/* required for SMP */
73
74extern void __write_lock_failed(rwlock_t *rw);
75EXPORT_SYMBOL(__write_lock_failed);
76
77extern void __read_lock_failed(rwlock_t *rw);
78EXPORT_SYMBOL(__read_lock_failed);
79
80#endif
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8137ccc9635b..ebb86b218445 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/module.h>
7#include <linux/bootmem.h> 8#include <linux/bootmem.h>
8#include <linux/highmem.h> 9#include <linux/highmem.h>
9#include <linux/mm.h> 10#include <linux/mm.h>
@@ -20,6 +21,7 @@
20 21
21/* allocated in paging_init, zeroed in mem_init, and unchanged thereafter */ 22/* allocated in paging_init, zeroed in mem_init, and unchanged thereafter */
22unsigned long *empty_zero_page = NULL; 23unsigned long *empty_zero_page = NULL;
24EXPORT_SYMBOL(empty_zero_page);
23/* allocated in paging_init and unchanged thereafter */ 25/* allocated in paging_init and unchanged thereafter */
24static unsigned long *empty_bad_page = NULL; 26static unsigned long *empty_bad_page = NULL;
25 27
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index a1a9090254c2..f116db15d402 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -3,20 +3,22 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/bootmem.h" 6#include <linux/module.h>
7#include "linux/mm.h" 7#include <linux/bootmem.h>
8#include "linux/pfn.h" 8#include <linux/mm.h>
9#include "asm/page.h" 9#include <linux/pfn.h>
10#include "as-layout.h" 10#include <asm/page.h>
11#include "init.h" 11#include <as-layout.h>
12#include "kern.h" 12#include <init.h>
13#include "mem_user.h" 13#include <kern.h>
14#include "os.h" 14#include <mem_user.h>
15#include <os.h>
15 16
16static int physmem_fd = -1; 17static int physmem_fd = -1;
17 18
18/* Changed during early boot */ 19/* Changed during early boot */
19unsigned long high_physmem; 20unsigned long high_physmem;
21EXPORT_SYMBOL(high_physmem);
20 22
21extern unsigned long long physmem_size; 23extern unsigned long long physmem_size;
22 24
@@ -184,6 +186,7 @@ unsigned long find_iomem(char *driver, unsigned long *len_out)
184 186
185 return 0; 187 return 0;
186} 188}
189EXPORT_SYMBOL(find_iomem);
187 190
188static int setup_iomem(void) 191static int setup_iomem(void)
189{ 192{
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 21c1ae7c3d75..c5338351aecd 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -20,12 +20,12 @@
20#include <linux/threads.h> 20#include <linux/threads.h>
21#include <asm/current.h> 21#include <asm/current.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/mmu_context.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include "as-layout.h" 25#include "as-layout.h"
25#include "kern_util.h" 26#include "kern_util.h"
26#include "os.h" 27#include "os.h"
27#include "skas.h" 28#include "skas.h"
28#include "tlb.h"
29 29
30/* 30/*
31 * This is a per-cpu array. A processor only modifies its entry and it only 31 * This is a per-cpu array. A processor only modifies its entry and it only
@@ -78,6 +78,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
78 &current->thread.regs, 0, NULL, NULL); 78 &current->thread.regs, 0, NULL, NULL);
79 return pid; 79 return pid;
80} 80}
81EXPORT_SYMBOL(kernel_thread);
81 82
82static inline void set_current(struct task_struct *task) 83static inline void set_current(struct task_struct *task)
83{ 84{
@@ -286,6 +287,7 @@ char *uml_strdup(const char *string)
286{ 287{
287 return kstrdup(string, GFP_KERNEL); 288 return kstrdup(string, GFP_KERNEL);
288} 289}
290EXPORT_SYMBOL(uml_strdup);
289 291
290int copy_to_user_proc(void __user *to, void *from, int size) 292int copy_to_user_proc(void __user *to, void *from, int size)
291{ 293{
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index b5c094c4ade4..e8b889d3bce7 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -11,7 +11,6 @@
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 <sysdep/sigcontext.h>
15 14
16EXPORT_SYMBOL(block_signals); 15EXPORT_SYMBOL(block_signals);
17EXPORT_SYMBOL(unblock_signals); 16EXPORT_SYMBOL(unblock_signals);
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index 2c8583c1a344..e1fd066a3525 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -8,7 +8,6 @@
8#include <asm/unistd.h> 8#include <asm/unistd.h>
9#include <sys/time.h> 9#include <sys/time.h>
10#include "as-layout.h" 10#include "as-layout.h"
11#include "kern_constants.h"
12#include "ptrace_user.h" 11#include "ptrace_user.h"
13#include "stub-data.h" 12#include "stub-data.h"
14#include "sysdep/stub.h" 13#include "sysdep/stub.h"
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 696634214dc6..9fefd924fb49 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -6,6 +6,7 @@
6#include <linux/err.h> 6#include <linux/err.h>
7#include <linux/highmem.h> 7#include <linux/highmem.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/module.h>
9#include <linux/sched.h> 10#include <linux/sched.h>
10#include <asm/current.h> 11#include <asm/current.h>
11#include <asm/page.h> 12#include <asm/page.h>
@@ -149,6 +150,7 @@ int copy_from_user(void *to, const void __user *from, int n)
149 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to): 150 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
150 n; 151 n;
151} 152}
153EXPORT_SYMBOL(copy_from_user);
152 154
153static int copy_chunk_to_user(unsigned long to, int len, void *arg) 155static int copy_chunk_to_user(unsigned long to, int len, void *arg)
154{ 156{
@@ -170,6 +172,7 @@ int copy_to_user(void __user *to, const void *from, int n)
170 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) : 172 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
171 n; 173 n;
172} 174}
175EXPORT_SYMBOL(copy_to_user);
173 176
174static int strncpy_chunk_from_user(unsigned long from, int len, void *arg) 177static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
175{ 178{
@@ -204,6 +207,7 @@ int strncpy_from_user(char *dst, const char __user *src, int count)
204 return -EFAULT; 207 return -EFAULT;
205 return strnlen(dst, count); 208 return strnlen(dst, count);
206} 209}
210EXPORT_SYMBOL(strncpy_from_user);
207 211
208static int clear_chunk(unsigned long addr, int len, void *unused) 212static int clear_chunk(unsigned long addr, int len, void *unused)
209{ 213{
@@ -226,6 +230,7 @@ int clear_user(void __user *mem, int len)
226 return access_ok(VERIFY_WRITE, mem, len) ? 230 return access_ok(VERIFY_WRITE, mem, len) ?
227 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len; 231 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len;
228} 232}
233EXPORT_SYMBOL(clear_user);
229 234
230static int strnlen_chunk(unsigned long str, int len, void *arg) 235static int strnlen_chunk(unsigned long str, int len, void *arg)
231{ 236{
@@ -251,3 +256,4 @@ int strnlen_user(const void __user *str, int len)
251 return count + 1; 256 return count + 1;
252 return -EFAULT; 257 return -EFAULT;
253} 258}
259EXPORT_SYMBOL(strnlen_user);
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index d175d0566af0..7f3d4d86431a 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/module.h>
7#include <linux/sched.h> 8#include <linux/sched.h>
8#include <asm/pgtable.h> 9#include <asm/pgtable.h>
9#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
@@ -11,7 +12,6 @@
11#include "mem_user.h" 12#include "mem_user.h"
12#include "os.h" 13#include "os.h"
13#include "skas.h" 14#include "skas.h"
14#include "tlb.h"
15 15
16struct host_vm_change { 16struct host_vm_change {
17 struct host_vm_op { 17 struct host_vm_op {
@@ -287,7 +287,7 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
287 } 287 }
288} 288}
289 289
290int flush_tlb_kernel_range_common(unsigned long start, unsigned long end) 290static int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
291{ 291{
292 struct mm_struct *mm; 292 struct mm_struct *mm;
293 pgd_t *pgd; 293 pgd_t *pgd;
@@ -499,6 +499,7 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
499 flush_tlb_kernel_range_common(start, end); 499 flush_tlb_kernel_range_common(start, end);
500 else fix_range(vma->vm_mm, start, end, 0); 500 else fix_range(vma->vm_mm, start, end, 0);
501} 501}
502EXPORT_SYMBOL(flush_tlb_range);
502 503
503void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, 504void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
504 unsigned long end) 505 unsigned long end)
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 8c7b8823d1f0..dafc94715950 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -6,6 +6,7 @@
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/hardirq.h> 8#include <linux/hardirq.h>
9#include <linux/module.h>
9#include <asm/current.h> 10#include <asm/current.h>
10#include <asm/pgtable.h> 11#include <asm/pgtable.h>
11#include <asm/tlbflush.h> 12#include <asm/tlbflush.h>
@@ -14,7 +15,6 @@
14#include "kern_util.h" 15#include "kern_util.h"
15#include "os.h" 16#include "os.h"
16#include "skas.h" 17#include "skas.h"
17#include "sysdep/sigcontext.h"
18 18
19/* 19/*
20 * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by 20 * Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by
@@ -112,6 +112,7 @@ out_of_memory:
112 pagefault_out_of_memory(); 112 pagefault_out_of_memory();
113 return 0; 113 return 0;
114} 114}
115EXPORT_SYMBOL(handle_page_fault);
115 116
116static void show_segv_info(struct uml_pt_regs *regs) 117static void show_segv_info(struct uml_pt_regs *regs)
117{ 118{
diff --git a/arch/um/kernel/uaccess.c b/arch/um/kernel/uaccess.c
deleted file mode 100644
index dd33f040c526..000000000000
--- a/arch/um/kernel/uaccess.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7/*
8 * These are here rather than tt/uaccess.c because skas mode needs them in
9 * order to do SIGBUS recovery when a tmpfs mount runs out of room.
10 */
11
12#include <linux/string.h>
13#include "os.h"
14
15static void __do_copy(void *to, const void *from, int n)
16{
17 memcpy(to, from, n);
18}
19
20
21int __do_copy_to_user(void *to, const void *from, int n,
22 void **fault_addr, jmp_buf **fault_catcher)
23{
24 unsigned long fault;
25 int faulted;
26
27 fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
28 __do_copy, &faulted);
29 if (!faulted)
30 return 0;
31 else
32 return n - (fault - (unsigned long) to);
33}
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 8d84250324b3..ba00eae45aad 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -102,6 +102,8 @@ const struct seq_operations cpuinfo_op = {
102 102
103/* Set in linux_main */ 103/* Set in linux_main */
104unsigned long uml_physmem; 104unsigned long uml_physmem;
105EXPORT_SYMBOL(uml_physmem);
106
105unsigned long uml_reserved; /* Also modified in mem_init */ 107unsigned long uml_reserved; /* Also modified in mem_init */
106unsigned long start_vm; 108unsigned long start_vm;
107unsigned long end_vm; 109unsigned long end_vm;
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index b33f4dfe7ae5..dd764101e488 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -4,14 +4,14 @@
4# 4#
5 5
6obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.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 \
8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ 8 umid.o user_syms.o util.o drivers/ skas/
9 9
10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o 10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o
11 11
12USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ 12USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
13 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ 13 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
14 tty.o tls.o uaccess.o umid.o util.o 14 tty.o umid.o util.o
15 15
16CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 16CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
17 17
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 57e3d46c989c..c5d039e1ff3b 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -11,10 +11,8 @@
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include "aio.h" 12#include "aio.h"
13#include "init.h" 13#include "init.h"
14#include "kern_constants.h"
15#include "kern_util.h" 14#include "kern_util.h"
16#include "os.h" 15#include "os.h"
17#include "user.h"
18 16
19struct aio_thread_req { 17struct aio_thread_req {
20 enum aio_type type; 18 enum aio_type type;
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index cc72cb2c1af6..db3d6481375a 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -13,11 +13,9 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include "etap.h" 15#include "etap.h"
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "net_user.h" 17#include "net_user.h"
19#include "um_malloc.h" 18#include "um_malloc.h"
20#include "user.h"
21 19
22#define MAX_PACKET ETH_MAX_PACKET 20#define MAX_PACKET ETH_MAX_PACKET
23 21
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 2448be03fd7a..a2aacffdd907 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -13,11 +13,9 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/wait.h> 14#include <sys/wait.h>
15#include <sys/uio.h> 15#include <sys/uio.h>
16#include "kern_constants.h"
17#include "kern_util.h" 16#include "kern_util.h"
18#include "os.h" 17#include "os.h"
19#include "tuntap.h" 18#include "tuntap.h"
20#include "user.h"
21 19
22static int tuntap_user_init(void *data, void *dev) 20static int tuntap_user_init(void *data, void *dev)
23{ 21{
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index 953323799381..d895271ad6f7 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -12,7 +12,6 @@
12#include "init.h" 12#include "init.h"
13#include "elf_user.h" 13#include "elf_user.h"
14#include "mem_user.h" 14#include "mem_user.h"
15#include <kern_constants.h>
16 15
17typedef Elf32_auxv_t elf_auxv_t; 16typedef Elf32_auxv_t elf_auxv_t;
18 17
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 140e587bc0ad..b049a63bb74b 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -13,9 +13,7 @@
13#include <sys/socket.h> 13#include <sys/socket.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include <sys/un.h> 15#include <sys/un.h>
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20static void copy_stat(struct uml_stat *dst, const struct stat64 *src) 18static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
21{ 19{
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index feff22d64672..cf26c4a9a43a 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -10,11 +10,9 @@
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <sys/socket.h> 11#include <sys/socket.h>
12#include <sys/wait.h> 12#include <sys/wait.h>
13#include "kern_constants.h"
14#include "kern_util.h" 13#include "kern_util.h"
15#include "os.h" 14#include "os.h"
16#include "um_malloc.h" 15#include "um_malloc.h"
17#include "user.h"
18 16
19struct helper_data { 17struct helper_data {
20 void (*pre_exec)(void*); 18 void (*pre_exec)(void*);
diff --git a/arch/um/os-Linux/internal.h b/arch/um/os-Linux/internal.h
new file mode 100644
index 000000000000..2c3c3ecd8c01
--- /dev/null
+++ b/arch/um/os-Linux/internal.h
@@ -0,0 +1 @@
void alarm_handler(int, mcontext_t *);
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index 0348b975e81c..9a49908b576c 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -9,11 +9,8 @@
9#include <signal.h> 9#include <signal.h>
10#include <string.h> 10#include <string.h>
11#include "irq_user.h" 11#include "irq_user.h"
12#include "kern_constants.h"
13#include "os.h" 12#include "os.h"
14#include "process.h"
15#include "um_malloc.h" 13#include "um_malloc.h"
16#include "user.h"
17 14
18/* 15/*
19 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd 16 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 8471b817d94f..7a86dd516eb1 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -12,7 +12,6 @@
12#include <sys/resource.h> 12#include <sys/resource.h>
13#include "as-layout.h" 13#include "as-layout.h"
14#include "init.h" 14#include "init.h"
15#include "kern_constants.h"
16#include "kern_util.h" 15#include "kern_util.h"
17#include "os.h" 16#include "os.h"
18#include "um_malloc.h" 17#include "um_malloc.h"
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 62878cf1d33f..8e421e1d6d36 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -14,9 +14,7 @@
14#include <sys/mman.h> 14#include <sys/mman.h>
15#include <sys/param.h> 15#include <sys/param.h>
16#include "init.h" 16#include "init.h"
17#include "kern_constants.h"
18#include "os.h" 17#include "os.h"
19#include "user.h"
20 18
21/* Modified by which_tmpdir, which is called during early boot */ 19/* Modified by which_tmpdir, which is called during early boot */
22static char *default_tmpdir = "/tmp"; 20static char *default_tmpdir = "/tmp";
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 0c45dc8efb05..307f173e7f82 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -13,12 +13,9 @@
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include <asm/unistd.h> 14#include <asm/unistd.h>
15#include "init.h" 15#include "init.h"
16#include "kern_constants.h"
17#include "longjmp.h" 16#include "longjmp.h"
18#include "os.h" 17#include "os.h"
19#include "process.h"
20#include "skas_ptrace.h" 18#include "skas_ptrace.h"
21#include "user.h"
22 19
23#define ARBITRARY_ADDR -1 20#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 21#define FAILURE_PID -1
@@ -237,21 +234,13 @@ out:
237 234
238void init_new_thread_signals(void) 235void init_new_thread_signals(void)
239{ 236{
240 set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK, 237 set_handler(SIGSEGV);
241 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); 238 set_handler(SIGTRAP);
242 set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK, 239 set_handler(SIGFPE);
243 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1); 240 set_handler(SIGILL);
244 set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK, 241 set_handler(SIGBUS);
245 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
246 set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK,
247 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
248 set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
249 SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
250 signal(SIGHUP, SIG_IGN); 242 signal(SIGHUP, SIG_IGN);
251 243 set_handler(SIGIO);
252 set_handler(SIGIO, (__sighandler_t) sig_handler,
253 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM,
254 SIGVTALRM, -1);
255 signal(SIGWINCH, SIG_IGN); 244 signal(SIGWINCH, SIG_IGN);
256 signal(SIGTERM, SIG_DFL); 245 signal(SIGTERM, SIG_DFL);
257} 246}
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 63d299df152b..3c161218c671 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -11,14 +11,11 @@
11#include <sched.h> 11#include <sched.h>
12#include <signal.h> 12#include <signal.h>
13#include <string.h> 13#include <string.h>
14#include "kern_constants.h"
15#include "kern_util.h" 14#include "kern_util.h"
16#include "init.h" 15#include "init.h"
17#include "os.h" 16#include "os.h"
18#include "process.h"
19#include "sigio.h" 17#include "sigio.h"
20#include "um_malloc.h" 18#include "um_malloc.h"
21#include "user.h"
22 19
23/* 20/*
24 * Protected by sigio_lock(), also used by sigio_cleanup, which is an 21 * Protected by sigio_lock(), also used by sigio_cleanup, which is an
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 6ae180703a63..2d22f1fcd8e2 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -12,13 +12,7 @@
12#include "as-layout.h" 12#include "as-layout.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "os.h" 14#include "os.h"
15#include "process.h" 15#include "sysdep/mcontext.h"
16#include "sysdep/barrier.h"
17#include "sysdep/sigcontext.h"
18#include "user.h"
19
20/* Copied from linux/compiler-gcc.h since we can't include it directly */
21#define barrier() __asm__ __volatile__("": : :"memory")
22 16
23void (*sig_info[NSIG])(int, struct uml_pt_regs *) = { 17void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
24 [SIGTRAP] = relay_signal, 18 [SIGTRAP] = relay_signal,
@@ -30,7 +24,7 @@ void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
30 [SIGIO] = sigio_handler, 24 [SIGIO] = sigio_handler,
31 [SIGVTALRM] = timer_handler }; 25 [SIGVTALRM] = timer_handler };
32 26
33static void sig_handler_common(int sig, struct sigcontext *sc) 27static void sig_handler_common(int sig, mcontext_t *mc)
34{ 28{
35 struct uml_pt_regs r; 29 struct uml_pt_regs r;
36 int save_errno = errno; 30 int save_errno = errno;
@@ -38,8 +32,8 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
38 r.is_user = 0; 32 r.is_user = 0;
39 if (sig == SIGSEGV) { 33 if (sig == SIGSEGV) {
40 /* For segfaults, we want the data from the sigcontext. */ 34 /* For segfaults, we want the data from the sigcontext. */
41 copy_sc(&r, sc); 35 get_regs_from_mc(&r, mc);
42 GET_FAULTINFO_FROM_SC(r.faultinfo, sc); 36 GET_FAULTINFO_FROM_MC(r.faultinfo, mc);
43 } 37 }
44 38
45 /* enable signals if sig isn't IRQ signal */ 39 /* enable signals if sig isn't IRQ signal */
@@ -66,7 +60,7 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
66static int signals_enabled; 60static int signals_enabled;
67static unsigned int signals_pending; 61static unsigned int signals_pending;
68 62
69void sig_handler(int sig, struct sigcontext *sc) 63void sig_handler(int sig, mcontext_t *mc)
70{ 64{
71 int enabled; 65 int enabled;
72 66
@@ -78,23 +72,23 @@ void sig_handler(int sig, struct sigcontext *sc)
78 72
79 block_signals(); 73 block_signals();
80 74
81 sig_handler_common(sig, sc); 75 sig_handler_common(sig, mc);
82 76
83 set_signals(enabled); 77 set_signals(enabled);
84} 78}
85 79
86static void real_alarm_handler(struct sigcontext *sc) 80static void real_alarm_handler(mcontext_t *mc)
87{ 81{
88 struct uml_pt_regs regs; 82 struct uml_pt_regs regs;
89 83
90 if (sc != NULL) 84 if (mc != NULL)
91 copy_sc(&regs, sc); 85 get_regs_from_mc(&regs, mc);
92 regs.is_user = 0; 86 regs.is_user = 0;
93 unblock_signals(); 87 unblock_signals();
94 timer_handler(SIGVTALRM, &regs); 88 timer_handler(SIGVTALRM, &regs);
95} 89}
96 90
97void alarm_handler(int sig, struct sigcontext *sc) 91void alarm_handler(int sig, mcontext_t *mc)
98{ 92{
99 int enabled; 93 int enabled;
100 94
@@ -106,14 +100,13 @@ void alarm_handler(int sig, struct sigcontext *sc)
106 100
107 block_signals(); 101 block_signals();
108 102
109 real_alarm_handler(sc); 103 real_alarm_handler(mc);
110 set_signals(enabled); 104 set_signals(enabled);
111} 105}
112 106
113void timer_init(void) 107void timer_init(void)
114{ 108{
115 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler, 109 set_handler(SIGVTALRM);
116 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, -1);
117} 110}
118 111
119void set_sigstack(void *sig_stack, int size) 112void set_sigstack(void *sig_stack, int size)
@@ -126,10 +119,23 @@ void set_sigstack(void *sig_stack, int size)
126 panic("enabling signal stack failed, errno = %d\n", errno); 119 panic("enabling signal stack failed, errno = %d\n", errno);
127} 120}
128 121
129static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); 122static void (*handlers[_NSIG])(int sig, mcontext_t *mc) = {
123 [SIGSEGV] = sig_handler,
124 [SIGBUS] = sig_handler,
125 [SIGILL] = sig_handler,
126 [SIGFPE] = sig_handler,
127 [SIGTRAP] = sig_handler,
128
129 [SIGIO] = sig_handler,
130 [SIGWINCH] = sig_handler,
131 [SIGVTALRM] = alarm_handler
132};
133
130 134
131void handle_signal(int sig, struct sigcontext *sc) 135static void hard_handler(int sig, siginfo_t *info, void *p)
132{ 136{
137 struct ucontext *uc = p;
138 mcontext_t *mc = &uc->uc_mcontext;
133 unsigned long pending = 1UL << sig; 139 unsigned long pending = 1UL << sig;
134 140
135 do { 141 do {
@@ -155,7 +161,7 @@ void handle_signal(int sig, struct sigcontext *sc)
155 while ((sig = ffs(pending)) != 0){ 161 while ((sig = ffs(pending)) != 0){
156 sig--; 162 sig--;
157 pending &= ~(1 << sig); 163 pending &= ~(1 << sig);
158 (*handlers[sig])(sig, sc); 164 (*handlers[sig])(sig, mc);
159 } 165 }
160 166
161 /* 167 /*
@@ -169,28 +175,26 @@ void handle_signal(int sig, struct sigcontext *sc)
169 } while (pending); 175 } while (pending);
170} 176}
171 177
172extern void hard_handler(int sig); 178void set_handler(int sig)
173
174void set_handler(int sig, void (*handler)(int), int flags, ...)
175{ 179{
176 struct sigaction action; 180 struct sigaction action;
177 va_list ap; 181 int flags = SA_SIGINFO | SA_ONSTACK;
178 sigset_t sig_mask; 182 sigset_t sig_mask;
179 int mask;
180 183
181 handlers[sig] = (void (*)(int, struct sigcontext *)) handler; 184 action.sa_sigaction = hard_handler;
182 action.sa_handler = hard_handler;
183 185
186 /* block irq ones */
184 sigemptyset(&action.sa_mask); 187 sigemptyset(&action.sa_mask);
185 188 sigaddset(&action.sa_mask, SIGVTALRM);
186 va_start(ap, flags); 189 sigaddset(&action.sa_mask, SIGIO);
187 while ((mask = va_arg(ap, int)) != -1) 190 sigaddset(&action.sa_mask, SIGWINCH);
188 sigaddset(&action.sa_mask, mask);
189 va_end(ap);
190 191
191 if (sig == SIGSEGV) 192 if (sig == SIGSEGV)
192 flags |= SA_NODEFER; 193 flags |= SA_NODEFER;
193 194
195 if (sigismember(&action.sa_mask, sig))
196 flags |= SA_RESTART; /* if it's an irq signal */
197
194 action.sa_flags = flags; 198 action.sa_flags = flags;
195 action.sa_restorer = NULL; 199 action.sa_restorer = NULL;
196 if (sigaction(sig, &action, NULL) < 0) 200 if (sigaction(sig, &action, NULL) < 0)
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index e771398be5f3..c0afff7af4bd 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -9,7 +9,6 @@
9#include <string.h> 9#include <string.h>
10#include <sys/mman.h> 10#include <sys/mman.h>
11#include "init.h" 11#include "init.h"
12#include "kern_constants.h"
13#include "as-layout.h" 12#include "as-layout.h"
14#include "mm_id.h" 13#include "mm_id.h"
15#include "os.h" 14#include "os.h"
@@ -17,7 +16,6 @@
17#include "ptrace_user.h" 16#include "ptrace_user.h"
18#include "registers.h" 17#include "registers.h"
19#include "skas.h" 18#include "skas.h"
20#include "user.h"
21#include "sysdep/ptrace.h" 19#include "sysdep/ptrace.h"
22#include "sysdep/stub.h" 20#include "sysdep/stub.h"
23 21
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index dee0e8cf8ad0..cd65727854eb 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -9,31 +9,23 @@
9#include <errno.h> 9#include <errno.h>
10#include <string.h> 10#include <string.h>
11#include <sys/mman.h> 11#include <sys/mman.h>
12#include <sys/ptrace.h>
13#include <sys/wait.h> 12#include <sys/wait.h>
14#include <asm/unistd.h> 13#include <asm/unistd.h>
15#include "as-layout.h" 14#include "as-layout.h"
16#include "chan_user.h" 15#include "init.h"
17#include "kern_constants.h"
18#include "kern_util.h" 16#include "kern_util.h"
19#include "mem.h" 17#include "mem.h"
20#include "os.h" 18#include "os.h"
21#include "process.h"
22#include "proc_mm.h" 19#include "proc_mm.h"
23#include "ptrace_user.h" 20#include "ptrace_user.h"
24#include "registers.h" 21#include "registers.h"
25#include "skas.h" 22#include "skas.h"
26#include "skas_ptrace.h" 23#include "skas_ptrace.h"
27#include "user.h"
28#include "sysdep/stub.h" 24#include "sysdep/stub.h"
29 25
30int is_skas_winch(int pid, int fd, void *data) 26int is_skas_winch(int pid, int fd, void *data)
31{ 27{
32 if (pid != getpgrp()) 28 return pid == getpgrp();
33 return 0;
34
35 register_winch_irq(-1, fd, -1, data, 0);
36 return 1;
37} 29}
38 30
39static int ptrace_dump_regs(int pid) 31static int ptrace_dump_regs(int pid)
@@ -169,7 +161,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
169 161
170 if (!local_using_sysemu) 162 if (!local_using_sysemu)
171 { 163 {
172 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 164 err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
173 __NR_getpid); 165 __NR_getpid);
174 if (err < 0) { 166 if (err < 0) {
175 printk(UM_KERN_ERR "handle_trap - nullifying syscall " 167 printk(UM_KERN_ERR "handle_trap - nullifying syscall "
@@ -257,8 +249,8 @@ static int userspace_tramp(void *stack)
257 249
258 set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE); 250 set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE);
259 sigemptyset(&sa.sa_mask); 251 sigemptyset(&sa.sa_mask);
260 sa.sa_flags = SA_ONSTACK | SA_NODEFER; 252 sa.sa_flags = SA_ONSTACK | SA_NODEFER | SA_SIGINFO;
261 sa.sa_handler = (void *) v; 253 sa.sa_sigaction = (void *) v;
262 sa.sa_restorer = NULL; 254 sa.sa_restorer = NULL;
263 if (sigaction(SIGSEGV, &sa, NULL) < 0) { 255 if (sigaction(SIGSEGV, &sa, NULL) < 0) {
264 printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV " 256 printk(UM_KERN_ERR "userspace_tramp - setting SIGSEGV "
@@ -661,8 +653,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
661{ 653{
662 int n; 654 int n;
663 655
664 set_handler(SIGWINCH, (__sighandler_t) sig_handler, 656 set_handler(SIGWINCH);
665 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGVTALRM, -1);
666 657
667 /* 658 /*
668 * Can't use UML_SETJMP or UML_LONGJMP here because they save 659 * Can't use UML_SETJMP or UML_LONGJMP here because they save
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 02ee9adff54a..425162e22af5 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -13,12 +13,10 @@
13#include <signal.h> 13#include <signal.h>
14#include <string.h> 14#include <string.h>
15#include <sys/mman.h> 15#include <sys/mman.h>
16#include <sys/ptrace.h>
17#include <sys/stat.h> 16#include <sys/stat.h>
18#include <sys/wait.h> 17#include <sys/wait.h>
19#include <asm/unistd.h> 18#include <asm/unistd.h>
20#include "init.h" 19#include "init.h"
21#include "kern_constants.h"
22#include "os.h" 20#include "os.h"
23#include "mem_user.h" 21#include "mem_user.h"
24#include "ptrace_user.h" 22#include "ptrace_user.h"
@@ -225,7 +223,7 @@ static void __init check_sysemu(void)
225 goto fail; 223 goto fail;
226 } 224 }
227 225
228 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); 226 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
229 if (n < 0) { 227 if (n < 0) {
230 non_fatal("check_sysemu : failed to modify system call " 228 non_fatal("check_sysemu : failed to modify system call "
231 "return"); 229 "return");
@@ -261,7 +259,7 @@ static void __init check_sysemu(void)
261 "doesn't singlestep"); 259 "doesn't singlestep");
262 goto fail; 260 goto fail;
263 } 261 }
264 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 262 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET,
265 os_getpid()); 263 os_getpid());
266 if (n < 0) 264 if (n < 0)
267 fatal_perror("check_sysemu : failed to modify " 265 fatal_perror("check_sysemu : failed to modify "
@@ -317,10 +315,10 @@ static void __init check_ptrace(void)
317 fatal("check_ptrace : expected (SIGTRAP|0x80), " 315 fatal("check_ptrace : expected (SIGTRAP|0x80), "
318 "got status = %d", status); 316 "got status = %d", status);
319 317
320 syscall = ptrace(PTRACE_PEEKUSR, pid, PT_SYSCALL_NR_OFFSET, 318 syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET,
321 0); 319 0);
322 if (syscall == __NR_getpid) { 320 if (syscall == __NR_getpid) {
323 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, 321 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
324 __NR_getppid); 322 __NR_getppid);
325 if (n < 0) 323 if (n < 0)
326 fatal_perror("check_ptrace : failed to modify " 324 fatal_perror("check_ptrace : failed to modify "
diff --git a/arch/um/os-Linux/sys-i386/signal.c b/arch/um/os-Linux/sys-i386/signal.c
deleted file mode 100644
index f311609f93da..000000000000
--- a/arch/um/os-Linux/sys-i386/signal.c
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7
8extern void handle_signal(int sig, struct sigcontext *sc);
9
10void hard_handler(int sig)
11{
12 handle_signal(sig, (struct sigcontext *) (&sig + 1));
13}
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile
deleted file mode 100644
index a44a47f8f57b..000000000000
--- a/arch/um/os-Linux/sys-x86_64/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL
4#
5
6obj-y = registers.o prctl.o signal.o task_size.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
deleted file mode 100644
index 594d97ad02b3..000000000000
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <errno.h>
7#include <sys/ptrace.h>
8#define __FRAME_OFFSETS
9#include <asm/ptrace.h>
10#include "kern_constants.h"
11#include "longjmp.h"
12#include "user.h"
13
14int save_fp_registers(int pid, unsigned long *fp_regs)
15{
16 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
17 return -errno;
18 return 0;
19}
20
21int restore_fp_registers(int pid, unsigned long *fp_regs)
22{
23 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
24 return -errno;
25 return 0;
26}
27
28unsigned long get_thread_reg(int reg, jmp_buf *buf)
29{
30 switch (reg) {
31 case RIP:
32 return buf[0]->__rip;
33 case RSP:
34 return buf[0]->__rsp;
35 case RBP:
36 return buf[0]->__rbp;
37 default:
38 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
39 reg);
40 return 0;
41 }
42}
43
44int get_fp_registers(int pid, unsigned long *regs)
45{
46 return save_fp_registers(pid, regs);
47}
48
49int put_fp_registers(int pid, unsigned long *regs)
50{
51 return restore_fp_registers(pid, regs);
52}
diff --git a/arch/um/os-Linux/sys-x86_64/signal.c b/arch/um/os-Linux/sys-x86_64/signal.c
deleted file mode 100644
index 82a388822cd3..000000000000
--- a/arch/um/os-Linux/sys-x86_64/signal.c
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7
8extern void handle_signal(int sig, struct sigcontext *sc);
9
10void hard_handler(int sig)
11{
12 struct ucontext *uc;
13 asm("movq %%rdx, %0" : "=r" (uc));
14
15 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
16}
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c
deleted file mode 100644
index 26a0dd1f349c..000000000000
--- a/arch/um/os-Linux/sys-x86_64/task_size.c
+++ /dev/null
@@ -1,5 +0,0 @@
1unsigned long os_get_top_address(unsigned long shift)
2{
3 /* The old value of CONFIG_TOP_ADDR */
4 return 0x7fc0000000;
5}
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 6e3359d6a839..910499d76a67 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -8,11 +8,9 @@
8#include <signal.h> 8#include <signal.h>
9#include <time.h> 9#include <time.h>
10#include <sys/time.h> 10#include <sys/time.h>
11#include "kern_constants.h"
12#include "kern_util.h" 11#include "kern_util.h"
13#include "os.h" 12#include "os.h"
14#include "process.h" 13#include "internal.h"
15#include "user.h"
16 14
17int set_interval(void) 15int set_interval(void)
18{ 16{
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
deleted file mode 100644
index 73277801ef14..000000000000
--- a/arch/um/os-Linux/tls.c
+++ /dev/null
@@ -1,35 +0,0 @@
1#include <errno.h>
2#include <sys/ptrace.h>
3#include "sysdep/tls.h"
4
5/* TLS support - we basically rely on the host's one.*/
6
7#ifndef PTRACE_GET_THREAD_AREA
8#define PTRACE_GET_THREAD_AREA 25
9#endif
10
11#ifndef PTRACE_SET_THREAD_AREA
12#define PTRACE_SET_THREAD_AREA 26
13#endif
14
15int os_set_thread_area(user_desc_t *info, int pid)
16{
17 int ret;
18
19 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
20 (unsigned long) info);
21 if (ret < 0)
22 ret = -errno;
23 return ret;
24}
25
26int os_get_thread_area(user_desc_t *info, int pid)
27{
28 int ret;
29
30 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
31 (unsigned long) info);
32 if (ret < 0)
33 ret = -errno;
34 return ret;
35}
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c
index b09ff66a77ee..dd12b99dcb59 100644
--- a/arch/um/os-Linux/tty.c
+++ b/arch/um/os-Linux/tty.c
@@ -7,10 +7,8 @@
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include <fcntl.h> 9#include <fcntl.h>
10#include "kern_constants.h"
11#include "kern_util.h" 10#include "kern_util.h"
12#include "os.h" 11#include "os.h"
13#include "user.h"
14 12
15struct grantpt_info { 13struct grantpt_info {
16 int fd; 14 int fd;
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
deleted file mode 100644
index 087ed74ffca5..000000000000
--- a/arch/um/os-Linux/uaccess.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#include <stddef.h>
8#include "longjmp.h"
9
10unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, jmp_buf **fault_catcher,
12 void (*op)(void *to, const void *from,
13 int n), int *faulted_out)
14{
15 unsigned long *faddrp = (unsigned long *) fault_addr, ret;
16
17 jmp_buf jbuf;
18 *fault_catcher = &jbuf;
19 if (UML_SETJMP(&jbuf) == 0) {
20 (*op)(to, from, n);
21 ret = 0;
22 *faulted_out = 0;
23 }
24 else {
25 ret = *faddrp;
26 *faulted_out = 1;
27 }
28 *fault_addr = NULL;
29 *fault_catcher = NULL;
30 return ret;
31}
32
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index a27defb81884..4832eb519f8d 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -13,9 +13,7 @@
13#include <unistd.h> 13#include <unistd.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include "init.h" 15#include "init.h"
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20#define UML_DIR "~/.uml/" 18#define UML_DIR "~/.uml/"
21 19
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 5803b1887672..9e3b43bb84c9 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -13,9 +13,7 @@
13#include <wait.h> 13#include <wait.h>
14#include <sys/mman.h> 14#include <sys/mman.h>
15#include <sys/utsname.h> 15#include <sys/utsname.h>
16#include "kern_constants.h"
17#include "os.h" 16#include "os.h"
18#include "user.h"
19 17
20void stack_protections(unsigned long address) 18void stack_protections(unsigned long address)
21{ 19{
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 61107b68e05b..2eb2843b0634 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -8,7 +8,7 @@ USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS))
8USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) 8USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
9 9
10$(USER_OBJS:.o=.%): \ 10$(USER_OBJS:.o=.%): \
11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(basetarget).o) 11 c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o)
12$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 12$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
13 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF) 13 -Dunix -D__unix__ -D__$(SUBARCH)__ $(CF)
14 14
@@ -25,8 +25,3 @@ $(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
25define unprofile 25define unprofile
26 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1))) 26 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
27endef 27endef
28
29ifdef subarch-obj-y
30obj-y += subarch.o
31subarch-y = $(addprefix ../../$(HEADER_ARCH)/,$(subarch-obj-y))
32endif
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
deleted file mode 100644
index 3923cfb87649..000000000000
--- a/arch/um/sys-i386/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
1#
2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3#
4
5obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
6 ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
7 sys_call_table.o tls.o atomic64_cx8_32.o mem.o
8
9obj-$(CONFIG_BINFMT_ELF) += elfcore.o
10
11subarch-obj-y = lib/string_32.o
12subarch-obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += lib/rwsem.o
13subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
14subarch-obj-$(CONFIG_MODULES) += kernel/module.o
15
16USER_OBJS := bugs.o ptrace_user.o fault.o
17
18USER_OBJS += user-offsets.s
19extra-y += user-offsets.s
20
21UNPROFILE_OBJS := stub_segv.o
22CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
23
24include arch/um/scripts/Makefile.rules
diff --git a/arch/um/sys-i386/asm/elf.h b/arch/um/sys-i386/asm/elf.h
deleted file mode 100644
index 42305551d204..000000000000
--- a/arch/um/sys-i386/asm/elf.h
+++ /dev/null
@@ -1,125 +0,0 @@
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
24typedef unsigned long elf_greg_t;
25
26#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
27typedef elf_greg_t elf_gregset_t[ELF_NGREG];
28
29typedef 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 ELF_EXEC_PAGESIZE 4096
52
53#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
54
55/* Shamelessly stolen from include/asm-i386/elf.h */
56
57#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
58 pr_reg[0] = PT_REGS_EBX(regs); \
59 pr_reg[1] = PT_REGS_ECX(regs); \
60 pr_reg[2] = PT_REGS_EDX(regs); \
61 pr_reg[3] = PT_REGS_ESI(regs); \
62 pr_reg[4] = PT_REGS_EDI(regs); \
63 pr_reg[5] = PT_REGS_EBP(regs); \
64 pr_reg[6] = PT_REGS_EAX(regs); \
65 pr_reg[7] = PT_REGS_DS(regs); \
66 pr_reg[8] = PT_REGS_ES(regs); \
67 /* fake once used fs and gs selectors? */ \
68 pr_reg[9] = PT_REGS_DS(regs); \
69 pr_reg[10] = PT_REGS_DS(regs); \
70 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
71 pr_reg[12] = PT_REGS_IP(regs); \
72 pr_reg[13] = PT_REGS_CS(regs); \
73 pr_reg[14] = PT_REGS_EFLAGS(regs); \
74 pr_reg[15] = PT_REGS_SP(regs); \
75 pr_reg[16] = PT_REGS_SS(regs); \
76} while (0);
77
78#define task_pt_regs(t) (&(t)->thread.regs)
79
80struct task_struct;
81
82extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
83
84#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
85
86extern long elf_aux_hwcap;
87#define ELF_HWCAP (elf_aux_hwcap)
88
89extern char * elf_aux_platform;
90#define ELF_PLATFORM (elf_aux_platform)
91
92#define SET_PERSONALITY(ex) do { } while (0)
93
94extern unsigned long vsyscall_ehdr;
95extern unsigned long vsyscall_end;
96extern unsigned long __kernel_vsyscall;
97
98#define VSYSCALL_BASE vsyscall_ehdr
99#define VSYSCALL_END vsyscall_end
100
101/*
102 * This is the range that is readable by user mode, and things
103 * acting like user mode such as get_user_pages.
104 */
105#define FIXADDR_USER_START VSYSCALL_BASE
106#define FIXADDR_USER_END VSYSCALL_END
107
108#define __HAVE_ARCH_GATE_AREA 1
109
110/*
111 * Architecture-neutral AT_ values in 0-17, leave some room
112 * for more of them, start the x86-specific ones at 32.
113 */
114#define AT_SYSINFO 32
115#define AT_SYSINFO_EHDR 33
116
117#define ARCH_DLINFO \
118do { \
119 if ( vsyscall_ehdr ) { \
120 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
121 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
122 } \
123} while (0)
124
125#endif
diff --git a/arch/um/sys-i386/asm/module.h b/arch/um/sys-i386/asm/module.h
deleted file mode 100644
index 5ead4a0b2e35..000000000000
--- a/arch/um/sys-i386/asm/module.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __UM_MODULE_I386_H
2#define __UM_MODULE_I386_H
3
4/* UML is simple */
5struct 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/atomic64_cx8_32.S b/arch/um/sys-i386/atomic64_cx8_32.S
deleted file mode 100644
index 1e901d3d4a95..000000000000
--- a/arch/um/sys-i386/atomic64_cx8_32.S
+++ /dev/null
@@ -1,225 +0,0 @@
1/*
2 * atomic64_t for 586+
3 *
4 * Copied from arch/x86/lib/atomic64_cx8_32.S
5 *
6 * Copyright © 2010 Luca Barbieri
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/linkage.h>
16#include <asm/alternative-asm.h>
17#include <asm/dwarf2.h>
18
19.macro SAVE reg
20 pushl_cfi %\reg
21 CFI_REL_OFFSET \reg, 0
22.endm
23
24.macro RESTORE reg
25 popl_cfi %\reg
26 CFI_RESTORE \reg
27.endm
28
29.macro read64 reg
30 movl %ebx, %eax
31 movl %ecx, %edx
32/* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */
33 LOCK_PREFIX
34 cmpxchg8b (\reg)
35.endm
36
37ENTRY(atomic64_read_cx8)
38 CFI_STARTPROC
39
40 read64 %ecx
41 ret
42 CFI_ENDPROC
43ENDPROC(atomic64_read_cx8)
44
45ENTRY(atomic64_set_cx8)
46 CFI_STARTPROC
47
481:
49/* we don't need LOCK_PREFIX since aligned 64-bit writes
50 * are atomic on 586 and newer */
51 cmpxchg8b (%esi)
52 jne 1b
53
54 ret
55 CFI_ENDPROC
56ENDPROC(atomic64_set_cx8)
57
58ENTRY(atomic64_xchg_cx8)
59 CFI_STARTPROC
60
61 movl %ebx, %eax
62 movl %ecx, %edx
631:
64 LOCK_PREFIX
65 cmpxchg8b (%esi)
66 jne 1b
67
68 ret
69 CFI_ENDPROC
70ENDPROC(atomic64_xchg_cx8)
71
72.macro addsub_return func ins insc
73ENTRY(atomic64_\func\()_return_cx8)
74 CFI_STARTPROC
75 SAVE ebp
76 SAVE ebx
77 SAVE esi
78 SAVE edi
79
80 movl %eax, %esi
81 movl %edx, %edi
82 movl %ecx, %ebp
83
84 read64 %ebp
851:
86 movl %eax, %ebx
87 movl %edx, %ecx
88 \ins\()l %esi, %ebx
89 \insc\()l %edi, %ecx
90 LOCK_PREFIX
91 cmpxchg8b (%ebp)
92 jne 1b
93
9410:
95 movl %ebx, %eax
96 movl %ecx, %edx
97 RESTORE edi
98 RESTORE esi
99 RESTORE ebx
100 RESTORE ebp
101 ret
102 CFI_ENDPROC
103ENDPROC(atomic64_\func\()_return_cx8)
104.endm
105
106addsub_return add add adc
107addsub_return sub sub sbb
108
109.macro incdec_return func ins insc
110ENTRY(atomic64_\func\()_return_cx8)
111 CFI_STARTPROC
112 SAVE ebx
113
114 read64 %esi
1151:
116 movl %eax, %ebx
117 movl %edx, %ecx
118 \ins\()l $1, %ebx
119 \insc\()l $0, %ecx
120 LOCK_PREFIX
121 cmpxchg8b (%esi)
122 jne 1b
123
12410:
125 movl %ebx, %eax
126 movl %ecx, %edx
127 RESTORE ebx
128 ret
129 CFI_ENDPROC
130ENDPROC(atomic64_\func\()_return_cx8)
131.endm
132
133incdec_return inc add adc
134incdec_return dec sub sbb
135
136ENTRY(atomic64_dec_if_positive_cx8)
137 CFI_STARTPROC
138 SAVE ebx
139
140 read64 %esi
1411:
142 movl %eax, %ebx
143 movl %edx, %ecx
144 subl $1, %ebx
145 sbb $0, %ecx
146 js 2f
147 LOCK_PREFIX
148 cmpxchg8b (%esi)
149 jne 1b
150
1512:
152 movl %ebx, %eax
153 movl %ecx, %edx
154 RESTORE ebx
155 ret
156 CFI_ENDPROC
157ENDPROC(atomic64_dec_if_positive_cx8)
158
159ENTRY(atomic64_add_unless_cx8)
160 CFI_STARTPROC
161 SAVE ebp
162 SAVE ebx
163/* these just push these two parameters on the stack */
164 SAVE edi
165 SAVE esi
166
167 movl %ecx, %ebp
168 movl %eax, %esi
169 movl %edx, %edi
170
171 read64 %ebp
1721:
173 cmpl %eax, 0(%esp)
174 je 4f
1752:
176 movl %eax, %ebx
177 movl %edx, %ecx
178 addl %esi, %ebx
179 adcl %edi, %ecx
180 LOCK_PREFIX
181 cmpxchg8b (%ebp)
182 jne 1b
183
184 movl $1, %eax
1853:
186 addl $8, %esp
187 CFI_ADJUST_CFA_OFFSET -8
188 RESTORE ebx
189 RESTORE ebp
190 ret
1914:
192 cmpl %edx, 4(%esp)
193 jne 2b
194 xorl %eax, %eax
195 jmp 3b
196 CFI_ENDPROC
197ENDPROC(atomic64_add_unless_cx8)
198
199ENTRY(atomic64_inc_not_zero_cx8)
200 CFI_STARTPROC
201 SAVE ebx
202
203 read64 %esi
2041:
205 testl %eax, %eax
206 je 4f
2072:
208 movl %eax, %ebx
209 movl %edx, %ecx
210 addl $1, %ebx
211 adcl $0, %ecx
212 LOCK_PREFIX
213 cmpxchg8b (%esi)
214 jne 1b
215
216 movl $1, %eax
2173:
218 RESTORE ebx
219 ret
2204:
221 testl %edx, %edx
222 jne 2b
223 jmp 3b
224 CFI_ENDPROC
225ENDPROC(atomic64_inc_not_zero_cx8)
diff --git a/arch/um/sys-i386/bug.c b/arch/um/sys-i386/bug.c
deleted file mode 100644
index 8d4f273f1219..000000000000
--- a/arch/um/sys-i386/bug.c
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL V2
4 */
5
6#include <linux/uaccess.h>
7#include <asm/errno.h>
8
9/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because
10 * that's not relevant in skas mode.
11 */
12
13int is_valid_bugaddr(unsigned long eip)
14{
15 unsigned short ud2;
16
17 if (probe_kernel_address((unsigned short __user *)eip, ud2))
18 return 0;
19
20 return ud2 == 0x0b0f;
21}
diff --git a/arch/um/sys-i386/ksyms.c b/arch/um/sys-i386/ksyms.c
deleted file mode 100644
index bfbefd30db8f..000000000000
--- a/arch/um/sys-i386/ksyms.c
+++ /dev/null
@@ -1,5 +0,0 @@
1#include "linux/module.h"
2#include "asm/checksum.h"
3
4/* Networking helper routines. */
5EXPORT_SYMBOL(csum_partial);
diff --git a/arch/um/sys-i386/shared/sysdep/barrier.h b/arch/um/sys-i386/shared/sysdep/barrier.h
deleted file mode 100644
index b58d52c5b2f4..000000000000
--- a/arch/um/sys-i386/shared/sysdep/barrier.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __SYSDEP_I386_BARRIER_H
2#define __SYSDEP_I386_BARRIER_H
3
4/* Copied from include/asm-i386 for use by userspace. i386 has the option
5 * of using mfence, but I'm just using this, which works everywhere, for now.
6 */
7#define mb() asm volatile("lock; addl $0,0(%esp)")
8
9#endif
diff --git a/arch/um/sys-i386/shared/sysdep/host_ldt.h b/arch/um/sys-i386/shared/sysdep/host_ldt.h
deleted file mode 100644
index 0953cc4df652..000000000000
--- a/arch/um/sys-i386/shared/sysdep/host_ldt.h
+++ /dev/null
@@ -1,34 +0,0 @@
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/sys-i386/shared/sysdep/ptrace_user.h b/arch/um/sys-i386/shared/sysdep/ptrace_user.h
deleted file mode 100644
index ef56247e4143..000000000000
--- a/arch/um/sys-i386/shared/sysdep/ptrace_user.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_I386_PTRACE_USER_H__
7#define __SYSDEP_I386_PTRACE_USER_H__
8
9#include <sys/ptrace.h>
10#include <linux/ptrace.h>
11#include <asm/ptrace.h>
12#include "user_constants.h"
13
14#define PT_OFFSET(r) ((r) * sizeof(long))
15
16#define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX])
17#define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX)
18
19#define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(EBX)
20#define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(ECX)
21#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX)
22#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI)
23#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI)
24#define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP)
25
26#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
27
28#define REGS_SYSCALL_NR EAX /* This is used before a system call */
29#define REGS_SYSCALL_ARG1 EBX
30#define REGS_SYSCALL_ARG2 ECX
31#define REGS_SYSCALL_ARG3 EDX
32#define REGS_SYSCALL_ARG4 ESI
33#define REGS_SYSCALL_ARG5 EDI
34#define REGS_SYSCALL_ARG6 EBP
35
36#define REGS_IP_INDEX EIP
37#define REGS_SP_INDEX UESP
38
39#define PT_IP_OFFSET PT_OFFSET(EIP)
40#define PT_IP(regs) ((regs)[EIP])
41#define PT_SP_OFFSET PT_OFFSET(UESP)
42#define PT_SP(regs) ((regs)[UESP])
43
44#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
45
46#ifndef FRAME_SIZE
47#define FRAME_SIZE (17)
48#endif
49
50#endif
diff --git a/arch/um/sys-i386/shared/sysdep/sc.h b/arch/um/sys-i386/shared/sysdep/sc.h
deleted file mode 100644
index c57d1780ad37..000000000000
--- a/arch/um/sys-i386/shared/sysdep/sc.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __SYSDEP_I386_SC_H
2#define __SYSDEP_I386_SC_H
3
4#include <user_constants.h>
5
6#define SC_OFFSET(sc, field) \
7 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
8#define SC_FP_OFFSET(sc, field) \
9 *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
10#define SC_FP_OFFSET_PTR(sc, field, type) \
11 ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
12
13#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
14#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
15#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
16#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
17#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
18#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
19#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
20#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
21#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
22#define SC_EAX(sc) SC_OFFSET(sc, SC_EAX)
23#define SC_EBX(sc) SC_OFFSET(sc, SC_EBX)
24#define SC_ECX(sc) SC_OFFSET(sc, SC_ECX)
25#define SC_EDX(sc) SC_OFFSET(sc, SC_EDX)
26#define SC_EDI(sc) SC_OFFSET(sc, SC_EDI)
27#define SC_ESI(sc) SC_OFFSET(sc, SC_ESI)
28#define SC_EBP(sc) SC_OFFSET(sc, SC_EBP)
29#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
30#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
31#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
32#define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE)
33#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
34#define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW)
35#define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW)
36#define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG)
37#define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF)
38#define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL)
39#define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF)
40#define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL)
41#define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate)
42#define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void)
43
44#endif
diff --git a/arch/um/sys-i386/shared/sysdep/sigcontext.h b/arch/um/sys-i386/shared/sysdep/sigcontext.h
deleted file mode 100644
index f583c87111a0..000000000000
--- a/arch/um/sys-i386/shared/sysdep/sigcontext.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYS_SIGCONTEXT_I386_H
7#define __SYS_SIGCONTEXT_I386_H
8
9#include "sysdep/sc.h"
10
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
12
13#define GET_FAULTINFO_FROM_SC(fi, sc) \
14 { \
15 (fi).cr2 = SC_CR2(sc); \
16 (fi).error_code = SC_ERR(sc); \
17 (fi).trap_no = SC_TRAPNO(sc); \
18 }
19
20/* This is Page Fault */
21#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
22
23/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
24#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
25
26#endif
diff --git a/arch/um/sys-i386/shared/sysdep/vm-flags.h b/arch/um/sys-i386/shared/sysdep/vm-flags.h
deleted file mode 100644
index e0d24c568dbc..000000000000
--- a/arch/um/sys-i386/shared/sysdep/vm-flags.h
+++ /dev/null
@@ -1,14 +0,0 @@
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/stub_segv.c b/arch/um/sys-i386/stub_segv.c
deleted file mode 100644
index 28ccf737a79f..000000000000
--- a/arch/um/sys-i386/stub_segv.c
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include "sysdep/stub.h"
7#include "sysdep/sigcontext.h"
8
9void __attribute__ ((__section__ (".__syscall_stub")))
10stub_segv_handler(int sig)
11{
12 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
13
14 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA), sc);
15
16 trap_myself();
17}
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
deleted file mode 100644
index 5f883bfe773f..000000000000
--- a/arch/um/sys-i386/user-offsets.c
+++ /dev/null
@@ -1,53 +0,0 @@
1#include <stdio.h>
2#include <stddef.h>
3#include <signal.h>
4#include <sys/poll.h>
5#include <sys/user.h>
6#include <sys/mman.h>
7#include <asm/ptrace.h>
8
9#define DEFINE(sym, val) \
10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
11
12#define DEFINE_LONGS(sym, val) \
13 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
14
15#define OFFSET(sym, str, mem) \
16 DEFINE(sym, offsetof(struct str, mem));
17
18void foo(void)
19{
20 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
21 OFFSET(HOST_SC_ERR, sigcontext, err);
22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
23
24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
25 DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
26
27 DEFINE(HOST_IP, EIP);
28 DEFINE(HOST_SP, UESP);
29 DEFINE(HOST_EFLAGS, EFL);
30 DEFINE(HOST_EAX, EAX);
31 DEFINE(HOST_EBX, EBX);
32 DEFINE(HOST_ECX, ECX);
33 DEFINE(HOST_EDX, EDX);
34 DEFINE(HOST_ESI, ESI);
35 DEFINE(HOST_EDI, EDI);
36 DEFINE(HOST_EBP, EBP);
37 DEFINE(HOST_CS, CS);
38 DEFINE(HOST_SS, SS);
39 DEFINE(HOST_DS, DS);
40 DEFINE(HOST_FS, FS);
41 DEFINE(HOST_ES, ES);
42 DEFINE(HOST_GS, GS);
43 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
44
45 /* XXX Duplicated between i386 and x86_64 */
46 DEFINE(UM_POLLIN, POLLIN);
47 DEFINE(UM_POLLPRI, POLLPRI);
48 DEFINE(UM_POLLOUT, POLLOUT);
49
50 DEFINE(UM_PROT_READ, PROT_READ);
51 DEFINE(UM_PROT_WRITE, PROT_WRITE);
52 DEFINE(UM_PROT_EXEC, PROT_EXEC);
53}
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
deleted file mode 100644
index bd4d1d3ba919..000000000000
--- a/arch/um/sys-x86_64/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
1#
2# Copyright 2003 PathScale, Inc.
3#
4# Licensed under the GPL
5#
6
7obj-y = bug.o bugs.o delay.o fault.o ldt.o ptrace.o ptrace_user.o mem.o \
8 setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \
9 sysrq.o ksyms.o tls.o
10
11obj-y += vdso/
12
13subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o \
14 lib/rwsem.o
15subarch-obj-$(CONFIG_MODULES) += kernel/module.o
16
17ldt-y = ../sys-i386/ldt.o
18
19USER_OBJS := ptrace_user.o
20
21USER_OBJS += user-offsets.s
22extra-y += user-offsets.s
23
24UNPROFILE_OBJS := stub_segv.o
25CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
26
27include arch/um/scripts/Makefile.rules
diff --git a/arch/um/sys-x86_64/asm/archparam.h b/arch/um/sys-x86_64/asm/archparam.h
deleted file mode 100644
index 6c083663b8d9..000000000000
--- a/arch/um/sys-x86_64/asm/archparam.h
+++ /dev/null
@@ -1,16 +0,0 @@
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
diff --git a/arch/um/sys-x86_64/asm/module.h b/arch/um/sys-x86_64/asm/module.h
deleted file mode 100644
index 8eb79c2d07d5..000000000000
--- a/arch/um/sys-x86_64/asm/module.h
+++ /dev/null
@@ -1,20 +0,0 @@
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 */
11struct 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
diff --git a/arch/um/sys-x86_64/delay.c b/arch/um/sys-x86_64/delay.c
deleted file mode 100644
index f3fe1a688f7e..000000000000
--- a/arch/um/sys-x86_64/delay.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
3 * Mostly copied from arch/x86/lib/delay.c
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/delay.h>
13#include <asm/param.h>
14
15void __delay(unsigned long loops)
16{
17 asm volatile(
18 "test %0,%0\n"
19 "jz 3f\n"
20 "jmp 1f\n"
21
22 ".align 16\n"
23 "1: jmp 2f\n"
24
25 ".align 16\n"
26 "2: dec %0\n"
27 " jnz 2b\n"
28 "3: dec %0\n"
29
30 : /* we don't need output */
31 : "a" (loops)
32 );
33}
34EXPORT_SYMBOL(__delay);
35
36inline void __const_udelay(unsigned long xloops)
37{
38 int d0;
39
40 xloops *= 4;
41 asm("mull %%edx"
42 : "=d" (xloops), "=&a" (d0)
43 : "1" (xloops), "0"
44 (loops_per_jiffy * (HZ/4)));
45
46 __delay(++xloops);
47}
48EXPORT_SYMBOL(__const_udelay);
49
50void __udelay(unsigned long usecs)
51{
52 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
53}
54EXPORT_SYMBOL(__udelay);
55
56void __ndelay(unsigned long nsecs)
57{
58 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
59}
60EXPORT_SYMBOL(__ndelay);
diff --git a/arch/um/sys-x86_64/fault.c b/arch/um/sys-x86_64/fault.c
deleted file mode 100644
index ce85117fc64e..000000000000
--- a/arch/um/sys-x86_64/fault.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include "sysdep/ptrace.h"
8
9/* These two are from asm-um/uaccess.h and linux/module.h, check them. */
10struct exception_table_entry
11{
12 unsigned long insn;
13 unsigned long fixup;
14};
15
16const struct exception_table_entry *search_exception_tables(unsigned long add);
17
18int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
19{
20 const struct exception_table_entry *fixup;
21
22 fixup = search_exception_tables(address);
23 if (fixup != 0) {
24 UPT_IP(regs) = fixup->fixup;
25 return 1;
26 }
27 return 0;
28}
diff --git a/arch/um/sys-x86_64/ptrace_user.c b/arch/um/sys-x86_64/ptrace_user.c
deleted file mode 100644
index c57a496d3f5b..000000000000
--- a/arch/um/sys-x86_64/ptrace_user.c
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include <errno.h>
8#include "ptrace_user.h"
9
10int ptrace_getregs(long pid, unsigned long *regs_out)
11{
12 if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0)
13 return -errno;
14 return(0);
15}
16
17int ptrace_setregs(long pid, unsigned long *regs_out)
18{
19 if (ptrace(PTRACE_SETREGS, pid, 0, regs_out) < 0)
20 return -errno;
21 return(0);
22}
diff --git a/arch/um/sys-x86_64/shared/sysdep/barrier.h b/arch/um/sys-x86_64/shared/sysdep/barrier.h
deleted file mode 100644
index 7b610befdc8f..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/barrier.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __SYSDEP_X86_64_BARRIER_H
2#define __SYSDEP_X86_64_BARRIER_H
3
4/* Copied from include/asm-x86_64 for use by userspace. */
5#define mb() asm volatile("mfence":::"memory")
6
7#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/host_ldt.h b/arch/um/sys-x86_64/shared/sysdep/host_ldt.h
deleted file mode 100644
index e8b1be1e154f..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/host_ldt.h
+++ /dev/null
@@ -1,38 +0,0 @@
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/sys-x86_64/shared/sysdep/kernel-offsets.h b/arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h
deleted file mode 100644
index a307237b7964..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/kernel-offsets.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#include <linux/stddef.h>
2#include <linux/sched.h>
3#include <linux/time.h>
4#include <linux/elf.h>
5#include <linux/crypto.h>
6#include <asm/page.h>
7#include <asm/mman.h>
8
9#define DEFINE(sym, val) \
10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
11
12#define DEFINE_STR1(x) #x
13#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : )
14
15#define BLANK() asm volatile("\n->" : : )
16
17#define OFFSET(sym, str, mem) \
18 DEFINE(sym, offsetof(struct str, mem));
19
20void foo(void)
21{
22#include <common-offsets.h>
23}
diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace_user.h b/arch/um/sys-x86_64/shared/sysdep/ptrace_user.h
deleted file mode 100644
index 4dbccdb58f48..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/ptrace_user.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_PTRACE_USER_H__
8#define __SYSDEP_X86_64_PTRACE_USER_H__
9
10#define __FRAME_OFFSETS
11#include <sys/ptrace.h>
12#include <linux/ptrace.h>
13#include <asm/ptrace.h>
14#undef __FRAME_OFFSETS
15#include "user_constants.h"
16
17#define PT_INDEX(off) ((off) / sizeof(unsigned long))
18
19#define PT_SYSCALL_NR(regs) ((regs)[PT_INDEX(ORIG_RAX)])
20#define PT_SYSCALL_NR_OFFSET (ORIG_RAX)
21
22#define PT_SYSCALL_ARG1(regs) (((unsigned long *) (regs))[PT_INDEX(RDI)])
23#define PT_SYSCALL_ARG1_OFFSET (RDI)
24
25#define PT_SYSCALL_ARG2(regs) (((unsigned long *) (regs))[PT_INDEX(RSI)])
26#define PT_SYSCALL_ARG2_OFFSET (RSI)
27
28#define PT_SYSCALL_ARG3(regs) (((unsigned long *) (regs))[PT_INDEX(RDX)])
29#define PT_SYSCALL_ARG3_OFFSET (RDX)
30
31#define PT_SYSCALL_ARG4(regs) (((unsigned long *) (regs))[PT_INDEX(RCX)])
32#define PT_SYSCALL_ARG4_OFFSET (RCX)
33
34#define PT_SYSCALL_ARG5(regs) (((unsigned long *) (regs))[PT_INDEX(R8)])
35#define PT_SYSCALL_ARG5_OFFSET (R8)
36
37#define PT_SYSCALL_ARG6(regs) (((unsigned long *) (regs))[PT_INDEX(R9)])
38#define PT_SYSCALL_ARG6_OFFSET (R9)
39
40#define PT_SYSCALL_RET_OFFSET (RAX)
41
42#define PT_IP_OFFSET (RIP)
43#define PT_IP(regs) ((regs)[PT_INDEX(RIP)])
44
45#define PT_SP_OFFSET (RSP)
46#define PT_SP(regs) ((regs)[PT_INDEX(RSP)])
47
48#define PT_ORIG_RAX_OFFSET (ORIG_RAX)
49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)])
50
51/*
52 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
53 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
54 * 2.4 name and value for 2.4 host compatibility.
55 */
56#ifndef PTRACE_OLDSETOPTIONS
57#define PTRACE_OLDSETOPTIONS 21
58#endif
59
60/*
61 * These are before the system call, so the system call number is RAX
62 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
63 */
64#define REGS_SYSCALL_NR PT_INDEX(RAX)
65#define REGS_SYSCALL_ARG1 PT_INDEX(RDI)
66#define REGS_SYSCALL_ARG2 PT_INDEX(RSI)
67#define REGS_SYSCALL_ARG3 PT_INDEX(RDX)
68#define REGS_SYSCALL_ARG4 PT_INDEX(R10)
69#define REGS_SYSCALL_ARG5 PT_INDEX(R8)
70#define REGS_SYSCALL_ARG6 PT_INDEX(R9)
71
72#define REGS_IP_INDEX PT_INDEX(RIP)
73#define REGS_SP_INDEX PT_INDEX(RSP)
74
75#define FP_SIZE (HOST_FP_SIZE)
76
77#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/sc.h b/arch/um/sys-x86_64/shared/sysdep/sc.h
deleted file mode 100644
index 8aee45b07434..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/sc.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef __SYSDEP_X86_64_SC_H
2#define __SYSDEP_X86_64_SC_H
3
4/* Copyright (C) 2003 - 2004 PathScale, Inc
5 * Released under the GPL
6 */
7
8#include <user_constants.h>
9
10#define SC_OFFSET(sc, field) \
11 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
12
13#define SC_RBX(sc) SC_OFFSET(sc, SC_RBX)
14#define SC_RCX(sc) SC_OFFSET(sc, SC_RCX)
15#define SC_RDX(sc) SC_OFFSET(sc, SC_RDX)
16#define SC_RSI(sc) SC_OFFSET(sc, SC_RSI)
17#define SC_RDI(sc) SC_OFFSET(sc, SC_RDI)
18#define SC_RBP(sc) SC_OFFSET(sc, SC_RBP)
19#define SC_RAX(sc) SC_OFFSET(sc, SC_RAX)
20#define SC_R8(sc) SC_OFFSET(sc, SC_R8)
21#define SC_R9(sc) SC_OFFSET(sc, SC_R9)
22#define SC_R10(sc) SC_OFFSET(sc, SC_R10)
23#define SC_R11(sc) SC_OFFSET(sc, SC_R11)
24#define SC_R12(sc) SC_OFFSET(sc, SC_R12)
25#define SC_R13(sc) SC_OFFSET(sc, SC_R13)
26#define SC_R14(sc) SC_OFFSET(sc, SC_R14)
27#define SC_R15(sc) SC_OFFSET(sc, SC_R15)
28#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
29#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
30#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
31#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
32#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
33#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
34#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
35#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
36#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
37#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
38#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
39#if 0
40#define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX)
41#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
42#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
43#endif
44
45#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/sigcontext.h b/arch/um/sys-x86_64/shared/sysdep/sigcontext.h
deleted file mode 100644
index 0155133b1458..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/sigcontext.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_SIGCONTEXT_H
8#define __SYSDEP_X86_64_SIGCONTEXT_H
9
10#include <sysdep/sc.h>
11
12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
13
14#define GET_FAULTINFO_FROM_SC(fi, sc) \
15 { \
16 (fi).cr2 = SC_CR2(sc); \
17 (fi).error_code = SC_ERR(sc); \
18 (fi).trap_no = SC_TRAPNO(sc); \
19 }
20
21/* This is Page Fault */
22#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
23
24/* No broken SKAS API, which doesn't pass trap_no, here. */
25#define SEGV_MAYBE_FIXABLE(fi) 0
26
27#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h b/arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h
deleted file mode 100644
index 95db4be786e4..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/skas_ptrace.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_X86_64_SKAS_PTRACE_H
7#define __SYSDEP_X86_64_SKAS_PTRACE_H
8
9struct ptrace_faultinfo {
10 int is_write;
11 unsigned long addr;
12};
13
14struct ptrace_ldt {
15 int func;
16 void *ptr;
17 unsigned long bytecount;
18};
19
20#define PTRACE_LDT 54
21
22#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/system.h b/arch/um/sys-x86_64/shared/sysdep/system.h
deleted file mode 100644
index d1b93c436200..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/system.h
+++ /dev/null
@@ -1,132 +0,0 @@
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
20extern unsigned long arch_align_stack(unsigned long sp);
21
22void 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 */
126static 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/sys-x86_64/shared/sysdep/tls.h b/arch/um/sys-x86_64/shared/sysdep/tls.h
deleted file mode 100644
index 18c000d0357a..000000000000
--- a/arch/um/sys-x86_64/shared/sysdep/tls.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _SYSDEP_TLS_H
2#define _SYSDEP_TLS_H
3
4# ifndef __KERNEL__
5
6/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
7 * may be named user_desc (but in 2.4 and in header matching its API was named
8 * modify_ldt_ldt_s). */
9
10typedef struct um_dup_user_desc {
11 unsigned int entry_number;
12 unsigned int base_addr;
13 unsigned int limit;
14 unsigned int seg_32bit:1;
15 unsigned int contents:2;
16 unsigned int read_exec_only:1;
17 unsigned int limit_in_pages:1;
18 unsigned int seg_not_present:1;
19 unsigned int useable:1;
20 unsigned int lm:1;
21} user_desc_t;
22
23# else /* __KERNEL__ */
24
25# include <ldt.h>
26typedef struct user_desc user_desc_t;
27
28# endif /* __KERNEL__ */
29#endif /* _SYSDEP_TLS_H */
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
deleted file mode 100644
index b6b65c7c7a7d..000000000000
--- a/arch/um/sys-x86_64/signal.c
+++ /dev/null
@@ -1,290 +0,0 @@
1/*
2 * Copyright (C) 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#include <linux/personality.h>
8#include <linux/ptrace.h>
9#include <linux/kernel.h>
10#include <asm/unistd.h>
11#include <asm/uaccess.h>
12#include <asm/ucontext.h>
13#include "frame_kern.h"
14#include "skas.h"
15
16void copy_sc(struct uml_pt_regs *regs, void *from)
17{
18 struct sigcontext *sc = from;
19
20#define GETREG(regs, regno, sc, regname) \
21 (regs)->gp[(regno) / sizeof(unsigned long)] = (sc)->regname
22
23 GETREG(regs, R8, sc, r8);
24 GETREG(regs, R9, sc, r9);
25 GETREG(regs, R10, sc, r10);
26 GETREG(regs, R11, sc, r11);
27 GETREG(regs, R12, sc, r12);
28 GETREG(regs, R13, sc, r13);
29 GETREG(regs, R14, sc, r14);
30 GETREG(regs, R15, sc, r15);
31 GETREG(regs, RDI, sc, di);
32 GETREG(regs, RSI, sc, si);
33 GETREG(regs, RBP, sc, bp);
34 GETREG(regs, RBX, sc, bx);
35 GETREG(regs, RDX, sc, dx);
36 GETREG(regs, RAX, sc, ax);
37 GETREG(regs, RCX, sc, cx);
38 GETREG(regs, RSP, sc, sp);
39 GETREG(regs, RIP, sc, ip);
40 GETREG(regs, EFLAGS, sc, flags);
41 GETREG(regs, CS, sc, cs);
42
43#undef GETREG
44}
45
46static int copy_sc_from_user(struct pt_regs *regs,
47 struct sigcontext __user *from,
48 struct _fpstate __user *fpp)
49{
50 struct user_i387_struct fp;
51 int err = 0;
52
53#define GETREG(regs, regno, sc, regname) \
54 __get_user((regs)->regs.gp[(regno) / sizeof(unsigned long)], \
55 &(sc)->regname)
56
57 err |= GETREG(regs, R8, from, r8);
58 err |= GETREG(regs, R9, from, r9);
59 err |= GETREG(regs, R10, from, r10);
60 err |= GETREG(regs, R11, from, r11);
61 err |= GETREG(regs, R12, from, r12);
62 err |= GETREG(regs, R13, from, r13);
63 err |= GETREG(regs, R14, from, r14);
64 err |= GETREG(regs, R15, from, r15);
65 err |= GETREG(regs, RDI, from, di);
66 err |= GETREG(regs, RSI, from, si);
67 err |= GETREG(regs, RBP, from, bp);
68 err |= GETREG(regs, RBX, from, bx);
69 err |= GETREG(regs, RDX, from, dx);
70 err |= GETREG(regs, RAX, from, ax);
71 err |= GETREG(regs, RCX, from, cx);
72 err |= GETREG(regs, RSP, from, sp);
73 err |= GETREG(regs, RIP, from, ip);
74 err |= GETREG(regs, EFLAGS, from, flags);
75 err |= GETREG(regs, CS, from, cs);
76 if (err)
77 return 1;
78
79#undef GETREG
80
81 err = copy_from_user(&fp, fpp, sizeof(struct user_i387_struct));
82 if (err)
83 return 1;
84
85 err = restore_fp_registers(userspace_pid[current_thread_info()->cpu],
86 (unsigned long *) &fp);
87 if (err < 0) {
88 printk(KERN_ERR "copy_sc_from_user - "
89 "restore_fp_registers failed, errno = %d\n",
90 -err);
91 return 1;
92 }
93
94 return 0;
95}
96
97static int copy_sc_to_user(struct sigcontext __user *to,
98 struct _fpstate __user *to_fp, struct pt_regs *regs,
99 unsigned long mask, unsigned long sp)
100{
101 struct faultinfo * fi = &current->thread.arch.faultinfo;
102 struct user_i387_struct fp;
103 int err = 0;
104
105 err |= __put_user(0, &to->gs);
106 err |= __put_user(0, &to->fs);
107
108#define PUTREG(regs, regno, sc, regname) \
109 __put_user((regs)->regs.gp[(regno) / sizeof(unsigned long)], \
110 &(sc)->regname)
111
112 err |= PUTREG(regs, RDI, to, di);
113 err |= PUTREG(regs, RSI, to, si);
114 err |= PUTREG(regs, RBP, to, bp);
115 /*
116 * Must use original RSP, which is passed in, rather than what's in
117 * the pt_regs, because that's already been updated to point at the
118 * signal frame.
119 */
120 err |= __put_user(sp, &to->sp);
121 err |= PUTREG(regs, RBX, to, bx);
122 err |= PUTREG(regs, RDX, to, dx);
123 err |= PUTREG(regs, RCX, to, cx);
124 err |= PUTREG(regs, RAX, to, ax);
125 err |= PUTREG(regs, R8, to, r8);
126 err |= PUTREG(regs, R9, to, r9);
127 err |= PUTREG(regs, R10, to, r10);
128 err |= PUTREG(regs, R11, to, r11);
129 err |= PUTREG(regs, R12, to, r12);
130 err |= PUTREG(regs, R13, to, r13);
131 err |= PUTREG(regs, R14, to, r14);
132 err |= PUTREG(regs, R15, to, r15);
133 err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */
134
135 err |= __put_user(fi->cr2, &to->cr2);
136 err |= __put_user(fi->error_code, &to->err);
137 err |= __put_user(fi->trap_no, &to->trapno);
138
139 err |= PUTREG(regs, RIP, to, ip);
140 err |= PUTREG(regs, EFLAGS, to, flags);
141#undef PUTREG
142
143 err |= __put_user(mask, &to->oldmask);
144 if (err)
145 return 1;
146
147 err = save_fp_registers(userspace_pid[current_thread_info()->cpu],
148 (unsigned long *) &fp);
149 if (err < 0) {
150 printk(KERN_ERR "copy_sc_from_user - restore_fp_registers "
151 "failed, errno = %d\n", -err);
152 return 1;
153 }
154
155 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
156 return 1;
157
158 return err;
159}
160
161struct rt_sigframe
162{
163 char __user *pretcode;
164 struct ucontext uc;
165 struct siginfo info;
166 struct _fpstate fpstate;
167};
168
169int setup_signal_stack_si(unsigned long stack_top, int sig,
170 struct k_sigaction *ka, struct pt_regs * regs,
171 siginfo_t *info, sigset_t *set)
172{
173 struct rt_sigframe __user *frame;
174 unsigned long save_sp = PT_REGS_RSP(regs);
175 int err = 0;
176 struct task_struct *me = current;
177
178 frame = (struct rt_sigframe __user *)
179 round_down(stack_top - sizeof(struct rt_sigframe), 16);
180 /* Subtract 128 for a red zone and 8 for proper alignment */
181 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
182
183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
184 goto out;
185
186 if (ka->sa.sa_flags & SA_SIGINFO) {
187 err |= copy_siginfo_to_user(&frame->info, info);
188 if (err)
189 goto out;
190 }
191
192 /*
193 * Update SP now because the page fault handler refuses to extend
194 * the stack if the faulting address is too far below the current
195 * SP, which frame now certainly is. If there's an error, the original
196 * value is restored on the way out.
197 * When writing the sigcontext to the stack, we have to write the
198 * original value, so that's passed to copy_sc_to_user, which does
199 * the right thing with it.
200 */
201 PT_REGS_RSP(regs) = (unsigned long) frame;
202
203 /* Create the ucontext. */
204 err |= __put_user(0, &frame->uc.uc_flags);
205 err |= __put_user(0, &frame->uc.uc_link);
206 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
207 err |= __put_user(sas_ss_flags(save_sp),
208 &frame->uc.uc_stack.ss_flags);
209 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
210 err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs,
211 set->sig[0], save_sp);
212 err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
213 if (sizeof(*set) == 16) {
214 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
215 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
216 }
217 else
218 err |= __copy_to_user(&frame->uc.uc_sigmask, set,
219 sizeof(*set));
220
221 /*
222 * Set up to return from userspace. If provided, use a stub
223 * already in userspace.
224 */
225 /* x86-64 should always use SA_RESTORER. */
226 if (ka->sa.sa_flags & SA_RESTORER)
227 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
228 else
229 /* could use a vstub here */
230 goto restore_sp;
231
232 if (err)
233 goto restore_sp;
234
235 /* Set up registers for signal handler */
236 {
237 struct exec_domain *ed = current_thread_info()->exec_domain;
238 if (unlikely(ed && ed->signal_invmap && sig < 32))
239 sig = ed->signal_invmap[sig];
240 }
241
242 PT_REGS_RDI(regs) = sig;
243 /* In case the signal handler was declared without prototypes */
244 PT_REGS_RAX(regs) = 0;
245
246 /*
247 * This also works for non SA_SIGINFO handlers because they expect the
248 * next argument after the signal number on the stack.
249 */
250 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
251 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
252 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
253 out:
254 return err;
255
256restore_sp:
257 PT_REGS_RSP(regs) = save_sp;
258 return err;
259}
260
261long sys_rt_sigreturn(struct pt_regs *regs)
262{
263 unsigned long sp = PT_REGS_SP(&current->thread.regs);
264 struct rt_sigframe __user *frame =
265 (struct rt_sigframe __user *)(sp - 8);
266 struct ucontext __user *uc = &frame->uc;
267 sigset_t set;
268
269 if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set)))
270 goto segfault;
271
272 sigdelsetmask(&set, ~_BLOCKABLE);
273
274 spin_lock_irq(&current->sighand->siglock);
275 current->blocked = set;
276 recalc_sigpending();
277 spin_unlock_irq(&current->sighand->siglock);
278
279 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext,
280 &frame->fpstate))
281 goto segfault;
282
283 /* Avoid ERESTART handling */
284 PT_REGS_SYSCALL_NR(&current->thread.regs) = -1;
285 return PT_REGS_SYSCALL_RET(&current->thread.regs);
286
287 segfault:
288 force_sig(SIGSEGV, current);
289 return 0;
290}
diff --git a/arch/um/Makefile-i386 b/arch/x86/Makefile.um
index 302cbe504543..36ddec6a41c9 100644
--- a/arch/um/Makefile-i386
+++ b/arch/x86/Makefile.um
@@ -1,14 +1,11 @@
1core-y += arch/um/sys-i386/ arch/x86/crypto/ 1core-y += arch/x86/crypto/
2
3TOP_ADDR := $(CONFIG_TOP_ADDR)
4 2
3ifeq ($(CONFIG_X86_32),y)
5START := 0x8048000 4START := 0x8048000
6 5
7LDFLAGS += -m elf_i386 6LDFLAGS += -m elf_i386
8ELF_ARCH := $(SUBARCH) 7ELF_ARCH := i386
9ELF_FORMAT := elf32-$(SUBARCH) 8ELF_FORMAT := elf32-i386
10OBJCOPYFLAGS := -O binary -R .note -R .comment -S
11HEADER_ARCH := x86
12CHECKFLAGS += -D__i386__ 9CHECKFLAGS += -D__i386__
13 10
14ifeq ("$(origin SUBARCH)", "command line") 11ifeq ("$(origin SUBARCH)", "command line")
@@ -16,9 +13,8 @@ ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
16KBUILD_CFLAGS += $(call cc-option,-m32) 13KBUILD_CFLAGS += $(call cc-option,-m32)
17KBUILD_AFLAGS += $(call cc-option,-m32) 14KBUILD_AFLAGS += $(call cc-option,-m32)
18LINK-y += $(call cc-option,-m32) 15LINK-y += $(call cc-option,-m32)
19UML_OBJCOPYFLAGS += -F $(ELF_FORMAT)
20 16
21export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS 17export LDFLAGS
22endif 18endif
23endif 19endif
24 20
@@ -40,3 +36,26 @@ KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \
40 else echo $(call cc-option,-funit-at-a-time); fi ;) 36 else echo $(call cc-option,-funit-at-a-time); fi ;)
41 37
42KBUILD_CFLAGS += $(cflags-y) 38KBUILD_CFLAGS += $(cflags-y)
39
40else
41
42START := 0x60000000
43
44KBUILD_CFLAGS += -fno-builtin -m64
45
46CHECKFLAGS += -m64 -D__x86_64__
47KBUILD_AFLAGS += -m64
48LDFLAGS += -m elf_x86_64
49KBUILD_CPPFLAGS += -m64
50
51ELF_ARCH := i386:x86-64
52ELF_FORMAT := elf64-x86-64
53
54# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
55
56LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
57LINK-y += -m64
58
59# Do unit-at-a-time unconditionally on x86_64, following the host
60KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
61endif
diff --git a/arch/um/Kconfig.x86 b/arch/x86/um/Kconfig
index 21bebe63df66..21bebe63df66 100644
--- a/arch/um/Kconfig.x86
+++ b/arch/x86/um/Kconfig
diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile
new file mode 100644
index 000000000000..8fb58400e415
--- /dev/null
+++ b/arch/x86/um/Makefile
@@ -0,0 +1,45 @@
1#
2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3#
4
5ifeq ($(CONFIG_X86_32),y)
6 BITS := 32
7else
8 BITS := 64
9endif
10
11obj-y = bug.o bugs_$(BITS).o delay.o fault.o ksyms.o ldt.o \
12 ptrace_$(BITS).o ptrace_user.o setjmp_$(BITS).o signal.o \
13 stub_$(BITS).o stub_segv.o syscalls_$(BITS).o \
14 sys_call_table_$(BITS).o sysrq_$(BITS).o tls_$(BITS).o \
15 mem_$(BITS).o subarch.o os-$(OS)/
16
17ifeq ($(CONFIG_X86_32),y)
18
19obj-y += checksum_32.o
20obj-$(CONFIG_BINFMT_ELF) += elfcore.o
21
22subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o
23subarch-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += ../lib/rwsem.o
24subarch-$(CONFIG_HIGHMEM) += ../mm/highmem_32.o
25
26else
27
28obj-y += vdso/
29
30subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../lib/thunk_64.o \
31 ../lib/rwsem.o
32
33endif
34
35subarch-$(CONFIG_MODULES) += ../kernel/module.o
36
37USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o
38
39extra-y += user-offsets.s
40$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS)
41
42UNPROFILE_OBJS := stub_segv.o
43CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
44
45include arch/um/scripts/Makefile.rules
diff --git a/arch/um/include/asm/apic.h b/arch/x86/um/asm/apic.h
index 876dee84ab11..876dee84ab11 100644
--- a/arch/um/include/asm/apic.h
+++ b/arch/x86/um/asm/apic.h
diff --git a/arch/um/include/asm/arch_hweight.h b/arch/x86/um/asm/arch_hweight.h
index c656cf443f4a..c656cf443f4a 100644
--- a/arch/um/include/asm/arch_hweight.h
+++ b/arch/x86/um/asm/arch_hweight.h
diff --git a/arch/um/sys-i386/asm/archparam.h b/arch/x86/um/asm/archparam.h
index 2a18a884ca1b..c17cf68dda0f 100644
--- a/arch/um/sys-i386/asm/archparam.h
+++ b/arch/x86/um/asm/archparam.h
@@ -1,10 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Copyright 2003 PathScale, Inc.
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
6#ifndef __UM_ARCHPARAM_I386_H 7#ifndef __UM_ARCHPARAM_H
7#define __UM_ARCHPARAM_I386_H 8#define __UM_ARCHPARAM_H
9
10#ifdef CONFIG_X86_32
8 11
9#ifdef CONFIG_X86_PAE 12#ifdef CONFIG_X86_PAE
10#define LAST_PKMAP 512 13#define LAST_PKMAP 512
@@ -14,3 +17,4 @@
14 17
15#endif 18#endif
16 19
20#endif
diff --git a/arch/x86/um/asm/checksum.h b/arch/x86/um/asm/checksum.h
new file mode 100644
index 000000000000..b6efe2381b5d
--- /dev/null
+++ b/arch/x86/um/asm/checksum.h
@@ -0,0 +1,10 @@
1#ifndef __UM_CHECKSUM_H
2#define __UM_CHECKSUM_H
3
4#ifdef CONFIG_X86_32
5# include "checksum_32.h"
6#else
7# include "checksum_64.h"
8#endif
9
10#endif
diff --git a/arch/um/sys-i386/shared/sysdep/checksum.h b/arch/x86/um/asm/checksum_32.h
index ed47445f3905..caab74252e27 100644
--- a/arch/um/sys-i386/shared/sysdep/checksum.h
+++ b/arch/x86/um/asm/checksum_32.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Licensed under the GPL 2 * Licensed under the GPL
3 */ 3 */
4 4
diff --git a/arch/um/sys-x86_64/shared/sysdep/checksum.h b/arch/x86/um/asm/checksum_64.h
index a5be9031ea85..a5be9031ea85 100644
--- a/arch/um/sys-x86_64/shared/sysdep/checksum.h
+++ b/arch/x86/um/asm/checksum_64.h
diff --git a/arch/um/include/asm/desc.h b/arch/x86/um/asm/desc.h
index 4ec34a51b62c..4ec34a51b62c 100644
--- a/arch/um/include/asm/desc.h
+++ b/arch/x86/um/asm/desc.h
diff --git a/arch/um/sys-x86_64/asm/elf.h b/arch/x86/um/asm/elf.h
index 11a2bfb38859..f3b0633b69a1 100644
--- a/arch/um/sys-x86_64/asm/elf.h
+++ b/arch/x86/um/asm/elf.h
@@ -1,15 +1,103 @@
1/* 1/*
2 * Copyright 2003 PathScale, Inc. 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 *
5 * Licensed under the GPL 3 * Licensed under the GPL
6 */ 4 */
7#ifndef __UM_ELF_X86_64_H 5#ifndef __UM_ELF_X86_H
8#define __UM_ELF_X86_64_H 6#define __UM_ELF_X86_H
9 7
10#include <asm/user.h> 8#include <asm/user.h>
11#include "skas.h" 9#include "skas.h"
12 10
11#ifdef CONFIG_X86_32
12
13#define R_386_NONE 0
14#define R_386_32 1
15#define R_386_PC32 2
16#define R_386_GOT32 3
17#define R_386_PLT32 4
18#define R_386_COPY 5
19#define R_386_GLOB_DAT 6
20#define R_386_JMP_SLOT 7
21#define R_386_RELATIVE 8
22#define R_386_GOTOFF 9
23#define R_386_GOTPC 10
24#define R_386_NUM 11
25
26/*
27 * This is used to ensure we don't load something for the wrong architecture.
28 */
29#define elf_check_arch(x) \
30 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
31
32#define ELF_CLASS ELFCLASS32
33#define ELF_DATA ELFDATA2LSB
34#define ELF_ARCH EM_386
35
36#define ELF_PLAT_INIT(regs, load_addr) do { \
37 PT_REGS_EBX(regs) = 0; \
38 PT_REGS_ECX(regs) = 0; \
39 PT_REGS_EDX(regs) = 0; \
40 PT_REGS_ESI(regs) = 0; \
41 PT_REGS_EDI(regs) = 0; \
42 PT_REGS_EBP(regs) = 0; \
43 PT_REGS_EAX(regs) = 0; \
44} while (0)
45
46/* Shamelessly stolen from include/asm-i386/elf.h */
47
48#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
49 pr_reg[0] = PT_REGS_EBX(regs); \
50 pr_reg[1] = PT_REGS_ECX(regs); \
51 pr_reg[2] = PT_REGS_EDX(regs); \
52 pr_reg[3] = PT_REGS_ESI(regs); \
53 pr_reg[4] = PT_REGS_EDI(regs); \
54 pr_reg[5] = PT_REGS_EBP(regs); \
55 pr_reg[6] = PT_REGS_EAX(regs); \
56 pr_reg[7] = PT_REGS_DS(regs); \
57 pr_reg[8] = PT_REGS_ES(regs); \
58 /* fake once used fs and gs selectors? */ \
59 pr_reg[9] = PT_REGS_DS(regs); \
60 pr_reg[10] = PT_REGS_DS(regs); \
61 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
62 pr_reg[12] = PT_REGS_IP(regs); \
63 pr_reg[13] = PT_REGS_CS(regs); \
64 pr_reg[14] = PT_REGS_EFLAGS(regs); \
65 pr_reg[15] = PT_REGS_SP(regs); \
66 pr_reg[16] = PT_REGS_SS(regs); \
67} while (0);
68
69extern char * elf_aux_platform;
70#define ELF_PLATFORM (elf_aux_platform)
71
72extern unsigned long vsyscall_ehdr;
73extern unsigned long vsyscall_end;
74extern unsigned long __kernel_vsyscall;
75
76/*
77 * This is the range that is readable by user mode, and things
78 * acting like user mode such as get_user_pages.
79 */
80#define FIXADDR_USER_START vsyscall_ehdr
81#define FIXADDR_USER_END vsyscall_end
82
83
84/*
85 * Architecture-neutral AT_ values in 0-17, leave some room
86 * for more of them, start the x86-specific ones at 32.
87 */
88#define AT_SYSINFO 32
89#define AT_SYSINFO_EHDR 33
90
91#define ARCH_DLINFO \
92do { \
93 if ( vsyscall_ehdr ) { \
94 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
95 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
96 } \
97} while (0)
98
99#else
100
13/* x86-64 relocation types, taken from asm-x86_64/elf.h */ 101/* x86-64 relocation types, taken from asm-x86_64/elf.h */
14#define R_X86_64_NONE 0 /* No reloc */ 102#define R_X86_64_NONE 0 /* No reloc */
15#define R_X86_64_64 1 /* Direct 64 bit */ 103#define R_X86_64_64 1 /* Direct 64 bit */
@@ -31,13 +119,6 @@
31 119
32#define R_X86_64_NUM 16 120#define R_X86_64_NUM 16
33 121
34typedef unsigned long elf_greg_t;
35
36#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
37typedef elf_greg_t elf_gregset_t[ELF_NGREG];
38
39typedef struct user_i387_struct elf_fpregset_t;
40
41/* 122/*
42 * This is used to ensure we don't load something for the wrong architecture. 123 * This is used to ensure we don't load something for the wrong architecture.
43 */ 124 */
@@ -95,6 +176,30 @@ typedef struct user_i387_struct elf_fpregset_t;
95 (pr_reg)[25] = 0; \ 176 (pr_reg)[25] = 0; \
96 (pr_reg)[26] = 0; 177 (pr_reg)[26] = 0;
97 178
179#define ELF_PLATFORM "x86_64"
180
181/* No user-accessible fixmap addresses, i.e. vsyscall */
182#define FIXADDR_USER_START 0
183#define FIXADDR_USER_END 0
184
185#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
186struct linux_binprm;
187extern int arch_setup_additional_pages(struct linux_binprm *bprm,
188 int uses_interp);
189
190extern unsigned long um_vdso_addr;
191#define AT_SYSINFO_EHDR 33
192#define ARCH_DLINFO NEW_AUX_ENT(AT_SYSINFO_EHDR, um_vdso_addr)
193
194#endif
195
196typedef unsigned long elf_greg_t;
197
198#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
199typedef elf_greg_t elf_gregset_t[ELF_NGREG];
200
201typedef struct user_i387_struct elf_fpregset_t;
202
98#define task_pt_regs(t) (&(t)->thread.regs) 203#define task_pt_regs(t) (&(t)->thread.regs)
99 204
100struct task_struct; 205struct task_struct;
@@ -103,11 +208,6 @@ extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
103 208
104#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) 209#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
105 210
106#ifdef TIF_IA32 /* XXX */
107#error XXX, indeed
108 clear_thread_flag(TIF_IA32);
109#endif
110
111#define ELF_EXEC_PAGESIZE 4096 211#define ELF_EXEC_PAGESIZE 4096
112 212
113#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) 213#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
@@ -115,18 +215,7 @@ extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
115extern long elf_aux_hwcap; 215extern long elf_aux_hwcap;
116#define ELF_HWCAP (elf_aux_hwcap) 216#define ELF_HWCAP (elf_aux_hwcap)
117 217
118#define ELF_PLATFORM "x86_64"
119
120#define SET_PERSONALITY(ex) do ; while(0) 218#define SET_PERSONALITY(ex) do ; while(0)
121
122#define __HAVE_ARCH_GATE_AREA 1 219#define __HAVE_ARCH_GATE_AREA 1
123#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
124struct linux_binprm;
125extern int arch_setup_additional_pages(struct linux_binprm *bprm,
126 int uses_interp);
127
128extern unsigned long um_vdso_addr;
129#define AT_SYSINFO_EHDR 33
130#define ARCH_DLINFO NEW_AUX_ENT(AT_SYSINFO_EHDR, um_vdso_addr)
131 220
132#endif 221#endif
diff --git a/arch/um/include/asm/irq_vectors.h b/arch/x86/um/asm/irq_vectors.h
index 272a81e0ce14..272a81e0ce14 100644
--- a/arch/um/include/asm/irq_vectors.h
+++ b/arch/x86/um/asm/irq_vectors.h
diff --git a/arch/x86/um/asm/mm_context.h b/arch/x86/um/asm/mm_context.h
new file mode 100644
index 000000000000..4a73d63e4760
--- /dev/null
+++ b/arch/x86/um/asm/mm_context.h
@@ -0,0 +1,72 @@
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 <asm/ldt.h>
13
14extern 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
23struct ldt_entry {
24 __u32 a;
25 __u32 b;
26};
27
28typedef 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#define LDT_entry_a(info) \
38 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
39
40#define LDT_entry_b(info) \
41 (((info)->base_addr & 0xff000000) | \
42 (((info)->base_addr & 0x00ff0000) >> 16) | \
43 ((info)->limit & 0xf0000) | \
44 (((info)->read_exec_only ^ 1) << 9) | \
45 ((info)->contents << 10) | \
46 (((info)->seg_not_present ^ 1) << 15) | \
47 ((info)->seg_32bit << 22) | \
48 ((info)->limit_in_pages << 23) | \
49 ((info)->useable << 20) | \
50 0x7000)
51
52#define _LDT_empty(info) (\
53 (info)->base_addr == 0 && \
54 (info)->limit == 0 && \
55 (info)->contents == 0 && \
56 (info)->read_exec_only == 1 && \
57 (info)->seg_32bit == 0 && \
58 (info)->limit_in_pages == 0 && \
59 (info)->seg_not_present == 1 && \
60 (info)->useable == 0 )
61
62#ifdef CONFIG_X86_64
63#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
64#else
65#define LDT_empty(info) (_LDT_empty(info))
66#endif
67
68struct uml_arch_mm_context {
69 uml_ldt_t ldt;
70};
71
72#endif
diff --git a/arch/x86/um/asm/module.h b/arch/x86/um/asm/module.h
new file mode 100644
index 000000000000..61af80e932eb
--- /dev/null
+++ b/arch/x86/um/asm/module.h
@@ -0,0 +1,23 @@
1#ifndef __UM_MODULE_H
2#define __UM_MODULE_H
3
4/* UML is simple */
5struct mod_arch_specific
6{
7};
8
9#ifdef CONFIG_X86_32
10
11#define Elf_Shdr Elf32_Shdr
12#define Elf_Sym Elf32_Sym
13#define Elf_Ehdr Elf32_Ehdr
14
15#else
16
17#define Elf_Shdr Elf64_Shdr
18#define Elf_Sym Elf64_Sym
19#define Elf_Ehdr Elf64_Ehdr
20
21#endif
22
23#endif
diff --git a/arch/x86/um/asm/processor.h b/arch/x86/um/asm/processor.h
new file mode 100644
index 000000000000..118c143a9cb4
--- /dev/null
+++ b/arch/x86/um/asm/processor.h
@@ -0,0 +1,22 @@
1#ifndef __UM_PROCESSOR_H
2#define __UM_PROCESSOR_H
3
4/* include faultinfo structure */
5#include <sysdep/faultinfo.h>
6
7#ifdef CONFIG_X86_32
8# include "processor_32.h"
9#else
10# include "processor_64.h"
11#endif
12
13#define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP)
14#define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_IP)
15#define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP)
16
17#define ARCH_IS_STACKGROW(address) \
18 (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
19
20#include <asm/processor-generic.h>
21
22#endif
diff --git a/arch/um/sys-i386/asm/processor.h b/arch/x86/um/asm/processor_32.h
index 82a9061ab5be..018f732704dd 100644
--- a/arch/um/sys-i386/asm/processor.h
+++ b/arch/x86/um/asm/processor_32.h
@@ -6,15 +6,12 @@
6#ifndef __UM_PROCESSOR_I386_H 6#ifndef __UM_PROCESSOR_I386_H
7#define __UM_PROCESSOR_I386_H 7#define __UM_PROCESSOR_I386_H
8 8
9#include "linux/string.h" 9#include <linux/string.h>
10#include <sysdep/host_ldt.h> 10#include <asm/segment.h>
11#include "asm/segment.h" 11#include <asm/ldt.h>
12 12
13extern int host_has_cmov; 13extern int host_has_cmov;
14 14
15/* include faultinfo structure */
16#include "sysdep/faultinfo.h"
17
18struct uml_tls_struct { 15struct uml_tls_struct {
19 struct user_desc tls; 16 struct user_desc tls;
20 unsigned flushed:1; 17 unsigned flushed:1;
@@ -66,13 +63,4 @@ static inline void rep_nop(void)
66#define current_text_addr() \ 63#define current_text_addr() \
67 ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) 64 ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
68 65
69#define ARCH_IS_STACKGROW(address) \
70 (address + 32 >= UPT_SP(&current->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 66#endif
diff --git a/arch/um/sys-x86_64/asm/processor.h b/arch/x86/um/asm/processor_64.h
index 875a26a62614..61de92d916c3 100644
--- a/arch/um/sys-x86_64/asm/processor.h
+++ b/arch/x86/um/asm/processor_64.h
@@ -7,9 +7,6 @@
7#ifndef __UM_PROCESSOR_X86_64_H 7#ifndef __UM_PROCESSOR_X86_64_H
8#define __UM_PROCESSOR_X86_64_H 8#define __UM_PROCESSOR_X86_64_H
9 9
10/* include faultinfo structure */
11#include "sysdep/faultinfo.h"
12
13struct arch_thread { 10struct arch_thread {
14 unsigned long debugregs[8]; 11 unsigned long debugregs[8];
15 int debugregs_seq; 12 int debugregs_seq;
@@ -45,12 +42,4 @@ static inline void arch_copy_thread(struct arch_thread *from,
45#define current_text_addr() \ 42#define current_text_addr() \
46 ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) 43 ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; })
47 44
48#define ARCH_IS_STACKGROW(address) \
49 (address + 128 >= UPT_SP(&current->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 45#endif
diff --git a/arch/x86/um/asm/ptrace.h b/arch/x86/um/asm/ptrace.h
new file mode 100644
index 000000000000..c8aca8c501b0
--- /dev/null
+++ b/arch/x86/um/asm/ptrace.h
@@ -0,0 +1,5 @@
1#ifdef CONFIG_X86_32
2# include "ptrace_32.h"
3#else
4# include "ptrace_64.h"
5#endif
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/x86/um/asm/ptrace_32.h
index 5d2a59112537..5d2a59112537 100644
--- a/arch/um/sys-i386/asm/ptrace.h
+++ b/arch/x86/um/asm/ptrace_32.h
diff --git a/arch/um/sys-x86_64/asm/ptrace.h b/arch/x86/um/asm/ptrace_64.h
index 83d8c473b905..706a0d80545c 100644
--- a/arch/um/sys-x86_64/asm/ptrace.h
+++ b/arch/x86/um/asm/ptrace_64.h
@@ -40,7 +40,7 @@
40 40
41#define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs) 41#define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs)
42#define PT_REGS_RIP(r) UPT_IP(&(r)->regs) 42#define PT_REGS_RIP(r) UPT_IP(&(r)->regs)
43#define PT_REGS_RSP(r) UPT_SP(&(r)->regs) 43#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
44 44
45#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) 45#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
46 46
diff --git a/arch/um/include/asm/required-features.h b/arch/x86/um/asm/required-features.h
index dfb967b2d2f3..dfb967b2d2f3 100644
--- a/arch/um/include/asm/required-features.h
+++ b/arch/x86/um/asm/required-features.h
diff --git a/arch/um/include/asm/segment.h b/arch/x86/um/asm/segment.h
index 45183fcd10b6..45183fcd10b6 100644
--- a/arch/um/include/asm/segment.h
+++ b/arch/x86/um/asm/segment.h
diff --git a/arch/um/sys-i386/shared/sysdep/system.h b/arch/x86/um/asm/system.h
index d1b93c436200..a459fd9b7598 100644
--- a/arch/um/sys-i386/shared/sysdep/system.h
+++ b/arch/x86/um/asm/system.h
@@ -129,4 +129,7 @@ static inline void rdtsc_barrier(void)
129 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); 129 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
130} 130}
131 131
132extern void *_switch_to(void *prev, void *next, void *last);
133#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
134
132#endif 135#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/vm-flags.h b/arch/x86/um/asm/vm-flags.h
index 3978e55132d2..7c297e9e2413 100644
--- a/arch/um/sys-x86_64/shared/sysdep/vm-flags.h
+++ b/arch/x86/um/asm/vm-flags.h
@@ -4,8 +4,17 @@
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
6 6
7#ifndef __VM_FLAGS_X86_64_H 7#ifndef __VM_FLAGS_X86_H
8#define __VM_FLAGS_X86_64_H 8#define __VM_FLAGS_X86_H
9
10#ifdef CONFIG_X86_32
11
12#define VM_DATA_DEFAULT_FLAGS \
13 (VM_READ | VM_WRITE | \
14 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
15 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
16
17#else
9 18
10#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 19#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
11 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 20 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
@@ -13,3 +22,4 @@
13 VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 22 VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
14 23
15#endif 24#endif
25#endif
diff --git a/arch/um/sys-x86_64/bug.c b/arch/x86/um/bug.c
index e8034e363d83..e8034e363d83 100644
--- a/arch/um/sys-x86_64/bug.c
+++ b/arch/x86/um/bug.c
diff --git a/arch/um/sys-i386/bugs.c b/arch/x86/um/bugs_32.c
index 2c6d0d731c12..a1fba5fb9dbe 100644
--- a/arch/um/sys-i386/bugs.c
+++ b/arch/x86/um/bugs_32.c
@@ -4,17 +4,17 @@
4 */ 4 */
5 5
6#include <signal.h> 6#include <signal.h>
7#include "kern_constants.h"
8#include "kern_util.h" 7#include "kern_util.h"
9#include "longjmp.h" 8#include "longjmp.h"
10#include "task.h"
11#include "user.h"
12#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include <generated/asm-offsets.h>
13 11
14/* Set during early boot */ 12/* Set during early boot */
15static int host_has_cmov = 1; 13static int host_has_cmov = 1;
16static jmp_buf cmov_test_return; 14static jmp_buf cmov_test_return;
17 15
16#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
17
18static void cmov_sigill_test_handler(int sig) 18static void cmov_sigill_test_handler(int sig)
19{ 19{
20 host_has_cmov = 0; 20 host_has_cmov = 0;
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/x86/um/bugs_64.c
index 44e02ba2a265..44e02ba2a265 100644
--- a/arch/um/sys-x86_64/bugs.c
+++ b/arch/x86/um/bugs_64.c
diff --git a/arch/um/sys-i386/checksum.S b/arch/x86/um/checksum_32.S
index f058d2f82e18..f058d2f82e18 100644
--- a/arch/um/sys-i386/checksum.S
+++ b/arch/x86/um/checksum_32.S
diff --git a/arch/um/sys-i386/delay.c b/arch/x86/um/delay.c
index f3fe1a688f7e..f3fe1a688f7e 100644
--- a/arch/um/sys-i386/delay.c
+++ b/arch/x86/um/delay.c
diff --git a/arch/um/sys-i386/elfcore.c b/arch/x86/um/elfcore.c
index 6bb49b687c97..6bb49b687c97 100644
--- a/arch/um/sys-i386/elfcore.c
+++ b/arch/x86/um/elfcore.c
diff --git a/arch/um/sys-i386/fault.c b/arch/x86/um/fault.c
index d670f68532f4..d670f68532f4 100644
--- a/arch/um/sys-i386/fault.c
+++ b/arch/x86/um/fault.c
diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/x86/um/ksyms.c
index 1db2fce00948..2e8f43ec6214 100644
--- a/arch/um/sys-x86_64/ksyms.c
+++ b/arch/x86/um/ksyms.c
@@ -2,10 +2,12 @@
2#include <asm/string.h> 2#include <asm/string.h>
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4 4
5#ifndef CONFIG_X86_32
5/*XXX: we need them because they would be exported by x86_64 */ 6/*XXX: we need them because they would be exported by x86_64 */
6#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 7#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
7EXPORT_SYMBOL(memcpy); 8EXPORT_SYMBOL(memcpy);
8#else 9#else
9EXPORT_SYMBOL(__memcpy); 10EXPORT_SYMBOL(__memcpy);
10#endif 11#endif
12#endif
11EXPORT_SYMBOL(csum_partial); 13EXPORT_SYMBOL(csum_partial);
diff --git a/arch/um/sys-i386/ldt.c b/arch/x86/um/ldt.c
index 3f2bf208d884..26b0e39d2ce9 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/x86/um/ldt.c
@@ -137,7 +137,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
137{ 137{
138 int i, err = 0; 138 int i, err = 0;
139 unsigned long size; 139 unsigned long size;
140 uml_ldt_t * ldt = &current->mm->context.ldt; 140 uml_ldt_t *ldt = &current->mm->context.arch.ldt;
141 141
142 if (!ldt->entry_count) 142 if (!ldt->entry_count)
143 goto out; 143 goto out;
@@ -205,7 +205,7 @@ static int read_default_ldt(void __user * ptr, unsigned long bytecount)
205 205
206static int write_ldt(void __user * ptr, unsigned long bytecount, int func) 206static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
207{ 207{
208 uml_ldt_t * ldt = &current->mm->context.ldt; 208 uml_ldt_t *ldt = &current->mm->context.arch.ldt;
209 struct mm_id * mm_idp = &current->mm->context.id; 209 struct mm_id * mm_idp = &current->mm->context.id;
210 int i, err; 210 int i, err;
211 struct user_desc ldt_info; 211 struct user_desc ldt_info;
@@ -397,7 +397,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
397 397
398 398
399 if (!ptrace_ldt) 399 if (!ptrace_ldt)
400 mutex_init(&new_mm->ldt.lock); 400 mutex_init(&new_mm->arch.ldt.lock);
401 401
402 if (!from_mm) { 402 if (!from_mm) {
403 memset(&desc, 0, sizeof(desc)); 403 memset(&desc, 0, sizeof(desc));
@@ -429,7 +429,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
429 break; 429 break;
430 } 430 }
431 } 431 }
432 new_mm->ldt.entry_count = 0; 432 new_mm->arch.ldt.entry_count = 0;
433 433
434 goto out; 434 goto out;
435 } 435 }
@@ -457,26 +457,26 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
457 * i.e., we have to use the stub for modify_ldt, which 457 * i.e., we have to use the stub for modify_ldt, which
458 * can't handle the big read buffer of up to 64kB. 458 * can't handle the big read buffer of up to 64kB.
459 */ 459 */
460 mutex_lock(&from_mm->ldt.lock); 460 mutex_lock(&from_mm->arch.ldt.lock);
461 if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES) 461 if (from_mm->arch.ldt.entry_count <= LDT_DIRECT_ENTRIES)
462 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries, 462 memcpy(new_mm->arch.ldt.u.entries, from_mm->arch.ldt.u.entries,
463 sizeof(new_mm->ldt.u.entries)); 463 sizeof(new_mm->arch.ldt.u.entries));
464 else { 464 else {
465 i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 465 i = from_mm->arch.ldt.entry_count / LDT_ENTRIES_PER_PAGE;
466 while (i-->0) { 466 while (i-->0) {
467 page = __get_free_page(GFP_KERNEL|__GFP_ZERO); 467 page = __get_free_page(GFP_KERNEL|__GFP_ZERO);
468 if (!page) { 468 if (!page) {
469 err = -ENOMEM; 469 err = -ENOMEM;
470 break; 470 break;
471 } 471 }
472 new_mm->ldt.u.pages[i] = 472 new_mm->arch.ldt.u.pages[i] =
473 (struct ldt_entry *) page; 473 (struct ldt_entry *) page;
474 memcpy(new_mm->ldt.u.pages[i], 474 memcpy(new_mm->arch.ldt.u.pages[i],
475 from_mm->ldt.u.pages[i], PAGE_SIZE); 475 from_mm->arch.ldt.u.pages[i], PAGE_SIZE);
476 } 476 }
477 } 477 }
478 new_mm->ldt.entry_count = from_mm->ldt.entry_count; 478 new_mm->arch.ldt.entry_count = from_mm->arch.ldt.entry_count;
479 mutex_unlock(&from_mm->ldt.lock); 479 mutex_unlock(&from_mm->arch.ldt.lock);
480 } 480 }
481 481
482 out: 482 out:
@@ -488,12 +488,12 @@ void free_ldt(struct mm_context *mm)
488{ 488{
489 int i; 489 int i;
490 490
491 if (!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES) { 491 if (!ptrace_ldt && mm->arch.ldt.entry_count > LDT_DIRECT_ENTRIES) {
492 i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE; 492 i = mm->arch.ldt.entry_count / LDT_ENTRIES_PER_PAGE;
493 while (i-- > 0) 493 while (i-- > 0)
494 free_page((long) mm->ldt.u.pages[i]); 494 free_page((long) mm->arch.ldt.u.pages[i]);
495 } 495 }
496 mm->ldt.entry_count = 0; 496 mm->arch.ldt.entry_count = 0;
497} 497}
498 498
499int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) 499int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
diff --git a/arch/um/sys-i386/mem.c b/arch/x86/um/mem_32.c
index 639900a6fde9..639900a6fde9 100644
--- a/arch/um/sys-i386/mem.c
+++ b/arch/x86/um/mem_32.c
diff --git a/arch/um/sys-x86_64/mem.c b/arch/x86/um/mem_64.c
index 546518727a73..546518727a73 100644
--- a/arch/um/sys-x86_64/mem.c
+++ b/arch/x86/um/mem_64.c
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/x86/um/os-Linux/Makefile
index b4bc6ac4f30b..253bfb8cb702 100644
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ b/arch/x86/um/os-Linux/Makefile
@@ -3,7 +3,10 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y = registers.o signal.o task_size.o tls.o 6obj-y = registers.o task_size.o mcontext.o
7
8obj-$(CONFIG_X86_32) += tls.o
9obj-$(CONFIG_64BIT) += prctl.o
7 10
8USER_OBJS := $(obj-y) 11USER_OBJS := $(obj-y)
9 12
diff --git a/arch/x86/um/os-Linux/mcontext.c b/arch/x86/um/os-Linux/mcontext.c
new file mode 100644
index 000000000000..1d33d72c6284
--- /dev/null
+++ b/arch/x86/um/os-Linux/mcontext.c
@@ -0,0 +1,31 @@
1#include <sys/ucontext.h>
2#define __FRAME_OFFSETS
3#include <asm/ptrace.h>
4#include <sysdep/ptrace.h>
5
6void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
7{
8#ifdef __i386__
9#define COPY2(X,Y) regs->gp[X] = mc->gregs[REG_##Y]
10#define COPY(X) regs->gp[X] = mc->gregs[REG_##X]
11#define COPY_SEG(X) regs->gp[X] = mc->gregs[REG_##X] & 0xffff;
12#define COPY_SEG_CPL3(X) regs->gp[X] = (mc->gregs[REG_##X] & 0xffff) | 3;
13 COPY_SEG(GS); COPY_SEG(FS); COPY_SEG(ES); COPY_SEG(DS);
14 COPY(EDI); COPY(ESI); COPY(EBP);
15 COPY2(UESP, ESP); /* sic */
16 COPY(EBX); COPY(EDX); COPY(ECX); COPY(EAX);
17 COPY(EIP); COPY_SEG_CPL3(CS); COPY(EFL); COPY_SEG_CPL3(SS);
18#else
19#define COPY2(X,Y) regs->gp[X/sizeof(unsigned long)] = mc->gregs[REG_##Y]
20#define COPY(X) regs->gp[X/sizeof(unsigned long)] = mc->gregs[REG_##X]
21 COPY(R8); COPY(R9); COPY(R10); COPY(R11);
22 COPY(R12); COPY(R13); COPY(R14); COPY(R15);
23 COPY(RDI); COPY(RSI); COPY(RBP); COPY(RBX);
24 COPY(RDX); COPY(RAX); COPY(RCX); COPY(RSP);
25 COPY(RIP);
26 COPY2(EFLAGS, EFL);
27 COPY2(CS, CSGSFS);
28 regs->gp[CS / sizeof(unsigned long)] &= 0xffff;
29 regs->gp[CS / sizeof(unsigned long)] |= 3;
30#endif
31}
diff --git a/arch/um/os-Linux/sys-x86_64/prctl.c b/arch/x86/um/os-Linux/prctl.c
index 9d34eddb517f..9d34eddb517f 100644
--- a/arch/um/os-Linux/sys-x86_64/prctl.c
+++ b/arch/x86/um/os-Linux/prctl.c
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/x86/um/os-Linux/registers.c
index 229f7a53d8da..0cdbb86b012b 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/x86/um/os-Linux/registers.c
@@ -6,10 +6,10 @@
6 6
7#include <errno.h> 7#include <errno.h>
8#include <sys/ptrace.h> 8#include <sys/ptrace.h>
9#ifdef __i386__
9#include <sys/user.h> 10#include <sys/user.h>
10#include "kern_constants.h" 11#endif
11#include "longjmp.h" 12#include "longjmp.h"
12#include "user.h"
13#include "sysdep/ptrace_user.h" 13#include "sysdep/ptrace_user.h"
14 14
15int save_fp_registers(int pid, unsigned long *fp_regs) 15int save_fp_registers(int pid, unsigned long *fp_regs)
@@ -26,6 +26,8 @@ int restore_fp_registers(int pid, unsigned long *fp_regs)
26 return 0; 26 return 0;
27} 27}
28 28
29#ifdef __i386__
30int have_fpx_regs = 1;
29int save_fpx_registers(int pid, unsigned long *fp_regs) 31int save_fpx_registers(int pid, unsigned long *fp_regs)
30{ 32{
31 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) 33 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
@@ -40,24 +42,6 @@ int restore_fpx_registers(int pid, unsigned long *fp_regs)
40 return 0; 42 return 0;
41} 43}
42 44
43unsigned long get_thread_reg(int reg, jmp_buf *buf)
44{
45 switch (reg) {
46 case EIP:
47 return buf[0]->__eip;
48 case UESP:
49 return buf[0]->__esp;
50 case EBP:
51 return buf[0]->__ebp;
52 default:
53 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
54 reg);
55 return 0;
56 }
57}
58
59int have_fpx_regs = 1;
60
61int get_fp_registers(int pid, unsigned long *regs) 45int get_fp_registers(int pid, unsigned long *regs)
62{ 46{
63 if (have_fpx_regs) 47 if (have_fpx_regs)
@@ -89,3 +73,41 @@ void arch_init_registers(int pid)
89 73
90 have_fpx_regs = 0; 74 have_fpx_regs = 0;
91} 75}
76#else
77
78int get_fp_registers(int pid, unsigned long *regs)
79{
80 return save_fp_registers(pid, regs);
81}
82
83int put_fp_registers(int pid, unsigned long *regs)
84{
85 return restore_fp_registers(pid, regs);
86}
87
88#endif
89
90unsigned long get_thread_reg(int reg, jmp_buf *buf)
91{
92 switch (reg) {
93#ifdef __i386__
94 case HOST_IP:
95 return buf[0]->__eip;
96 case HOST_SP:
97 return buf[0]->__esp;
98 case HOST_BP:
99 return buf[0]->__ebp;
100#else
101 case HOST_IP:
102 return buf[0]->__rip;
103 case HOST_SP:
104 return buf[0]->__rsp;
105 case HOST_BP:
106 return buf[0]->__rbp;
107#endif
108 default:
109 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
110 reg);
111 return 0;
112 }
113}
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/x86/um/os-Linux/task_size.c
index be04c1e183bf..efb16c5c9bcf 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/x86/um/os-Linux/task_size.c
@@ -3,7 +3,8 @@
3#include <signal.h> 3#include <signal.h>
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include "longjmp.h" 5#include "longjmp.h"
6#include "kern_constants.h" 6
7#ifdef __i386__
7 8
8static jmp_buf buf; 9static jmp_buf buf;
9 10
@@ -137,3 +138,13 @@ out:
137 138
138 return top; 139 return top;
139} 140}
141
142#else
143
144unsigned long os_get_top_address(void)
145{
146 /* The old value of CONFIG_TOP_ADDR */
147 return 0x7fc0000000;
148}
149
150#endif
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/x86/um/os-Linux/tls.c
index 32ed41ec1a3d..82276b6071af 100644
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ b/arch/x86/um/os-Linux/tls.c
@@ -1,16 +1,25 @@
1#include <errno.h> 1#include <errno.h>
2#include <linux/unistd.h> 2#include <linux/unistd.h>
3 3
4#include <sys/ptrace.h>
4#include <sys/syscall.h> 5#include <sys/syscall.h>
5#include <unistd.h> 6#include <unistd.h>
6 7
7#include "sysdep/tls.h" 8#include "sysdep/tls.h"
8#include "user.h" 9
10#ifndef PTRACE_GET_THREAD_AREA
11#define PTRACE_GET_THREAD_AREA 25
12#endif
13
14#ifndef PTRACE_SET_THREAD_AREA
15#define PTRACE_SET_THREAD_AREA 26
16#endif
9 17
10/* Checks whether host supports TLS, and sets *tls_min according to the value 18/* Checks whether host supports TLS, and sets *tls_min according to the value
11 * valid on the host. 19 * valid on the host.
12 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ 20 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */
13void check_host_supports_tls(int *supports_tls, int *tls_min) { 21void check_host_supports_tls(int *supports_tls, int *tls_min)
22{
14 /* Values for x86 and x86_64.*/ 23 /* Values for x86 and x86_64.*/
15 int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64}; 24 int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64};
16 int i; 25 int i;
@@ -34,3 +43,25 @@ void check_host_supports_tls(int *supports_tls, int *tls_min) {
34 43
35 *supports_tls = 0; 44 *supports_tls = 0;
36} 45}
46
47int os_set_thread_area(user_desc_t *info, int pid)
48{
49 int ret;
50
51 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
52 (unsigned long) info);
53 if (ret < 0)
54 ret = -errno;
55 return ret;
56}
57
58int os_get_thread_area(user_desc_t *info, int pid)
59{
60 int ret;
61
62 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
63 (unsigned long) info);
64 if (ret < 0)
65 ret = -errno;
66 return ret;
67}
diff --git a/arch/um/sys-i386/ptrace.c b/arch/x86/um/ptrace_32.c
index 3375c2717851..3b949daa095c 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/x86/um/ptrace_32.c
@@ -50,20 +50,47 @@ int is_syscall(unsigned long addr)
50/* 1 = access 0 = no access */ 50/* 1 = access 0 = no access */
51#define FLAG_MASK 0x00044dd5 51#define FLAG_MASK 0x00044dd5
52 52
53static const int reg_offsets[] = {
54 [EBX] = HOST_BX,
55 [ECX] = HOST_CX,
56 [EDX] = HOST_DX,
57 [ESI] = HOST_SI,
58 [EDI] = HOST_DI,
59 [EBP] = HOST_BP,
60 [EAX] = HOST_AX,
61 [DS] = HOST_DS,
62 [ES] = HOST_ES,
63 [FS] = HOST_FS,
64 [GS] = HOST_GS,
65 [EIP] = HOST_IP,
66 [CS] = HOST_CS,
67 [EFL] = HOST_EFLAGS,
68 [UESP] = HOST_SP,
69 [SS] = HOST_SS,
70};
71
53int putreg(struct task_struct *child, int regno, unsigned long value) 72int putreg(struct task_struct *child, int regno, unsigned long value)
54{ 73{
55 regno >>= 2; 74 regno >>= 2;
56 switch (regno) { 75 switch (regno) {
76 case EBX:
77 case ECX:
78 case EDX:
79 case ESI:
80 case EDI:
81 case EBP:
82 case EAX:
83 case EIP:
84 case UESP:
85 break;
57 case FS: 86 case FS:
58 if (value && (value & 3) != 3) 87 if (value && (value & 3) != 3)
59 return -EIO; 88 return -EIO;
60 PT_REGS_FS(&child->thread.regs) = value; 89 break;
61 return 0;
62 case GS: 90 case GS:
63 if (value && (value & 3) != 3) 91 if (value && (value & 3) != 3)
64 return -EIO; 92 return -EIO;
65 PT_REGS_GS(&child->thread.regs) = value; 93 break;
66 return 0;
67 case DS: 94 case DS:
68 case ES: 95 case ES:
69 if (value && (value & 3) != 3) 96 if (value && (value & 3) != 3)
@@ -78,10 +105,15 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
78 break; 105 break;
79 case EFL: 106 case EFL:
80 value &= FLAG_MASK; 107 value &= FLAG_MASK;
81 value |= PT_REGS_EFLAGS(&child->thread.regs); 108 child->thread.regs.regs.gp[HOST_EFLAGS] |= value;
82 break; 109 return 0;
110 case ORIG_EAX:
111 child->thread.regs.regs.syscall = value;
112 return 0;
113 default :
114 panic("Bad register in putreg() : %d\n", regno);
83 } 115 }
84 PT_REGS_SET(&child->thread.regs, regno, value); 116 child->thread.regs.regs.gp[reg_offsets[regno]] = value;
85 return 0; 117 return 0;
86} 118}
87 119
@@ -106,22 +138,35 @@ int poke_user(struct task_struct *child, long addr, long data)
106 138
107unsigned long getreg(struct task_struct *child, int regno) 139unsigned long getreg(struct task_struct *child, int regno)
108{ 140{
109 unsigned long retval = ~0UL; 141 unsigned long mask = ~0UL;
110 142
111 regno >>= 2; 143 regno >>= 2;
112 switch (regno) { 144 switch (regno) {
145 case ORIG_EAX:
146 return child->thread.regs.regs.syscall;
113 case FS: 147 case FS:
114 case GS: 148 case GS:
115 case DS: 149 case DS:
116 case ES: 150 case ES:
117 case SS: 151 case SS:
118 case CS: 152 case CS:
119 retval = 0xffff; 153 mask = 0xffff;
120 /* fall through */ 154 break;
155 case EIP:
156 case UESP:
157 case EAX:
158 case EBX:
159 case ECX:
160 case EDX:
161 case ESI:
162 case EDI:
163 case EBP:
164 case EFL:
165 break;
121 default: 166 default:
122 retval &= PT_REG(&child->thread.regs, regno); 167 panic("Bad register in getreg() : %d\n", regno);
123 } 168 }
124 return retval; 169 return mask & child->thread.regs.regs.gp[reg_offsets[regno]];
125} 170}
126 171
127/* read the word at location addr in the USER area. */ 172/* read the word at location addr in the USER area. */
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/x86/um/ptrace_64.c
index 4005506834fd..3b52bf0b418a 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/x86/um/ptrace_64.c
@@ -18,10 +18,39 @@
18 */ 18 */
19#define FLAG_MASK 0x44dd5UL 19#define FLAG_MASK 0x44dd5UL
20 20
21int putreg(struct task_struct *child, int regno, unsigned long value) 21static const int reg_offsets[] =
22{ 22{
23 unsigned long tmp; 23 [R8 >> 3] = HOST_R8,
24 [R9 >> 3] = HOST_R9,
25 [R10 >> 3] = HOST_R10,
26 [R11 >> 3] = HOST_R11,
27 [R12 >> 3] = HOST_R12,
28 [R13 >> 3] = HOST_R13,
29 [R14 >> 3] = HOST_R14,
30 [R15 >> 3] = HOST_R15,
31 [RIP >> 3] = HOST_IP,
32 [RSP >> 3] = HOST_SP,
33 [RAX >> 3] = HOST_AX,
34 [RBX >> 3] = HOST_BX,
35 [RCX >> 3] = HOST_CX,
36 [RDX >> 3] = HOST_DX,
37 [RSI >> 3] = HOST_SI,
38 [RDI >> 3] = HOST_DI,
39 [RBP >> 3] = HOST_BP,
40 [CS >> 3] = HOST_CS,
41 [SS >> 3] = HOST_SS,
42 [FS_BASE >> 3] = HOST_FS_BASE,
43 [GS_BASE >> 3] = HOST_GS_BASE,
44 [DS >> 3] = HOST_DS,
45 [ES >> 3] = HOST_ES,
46 [FS >> 3] = HOST_FS,
47 [GS >> 3] = HOST_GS,
48 [EFLAGS >> 3] = HOST_EFLAGS,
49 [ORIG_RAX >> 3] = HOST_ORIG_AX,
50};
24 51
52int putreg(struct task_struct *child, int regno, unsigned long value)
53{
25#ifdef TIF_IA32 54#ifdef TIF_IA32
26 /* 55 /*
27 * Some code in the 64bit emulation may not be 64bit clean. 56 * Some code in the 64bit emulation may not be 64bit clean.
@@ -31,6 +60,26 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
31 value &= 0xffffffff; 60 value &= 0xffffffff;
32#endif 61#endif
33 switch (regno) { 62 switch (regno) {
63 case R8:
64 case R9:
65 case R10:
66 case R11:
67 case R12:
68 case R13:
69 case R14:
70 case R15:
71 case RIP:
72 case RSP:
73 case RAX:
74 case RBX:
75 case RCX:
76 case RDX:
77 case RSI:
78 case RDI:
79 case RBP:
80 case ORIG_RAX:
81 break;
82
34 case FS: 83 case FS:
35 case GS: 84 case GS:
36 case DS: 85 case DS:
@@ -50,12 +99,14 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
50 99
51 case EFLAGS: 100 case EFLAGS:
52 value &= FLAG_MASK; 101 value &= FLAG_MASK;
53 tmp = PT_REGS_EFLAGS(&child->thread.regs) & ~FLAG_MASK; 102 child->thread.regs.regs.gp[HOST_EFLAGS] |= value;
54 value |= tmp; 103 return 0;
55 break; 104
105 default:
106 panic("Bad register in putreg(): %d\n", regno);
56 } 107 }
57 108
58 PT_REGS_SET(&child->thread.regs, regno, value); 109 child->thread.regs.regs.gp[reg_offsets[regno >> 3]] = value;
59 return 0; 110 return 0;
60} 111}
61 112
@@ -80,24 +131,46 @@ int poke_user(struct task_struct *child, long addr, long data)
80 131
81unsigned long getreg(struct task_struct *child, int regno) 132unsigned long getreg(struct task_struct *child, int regno)
82{ 133{
83 unsigned long retval = ~0UL; 134 unsigned long mask = ~0UL;
135#ifdef TIF_IA32
136 if (test_tsk_thread_flag(child, TIF_IA32))
137 mask = 0xffffffff;
138#endif
84 switch (regno) { 139 switch (regno) {
140 case R8:
141 case R9:
142 case R10:
143 case R11:
144 case R12:
145 case R13:
146 case R14:
147 case R15:
148 case RIP:
149 case RSP:
150 case RAX:
151 case RBX:
152 case RCX:
153 case RDX:
154 case RSI:
155 case RDI:
156 case RBP:
157 case ORIG_RAX:
158 case EFLAGS:
159 case FS_BASE:
160 case GS_BASE:
161 break;
85 case FS: 162 case FS:
86 case GS: 163 case GS:
87 case DS: 164 case DS:
88 case ES: 165 case ES:
89 case SS: 166 case SS:
90 case CS: 167 case CS:
91 retval = 0xffff; 168 mask = 0xffff;
92 /* fall through */ 169 break;
93 default: 170 default:
94 retval &= PT_REG(&child->thread.regs, regno); 171 panic("Bad register in getreg: %d\n", regno);
95#ifdef TIF_IA32
96 if (test_tsk_thread_flag(child, TIF_IA32))
97 retval &= 0xffffffff;
98#endif
99 } 172 }
100 return retval; 173 return mask & child->thread.regs.regs.gp[reg_offsets[regno >> 3]];
101} 174}
102 175
103int peek_user(struct task_struct *child, long addr, long data) 176int peek_user(struct task_struct *child, long addr, long data)
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/x86/um/ptrace_user.c
index 0b10c3e74028..3960ca1dd35a 100644
--- a/arch/um/sys-i386/ptrace_user.c
+++ b/arch/x86/um/ptrace_user.c
@@ -4,7 +4,7 @@
4 */ 4 */
5 5
6#include <errno.h> 6#include <errno.h>
7#include <sys/ptrace.h> 7#include "ptrace_user.h"
8 8
9int ptrace_getregs(long pid, unsigned long *regs_out) 9int ptrace_getregs(long pid, unsigned long *regs_out)
10{ 10{
diff --git a/arch/um/sys-i386/setjmp.S b/arch/x86/um/setjmp_32.S
index b766792c9933..b766792c9933 100644
--- a/arch/um/sys-i386/setjmp.S
+++ b/arch/x86/um/setjmp_32.S
diff --git a/arch/um/sys-x86_64/setjmp.S b/arch/x86/um/setjmp_64.S
index 45f547b4043e..45f547b4043e 100644
--- a/arch/um/sys-x86_64/setjmp.S
+++ b/arch/x86/um/setjmp_64.S
diff --git a/arch/x86/um/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp.h
new file mode 100644
index 000000000000..ff7766d28226
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/archsetjmp.h
@@ -0,0 +1,5 @@
1#ifdef __i386__
2#include "archsetjmp_32.h"
3#else
4#include "archsetjmp_64.h"
5#endif
diff --git a/arch/um/sys-i386/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp_32.h
index 0f312085ce1d..0f312085ce1d 100644
--- a/arch/um/sys-i386/shared/sysdep/archsetjmp.h
+++ b/arch/x86/um/shared/sysdep/archsetjmp_32.h
diff --git a/arch/um/sys-x86_64/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp_64.h
index 2af8f12ca161..2af8f12ca161 100644
--- a/arch/um/sys-x86_64/shared/sysdep/archsetjmp.h
+++ b/arch/x86/um/shared/sysdep/archsetjmp_64.h
diff --git a/arch/x86/um/shared/sysdep/faultinfo.h b/arch/x86/um/shared/sysdep/faultinfo.h
new file mode 100644
index 000000000000..862ecb1c7781
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/faultinfo.h
@@ -0,0 +1,5 @@
1#ifdef __i386__
2#include "faultinfo_32.h"
3#else
4#include "faultinfo_64.h"
5#endif
diff --git a/arch/um/sys-i386/shared/sysdep/faultinfo.h b/arch/x86/um/shared/sysdep/faultinfo_32.h
index db437cc373bc..a26086b8a800 100644
--- a/arch/um/sys-i386/shared/sysdep/faultinfo.h
+++ b/arch/x86/um/shared/sysdep/faultinfo_32.h
@@ -24,6 +24,12 @@ struct faultinfo {
24#define FAULT_WRITE(fi) ((fi).error_code & 2) 24#define FAULT_WRITE(fi) ((fi).error_code & 2)
25#define FAULT_ADDRESS(fi) ((fi).cr2) 25#define FAULT_ADDRESS(fi) ((fi).cr2)
26 26
27/* This is Page Fault */
28#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
29
30/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
31#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
32
27#define PTRACE_FULL_FAULTINFO 0 33#define PTRACE_FULL_FAULTINFO 0
28 34
29#endif 35#endif
diff --git a/arch/um/sys-x86_64/shared/sysdep/faultinfo.h b/arch/x86/um/shared/sysdep/faultinfo_64.h
index cb917b0d5660..f811cbe15d62 100644
--- a/arch/um/sys-x86_64/shared/sysdep/faultinfo.h
+++ b/arch/x86/um/shared/sysdep/faultinfo_64.h
@@ -24,6 +24,12 @@ struct faultinfo {
24#define FAULT_WRITE(fi) ((fi).error_code & 2) 24#define FAULT_WRITE(fi) ((fi).error_code & 2)
25#define FAULT_ADDRESS(fi) ((fi).cr2) 25#define FAULT_ADDRESS(fi) ((fi).cr2)
26 26
27/* This is Page Fault */
28#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
29
30/* No broken SKAS API, which doesn't pass trap_no, here. */
31#define SEGV_MAYBE_FIXABLE(fi) 0
32
27#define PTRACE_FULL_FAULTINFO 1 33#define PTRACE_FULL_FAULTINFO 1
28 34
29#endif 35#endif
diff --git a/arch/um/sys-i386/shared/sysdep/kernel-offsets.h b/arch/x86/um/shared/sysdep/kernel-offsets.h
index 5868526b5eef..5868526b5eef 100644
--- a/arch/um/sys-i386/shared/sysdep/kernel-offsets.h
+++ b/arch/x86/um/shared/sysdep/kernel-offsets.h
diff --git a/arch/x86/um/shared/sysdep/mcontext.h b/arch/x86/um/shared/sysdep/mcontext.h
new file mode 100644
index 000000000000..b724c54da316
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/mcontext.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYS_SIGCONTEXT_X86_H
7#define __SYS_SIGCONTEXT_X86_H
8
9extern void get_regs_from_mc(struct uml_pt_regs *, mcontext_t *);
10
11#ifdef __i386__
12
13#define GET_FAULTINFO_FROM_MC(fi, mc) \
14 { \
15 (fi).cr2 = (mc)->cr2; \
16 (fi).error_code = (mc)->gregs[REG_ERR]; \
17 (fi).trap_no = (mc)->gregs[REG_TRAPNO]; \
18 }
19
20#else
21
22#define GET_FAULTINFO_FROM_MC(fi, mc) \
23 { \
24 (fi).cr2 = (mc)->gregs[REG_CR2]; \
25 (fi).error_code = (mc)->gregs[REG_ERR]; \
26 (fi).trap_no = (mc)->gregs[REG_TRAPNO]; \
27 }
28
29#endif
30
31#endif
diff --git a/arch/x86/um/shared/sysdep/ptrace.h b/arch/x86/um/shared/sysdep/ptrace.h
new file mode 100644
index 000000000000..711b1621747f
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/ptrace.h
@@ -0,0 +1,5 @@
1#ifdef __i386__
2#include "ptrace_32.h"
3#else
4#include "ptrace_64.h"
5#endif
diff --git a/arch/um/sys-i386/shared/sysdep/ptrace.h b/arch/x86/um/shared/sysdep/ptrace_32.h
index c398a5076111..befd1df32ed0 100644
--- a/arch/um/sys-i386/shared/sysdep/ptrace.h
+++ b/arch/x86/um/shared/sysdep/ptrace_32.h
@@ -6,7 +6,7 @@
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 "user_constants.h" 9#include <generated/user_constants.h>
10#include "sysdep/faultinfo.h" 10#include "sysdep/faultinfo.h"
11 11
12#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long)) 12#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
@@ -24,18 +24,16 @@ void set_using_sysemu(int value);
24int get_using_sysemu(void); 24int get_using_sysemu(void);
25extern int sysemu_supported; 25extern int sysemu_supported;
26 26
27#include "skas_ptregs.h"
28
29#define REGS_IP(r) ((r)[HOST_IP]) 27#define REGS_IP(r) ((r)[HOST_IP])
30#define REGS_SP(r) ((r)[HOST_SP]) 28#define REGS_SP(r) ((r)[HOST_SP])
31#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS]) 29#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
32#define REGS_EAX(r) ((r)[HOST_EAX]) 30#define REGS_EAX(r) ((r)[HOST_AX])
33#define REGS_EBX(r) ((r)[HOST_EBX]) 31#define REGS_EBX(r) ((r)[HOST_BX])
34#define REGS_ECX(r) ((r)[HOST_ECX]) 32#define REGS_ECX(r) ((r)[HOST_CX])
35#define REGS_EDX(r) ((r)[HOST_EDX]) 33#define REGS_EDX(r) ((r)[HOST_DX])
36#define REGS_ESI(r) ((r)[HOST_ESI]) 34#define REGS_ESI(r) ((r)[HOST_SI])
37#define REGS_EDI(r) ((r)[HOST_EDI]) 35#define REGS_EDI(r) ((r)[HOST_DI])
38#define REGS_EBP(r) ((r)[HOST_EBP]) 36#define REGS_EBP(r) ((r)[HOST_BP])
39#define REGS_CS(r) ((r)[HOST_CS]) 37#define REGS_CS(r) ((r)[HOST_CS])
40#define REGS_SS(r) ((r)[HOST_SS]) 38#define REGS_SS(r) ((r)[HOST_SS])
41#define REGS_DS(r) ((r)[HOST_DS]) 39#define REGS_DS(r) ((r)[HOST_DS])
@@ -45,6 +43,7 @@ extern int sysemu_supported;
45 43
46#define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res) 44#define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res)
47 45
46#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
48#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r)) 47#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
49 48
50#ifndef PTRACE_SYSEMU_SINGLESTEP 49#ifndef PTRACE_SYSEMU_SINGLESTEP
@@ -102,62 +101,6 @@ struct syscall_args {
102 UPT_SYSCALL_ARG5(r), \ 101 UPT_SYSCALL_ARG5(r), \
103 UPT_SYSCALL_ARG6(r) } } ) 102 UPT_SYSCALL_ARG6(r) } } )
104 103
105#define UPT_REG(regs, reg) \
106 ({ unsigned long val; \
107 switch(reg){ \
108 case EIP: val = UPT_IP(regs); break; \
109 case UESP: val = UPT_SP(regs); break; \
110 case EAX: val = UPT_EAX(regs); break; \
111 case EBX: val = UPT_EBX(regs); break; \
112 case ECX: val = UPT_ECX(regs); break; \
113 case EDX: val = UPT_EDX(regs); break; \
114 case ESI: val = UPT_ESI(regs); break; \
115 case EDI: val = UPT_EDI(regs); break; \
116 case EBP: val = UPT_EBP(regs); break; \
117 case ORIG_EAX: val = UPT_ORIG_EAX(regs); break; \
118 case CS: val = UPT_CS(regs); break; \
119 case SS: val = UPT_SS(regs); break; \
120 case DS: val = UPT_DS(regs); break; \
121 case ES: val = UPT_ES(regs); break; \
122 case FS: val = UPT_FS(regs); break; \
123 case GS: val = UPT_GS(regs); break; \
124 case EFL: val = UPT_EFLAGS(regs); break; \
125 default : \
126 panic("Bad register in UPT_REG : %d\n", reg); \
127 val = -1; \
128 } \
129 val; \
130 })
131
132#define UPT_SET(regs, reg, val) \
133 do { \
134 switch(reg){ \
135 case EIP: UPT_IP(regs) = val; break; \
136 case UESP: UPT_SP(regs) = val; break; \
137 case EAX: UPT_EAX(regs) = val; break; \
138 case EBX: UPT_EBX(regs) = val; break; \
139 case ECX: UPT_ECX(regs) = val; break; \
140 case EDX: UPT_EDX(regs) = val; break; \
141 case ESI: UPT_ESI(regs) = val; break; \
142 case EDI: UPT_EDI(regs) = val; break; \
143 case EBP: UPT_EBP(regs) = val; break; \
144 case ORIG_EAX: UPT_ORIG_EAX(regs) = val; break; \
145 case CS: UPT_CS(regs) = val; break; \
146 case SS: UPT_SS(regs) = val; break; \
147 case DS: UPT_DS(regs) = val; break; \
148 case ES: UPT_ES(regs) = val; break; \
149 case FS: UPT_FS(regs) = val; break; \
150 case GS: UPT_GS(regs) = val; break; \
151 case EFL: UPT_EFLAGS(regs) = val; break; \
152 default : \
153 panic("Bad register in UPT_SET : %d\n", reg); \
154 break; \
155 } \
156 } while (0)
157
158#define UPT_SET_SYSCALL_RETURN(r, res) \
159 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
160
161#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp) 104#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
162 105
163#define UPT_ORIG_SYSCALL(r) UPT_EAX(r) 106#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace.h b/arch/x86/um/shared/sysdep/ptrace_64.h
index 8ee8f8e12af1..031edc53ac57 100644
--- a/arch/um/sys-x86_64/shared/sysdep/ptrace.h
+++ b/arch/x86/um/shared/sysdep/ptrace_64.h
@@ -8,24 +8,22 @@
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 "user_constants.h" 11#include <generated/user_constants.h>
12#include "sysdep/faultinfo.h" 12#include "sysdep/faultinfo.h"
13 13
14#define MAX_REG_OFFSET (UM_FRAME_SIZE) 14#define MAX_REG_OFFSET (UM_FRAME_SIZE)
15#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long)) 15#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
16 16
17#include "skas_ptregs.h"
18
19#define REGS_IP(r) ((r)[HOST_IP]) 17#define REGS_IP(r) ((r)[HOST_IP])
20#define REGS_SP(r) ((r)[HOST_SP]) 18#define REGS_SP(r) ((r)[HOST_SP])
21 19
22#define REGS_RBX(r) ((r)[HOST_RBX]) 20#define REGS_RBX(r) ((r)[HOST_BX])
23#define REGS_RCX(r) ((r)[HOST_RCX]) 21#define REGS_RCX(r) ((r)[HOST_CX])
24#define REGS_RDX(r) ((r)[HOST_RDX]) 22#define REGS_RDX(r) ((r)[HOST_DX])
25#define REGS_RSI(r) ((r)[HOST_RSI]) 23#define REGS_RSI(r) ((r)[HOST_SI])
26#define REGS_RDI(r) ((r)[HOST_RDI]) 24#define REGS_RDI(r) ((r)[HOST_DI])
27#define REGS_RBP(r) ((r)[HOST_RBP]) 25#define REGS_RBP(r) ((r)[HOST_BP])
28#define REGS_RAX(r) ((r)[HOST_RAX]) 26#define REGS_RAX(r) ((r)[HOST_AX])
29#define REGS_R8(r) ((r)[HOST_R8]) 27#define REGS_R8(r) ((r)[HOST_R8])
30#define REGS_R9(r) ((r)[HOST_R9]) 28#define REGS_R9(r) ((r)[HOST_R9])
31#define REGS_R10(r) ((r)[HOST_R10]) 29#define REGS_R10(r) ((r)[HOST_R10])
@@ -67,14 +65,13 @@
67#define REGS_FS(r) ((r)[HOST_FS]) 65#define REGS_FS(r) ((r)[HOST_FS])
68#define REGS_GS(r) ((r)[HOST_GS]) 66#define REGS_GS(r) ((r)[HOST_GS])
69 67
70#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_RAX]) 68#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_AX])
71 69
72#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res) 70#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res)
73 71
72#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
74#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r)) 73#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
75 74
76#define REGS_SEGV_IS_FIXABLE(r) SEGV_IS_FIXABLE((r)->trap_type)
77
78#define REGS_FAULT_ADDR(r) ((r)->fault_addr) 75#define REGS_FAULT_ADDR(r) ((r)->fault_addr)
79 76
80#define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type) 77#define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type)
@@ -149,88 +146,8 @@ struct syscall_args {
149 UPT_SYSCALL_ARG5(r), \ 146 UPT_SYSCALL_ARG5(r), \
150 UPT_SYSCALL_ARG6(r) } } ) 147 UPT_SYSCALL_ARG6(r) } } )
151 148
152#define UPT_REG(regs, reg) \
153 ({ unsigned long val; \
154 switch(reg){ \
155 case R8: val = UPT_R8(regs); break; \
156 case R9: val = UPT_R9(regs); break; \
157 case R10: val = UPT_R10(regs); break; \
158 case R11: val = UPT_R11(regs); break; \
159 case R12: val = UPT_R12(regs); break; \
160 case R13: val = UPT_R13(regs); break; \
161 case R14: val = UPT_R14(regs); break; \
162 case R15: val = UPT_R15(regs); break; \
163 case RIP: val = UPT_IP(regs); break; \
164 case RSP: val = UPT_SP(regs); break; \
165 case RAX: val = UPT_RAX(regs); break; \
166 case RBX: val = UPT_RBX(regs); break; \
167 case RCX: val = UPT_RCX(regs); break; \
168 case RDX: val = UPT_RDX(regs); break; \
169 case RSI: val = UPT_RSI(regs); break; \
170 case RDI: val = UPT_RDI(regs); break; \
171 case RBP: val = UPT_RBP(regs); break; \
172 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \
173 case CS: val = UPT_CS(regs); break; \
174 case SS: val = UPT_SS(regs); break; \
175 case FS_BASE: val = UPT_FS_BASE(regs); break; \
176 case GS_BASE: val = UPT_GS_BASE(regs); break; \
177 case DS: val = UPT_DS(regs); break; \
178 case ES: val = UPT_ES(regs); break; \
179 case FS : val = UPT_FS (regs); break; \
180 case GS: val = UPT_GS(regs); break; \
181 case EFLAGS: val = UPT_EFLAGS(regs); break; \
182 default : \
183 panic("Bad register in UPT_REG : %d\n", reg); \
184 val = -1; \
185 } \
186 val; \
187 })
188
189
190#define UPT_SET(regs, reg, val) \
191 ({ unsigned long __upt_val = val; \
192 switch(reg){ \
193 case R8: UPT_R8(regs) = __upt_val; break; \
194 case R9: UPT_R9(regs) = __upt_val; break; \
195 case R10: UPT_R10(regs) = __upt_val; break; \
196 case R11: UPT_R11(regs) = __upt_val; break; \
197 case R12: UPT_R12(regs) = __upt_val; break; \
198 case R13: UPT_R13(regs) = __upt_val; break; \
199 case R14: UPT_R14(regs) = __upt_val; break; \
200 case R15: UPT_R15(regs) = __upt_val; break; \
201 case RIP: UPT_IP(regs) = __upt_val; break; \
202 case RSP: UPT_SP(regs) = __upt_val; break; \
203 case RAX: UPT_RAX(regs) = __upt_val; break; \
204 case RBX: UPT_RBX(regs) = __upt_val; break; \
205 case RCX: UPT_RCX(regs) = __upt_val; break; \
206 case RDX: UPT_RDX(regs) = __upt_val; break; \
207 case RSI: UPT_RSI(regs) = __upt_val; break; \
208 case RDI: UPT_RDI(regs) = __upt_val; break; \
209 case RBP: UPT_RBP(regs) = __upt_val; break; \
210 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \
211 case CS: UPT_CS(regs) = __upt_val; break; \
212 case SS: UPT_SS(regs) = __upt_val; break; \
213 case FS_BASE: UPT_FS_BASE(regs) = __upt_val; break; \
214 case GS_BASE: UPT_GS_BASE(regs) = __upt_val; break; \
215 case DS: UPT_DS(regs) = __upt_val; break; \
216 case ES: UPT_ES(regs) = __upt_val; break; \
217 case FS: UPT_FS(regs) = __upt_val; break; \
218 case GS: UPT_GS(regs) = __upt_val; break; \
219 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \
220 default : \
221 panic("Bad register in UPT_SET : %d\n", reg); \
222 break; \
223 } \
224 __upt_val; \
225 })
226
227#define UPT_SET_SYSCALL_RETURN(r, res) \
228 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
229
230#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp) 149#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
231 150
232#define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas)
233
234#define UPT_FAULTINFO(r) (&(r)->faultinfo) 151#define UPT_FAULTINFO(r) (&(r)->faultinfo)
235 152
236static inline void arch_init_registers(int pid) 153static inline void arch_init_registers(int pid)
diff --git a/arch/x86/um/shared/sysdep/ptrace_user.h b/arch/x86/um/shared/sysdep/ptrace_user.h
new file mode 100644
index 000000000000..16cd6b5e71f7
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/ptrace_user.h
@@ -0,0 +1,27 @@
1#include <generated/user_constants.h>
2
3#define PT_OFFSET(r) ((r) * sizeof(long))
4
5#define PT_SYSCALL_NR(regs) ((regs)[HOST_ORIG_AX])
6#define PT_SYSCALL_NR_OFFSET PT_OFFSET(HOST_ORIG_AX)
7
8#define PT_SYSCALL_RET_OFFSET PT_OFFSET(HOST_AX)
9
10#define REGS_IP_INDEX HOST_IP
11#define REGS_SP_INDEX HOST_SP
12
13#ifdef __i386__
14#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
15#else
16#define FP_SIZE HOST_FP_SIZE
17
18/*
19 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
20 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
21 * 2.4 name and value for 2.4 host compatibility.
22 */
23#ifndef PTRACE_OLDSETOPTIONS
24#define PTRACE_OLDSETOPTIONS 21
25#endif
26
27#endif
diff --git a/arch/um/sys-i386/shared/sysdep/skas_ptrace.h b/arch/x86/um/shared/sysdep/skas_ptrace.h
index e27b8a791773..453febe98993 100644
--- a/arch/um/sys-i386/shared/sysdep/skas_ptrace.h
+++ b/arch/x86/um/shared/sysdep/skas_ptrace.h
@@ -3,8 +3,8 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __SYSDEP_I386_SKAS_PTRACE_H 6#ifndef __SYSDEP_X86_SKAS_PTRACE_H
7#define __SYSDEP_I386_SKAS_PTRACE_H 7#define __SYSDEP_X86_SKAS_PTRACE_H
8 8
9struct ptrace_faultinfo { 9struct ptrace_faultinfo {
10 int is_write; 10 int is_write;
diff --git a/arch/x86/um/shared/sysdep/stub.h b/arch/x86/um/shared/sysdep/stub.h
new file mode 100644
index 000000000000..bd161e300102
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/stub.h
@@ -0,0 +1,14 @@
1#include <asm/unistd.h>
2#include <sys/mman.h>
3#include <signal.h>
4#include "as-layout.h"
5#include "stub-data.h"
6
7#ifdef __i386__
8#include "stub_32.h"
9#else
10#include "stub_64.h"
11#endif
12
13extern void stub_segv_handler(int, siginfo_t *, void *);
14extern void stub_clone_handler(void);
diff --git a/arch/um/sys-i386/shared/sysdep/stub.h b/arch/x86/um/shared/sysdep/stub_32.h
index 977dedd9221b..51fd256c75f0 100644
--- a/arch/um/sys-i386/shared/sysdep/stub.h
+++ b/arch/x86/um/shared/sysdep/stub_32.h
@@ -6,15 +6,7 @@
6#ifndef __SYSDEP_STUB_H 6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H 7#define __SYSDEP_STUB_H
8 8
9#include <sys/mman.h>
10#include <asm/ptrace.h> 9#include <asm/ptrace.h>
11#include <asm/unistd.h>
12#include "as-layout.h"
13#include "stub-data.h"
14#include "kern_constants.h"
15
16extern void stub_segv_handler(int sig);
17extern void stub_clone_handler(void);
18 10
19#define STUB_SYSCALL_RET EAX 11#define STUB_SYSCALL_RET EAX
20#define STUB_MMAP_NR __NR_mmap2 12#define STUB_MMAP_NR __NR_mmap2
diff --git a/arch/um/sys-x86_64/shared/sysdep/stub.h b/arch/x86/um/shared/sysdep/stub_64.h
index 3432aa249970..994df93c5ed3 100644
--- a/arch/um/sys-x86_64/shared/sysdep/stub.h
+++ b/arch/x86/um/shared/sysdep/stub_64.h
@@ -6,15 +6,7 @@
6#ifndef __SYSDEP_STUB_H 6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H 7#define __SYSDEP_STUB_H
8 8
9#include <sys/mman.h>
10#include <asm/unistd.h>
11#include <sysdep/ptrace_user.h> 9#include <sysdep/ptrace_user.h>
12#include "as-layout.h"
13#include "stub-data.h"
14#include "kern_constants.h"
15
16extern void stub_segv_handler(int sig);
17extern void stub_clone_handler(void);
18 10
19#define STUB_SYSCALL_RET PT_INDEX(RAX) 11#define STUB_SYSCALL_RET PT_INDEX(RAX)
20#define STUB_MMAP_NR __NR_mmap 12#define STUB_MMAP_NR __NR_mmap
diff --git a/arch/x86/um/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls.h
new file mode 100644
index 000000000000..bd9a89b67e41
--- /dev/null
+++ b/arch/x86/um/shared/sysdep/syscalls.h
@@ -0,0 +1,5 @@
1#ifdef __i386__
2#include "syscalls_32.h"
3#else
4#include "syscalls_64.h"
5#endif
diff --git a/arch/um/sys-i386/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls_32.h
index 05cb796aecb5..05cb796aecb5 100644
--- a/arch/um/sys-i386/shared/sysdep/syscalls.h
+++ b/arch/x86/um/shared/sysdep/syscalls_32.h
diff --git a/arch/um/sys-x86_64/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls_64.h
index 7cfb0b085655..8a7d5e1da98e 100644
--- a/arch/um/sys-x86_64/shared/sysdep/syscalls.h
+++ b/arch/x86/um/shared/sysdep/syscalls_64.h
@@ -9,7 +9,6 @@
9 9
10#include <linux/msg.h> 10#include <linux/msg.h>
11#include <linux/shm.h> 11#include <linux/shm.h>
12#include <kern_constants.h>
13 12
14typedef long syscall_handler_t(void); 13typedef long syscall_handler_t(void);
15 14
diff --git a/arch/um/sys-i386/shared/sysdep/tls.h b/arch/x86/um/shared/sysdep/tls.h
index 34550755b2a1..27cce00c6b30 100644
--- a/arch/um/sys-i386/shared/sysdep/tls.h
+++ b/arch/x86/um/shared/sysdep/tls.h
@@ -17,16 +17,23 @@ typedef struct um_dup_user_desc {
17 unsigned int limit_in_pages:1; 17 unsigned int limit_in_pages:1;
18 unsigned int seg_not_present:1; 18 unsigned int seg_not_present:1;
19 unsigned int useable:1; 19 unsigned int useable:1;
20#ifdef __x86_64__
21 unsigned int lm:1;
22#endif
20} user_desc_t; 23} user_desc_t;
21 24
22# else /* __KERNEL__ */ 25# else /* __KERNEL__ */
23 26
24# include <ldt.h>
25typedef struct user_desc user_desc_t; 27typedef struct user_desc user_desc_t;
26 28
27# endif /* __KERNEL__ */ 29# endif /* __KERNEL__ */
28 30
31extern int os_set_thread_area(user_desc_t *info, int pid);
32extern int os_get_thread_area(user_desc_t *info, int pid);
33
34#ifdef __i386__
29#define GDT_ENTRY_TLS_MIN_I386 6 35#define GDT_ENTRY_TLS_MIN_I386 6
30#define GDT_ENTRY_TLS_MIN_X86_64 12 36#define GDT_ENTRY_TLS_MIN_X86_64 12
37#endif
31 38
32#endif /* _SYSDEP_TLS_H */ 39#endif /* _SYSDEP_TLS_H */
diff --git a/arch/um/sys-i386/signal.c b/arch/x86/um/signal.c
index 89a46626bfd8..4883b9546016 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/x86/um/signal.c
@@ -1,36 +1,20 @@
1/* 1/*
2 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 2 * Copyright (C) 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
7
8#include <linux/personality.h>
6#include <linux/ptrace.h> 9#include <linux/ptrace.h>
10#include <linux/kernel.h>
7#include <asm/unistd.h> 11#include <asm/unistd.h>
8#include <asm/uaccess.h> 12#include <asm/uaccess.h>
9#include <asm/ucontext.h> 13#include <asm/ucontext.h>
10#include "frame_kern.h" 14#include "frame_kern.h"
11#include "skas.h" 15#include "skas.h"
12 16
13void copy_sc(struct uml_pt_regs *regs, void *from) 17#ifdef CONFIG_X86_32
14{
15 struct sigcontext *sc = from;
16
17 REGS_GS(regs->gp) = sc->gs;
18 REGS_FS(regs->gp) = sc->fs;
19 REGS_ES(regs->gp) = sc->es;
20 REGS_DS(regs->gp) = sc->ds;
21 REGS_EDI(regs->gp) = sc->di;
22 REGS_ESI(regs->gp) = sc->si;
23 REGS_EBP(regs->gp) = sc->bp;
24 REGS_SP(regs->gp) = sc->sp;
25 REGS_EBX(regs->gp) = sc->bx;
26 REGS_EDX(regs->gp) = sc->dx;
27 REGS_ECX(regs->gp) = sc->cx;
28 REGS_EAX(regs->gp) = sc->ax;
29 REGS_IP(regs->gp) = sc->ip;
30 REGS_CS(regs->gp) = sc->cs;
31 REGS_EFLAGS(regs->gp) = sc->flags;
32 REGS_SS(regs->gp) = sc->ss;
33}
34 18
35/* 19/*
36 * FPU tag word conversions. 20 * FPU tag word conversions.
@@ -164,6 +148,8 @@ static int convert_fxsr_from_user(struct user_fxsr_struct *fxsave,
164 148
165extern int have_fpx_regs; 149extern int have_fpx_regs;
166 150
151#endif
152
167static int copy_sc_from_user(struct pt_regs *regs, 153static int copy_sc_from_user(struct pt_regs *regs,
168 struct sigcontext __user *from) 154 struct sigcontext __user *from)
169{ 155{
@@ -174,8 +160,45 @@ static int copy_sc_from_user(struct pt_regs *regs,
174 if (err) 160 if (err)
175 return err; 161 return err;
176 162
163#define GETREG(regno, regname) regs->regs.gp[HOST_##regno] = sc.regname
164
165#ifdef CONFIG_X86_32
166 GETREG(GS, gs);
167 GETREG(FS, fs);
168 GETREG(ES, es);
169 GETREG(DS, ds);
170#endif
171 GETREG(DI, di);
172 GETREG(SI, si);
173 GETREG(BP, bp);
174 GETREG(SP, sp);
175 GETREG(BX, bx);
176 GETREG(DX, dx);
177 GETREG(CX, cx);
178 GETREG(AX, ax);
179 GETREG(IP, ip);
180
181#ifdef CONFIG_X86_64
182 GETREG(R8, r8);
183 GETREG(R9, r9);
184 GETREG(R10, r10);
185 GETREG(R11, r11);
186 GETREG(R12, r12);
187 GETREG(R13, r13);
188 GETREG(R14, r14);
189 GETREG(R15, r15);
190#endif
191
192 GETREG(CS, cs);
193 GETREG(EFLAGS, flags);
194#ifdef CONFIG_X86_32
195 GETREG(SS, ss);
196#endif
197
198#undef GETREG
199
177 pid = userspace_pid[current_thread_info()->cpu]; 200 pid = userspace_pid[current_thread_info()->cpu];
178 copy_sc(&regs->regs, &sc); 201#ifdef CONFIG_X86_32
179 if (have_fpx_regs) { 202 if (have_fpx_regs) {
180 struct user_fxsr_struct fpx; 203 struct user_fxsr_struct fpx;
181 204
@@ -196,8 +219,9 @@ static int copy_sc_from_user(struct pt_regs *regs,
196 -err); 219 -err);
197 return 1; 220 return 1;
198 } 221 }
199 } 222 } else
200 else { 223#endif
224 {
201 struct user_i387_struct fp; 225 struct user_i387_struct fp;
202 226
203 err = copy_from_user(&fp, sc.fpstate, 227 err = copy_from_user(&fp, sc.fpstate,
@@ -213,43 +237,66 @@ static int copy_sc_from_user(struct pt_regs *regs,
213 return 1; 237 return 1;
214 } 238 }
215 } 239 }
216
217 return 0; 240 return 0;
218} 241}
219 242
220static int copy_sc_to_user(struct sigcontext __user *to, 243static int copy_sc_to_user(struct sigcontext __user *to,
221 struct _fpstate __user *to_fp, struct pt_regs *regs, 244 struct _fpstate __user *to_fp, struct pt_regs *regs,
222 unsigned long sp) 245 unsigned long mask)
223{ 246{
224 struct sigcontext sc; 247 struct sigcontext sc;
225 struct faultinfo * fi = &current->thread.arch.faultinfo; 248 struct faultinfo * fi = &current->thread.arch.faultinfo;
226 int err, pid; 249 int err, pid;
250 memset(&sc, 0, sizeof(struct sigcontext));
251
252#define PUTREG(regno, regname) sc.regname = regs->regs.gp[HOST_##regno]
253
254#ifdef CONFIG_X86_32
255 PUTREG(GS, gs);
256 PUTREG(FS, fs);
257 PUTREG(ES, es);
258 PUTREG(DS, ds);
259#endif
260 PUTREG(DI, di);
261 PUTREG(SI, si);
262 PUTREG(BP, bp);
263 PUTREG(SP, sp);
264 PUTREG(BX, bx);
265 PUTREG(DX, dx);
266 PUTREG(CX, cx);
267 PUTREG(AX, ax);
268#ifdef CONFIG_X86_64
269 PUTREG(R8, r8);
270 PUTREG(R9, r9);
271 PUTREG(R10, r10);
272 PUTREG(R11, r11);
273 PUTREG(R12, r12);
274 PUTREG(R13, r13);
275 PUTREG(R14, r14);
276 PUTREG(R15, r15);
277#endif
227 278
228 sc.gs = REGS_GS(regs->regs.gp);
229 sc.fs = REGS_FS(regs->regs.gp);
230 sc.es = REGS_ES(regs->regs.gp);
231 sc.ds = REGS_DS(regs->regs.gp);
232 sc.di = REGS_EDI(regs->regs.gp);
233 sc.si = REGS_ESI(regs->regs.gp);
234 sc.bp = REGS_EBP(regs->regs.gp);
235 sc.sp = sp;
236 sc.bx = REGS_EBX(regs->regs.gp);
237 sc.dx = REGS_EDX(regs->regs.gp);
238 sc.cx = REGS_ECX(regs->regs.gp);
239 sc.ax = REGS_EAX(regs->regs.gp);
240 sc.ip = REGS_IP(regs->regs.gp);
241 sc.cs = REGS_CS(regs->regs.gp);
242 sc.flags = REGS_EFLAGS(regs->regs.gp);
243 sc.sp_at_signal = regs->regs.gp[UESP];
244 sc.ss = regs->regs.gp[SS];
245 sc.cr2 = fi->cr2; 279 sc.cr2 = fi->cr2;
246 sc.err = fi->error_code; 280 sc.err = fi->error_code;
247 sc.trapno = fi->trap_no; 281 sc.trapno = fi->trap_no;
248 282 PUTREG(IP, ip);
249 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1)); 283 PUTREG(CS, cs);
284 PUTREG(EFLAGS, flags);
285#ifdef CONFIG_X86_32
286 PUTREG(SP, sp_at_signal);
287 PUTREG(SS, ss);
288#endif
289#undef PUTREG
290 sc.oldmask = mask;
250 sc.fpstate = to_fp; 291 sc.fpstate = to_fp;
251 292
293 err = copy_to_user(to, &sc, sizeof(struct sigcontext));
294 if (err)
295 return 1;
296
252 pid = userspace_pid[current_thread_info()->cpu]; 297 pid = userspace_pid[current_thread_info()->cpu];
298
299#ifdef CONFIG_X86_32
253 if (have_fpx_regs) { 300 if (have_fpx_regs) {
254 struct user_fxsr_struct fpx; 301 struct user_fxsr_struct fpx;
255 302
@@ -272,8 +319,9 @@ static int copy_sc_to_user(struct sigcontext __user *to,
272 if (copy_to_user(&to_fp->_fxsr_env[0], &fpx, 319 if (copy_to_user(&to_fp->_fxsr_env[0], &fpx,
273 sizeof(struct user_fxsr_struct))) 320 sizeof(struct user_fxsr_struct)))
274 return 1; 321 return 1;
275 } 322 } else
276 else { 323#endif
324 {
277 struct user_i387_struct fp; 325 struct user_i387_struct fp;
278 326
279 err = save_fp_registers(pid, (unsigned long *) &fp); 327 err = save_fp_registers(pid, (unsigned long *) &fp);
@@ -281,9 +329,10 @@ static int copy_sc_to_user(struct sigcontext __user *to,
281 return 1; 329 return 1;
282 } 330 }
283 331
284 return copy_to_user(to, &sc, sizeof(sc)); 332 return 0;
285} 333}
286 334
335#ifdef CONFIG_X86_32
287static int copy_ucontext_to_user(struct ucontext __user *uc, 336static int copy_ucontext_to_user(struct ucontext __user *uc,
288 struct _fpstate __user *fp, sigset_t *set, 337 struct _fpstate __user *fp, sigset_t *set,
289 unsigned long sp) 338 unsigned long sp)
@@ -293,7 +342,7 @@ static int copy_ucontext_to_user(struct ucontext __user *uc,
293 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp); 342 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp);
294 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags); 343 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags);
295 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size); 344 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size);
296 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs, sp); 345 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs, 0);
297 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set)); 346 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set));
298 return err; 347 return err;
299} 348}
@@ -326,7 +375,6 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
326{ 375{
327 struct sigframe __user *frame; 376 struct sigframe __user *frame;
328 void __user *restorer; 377 void __user *restorer;
329 unsigned long save_sp = PT_REGS_SP(regs);
330 int err = 0; 378 int err = 0;
331 379
332 /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */ 380 /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */
@@ -339,20 +387,9 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
339 if (ka->sa.sa_flags & SA_RESTORER) 387 if (ka->sa.sa_flags & SA_RESTORER)
340 restorer = ka->sa.sa_restorer; 388 restorer = ka->sa.sa_restorer;
341 389
342 /* Update SP now because the page fault handler refuses to extend
343 * the stack if the faulting address is too far below the current
344 * SP, which frame now certainly is. If there's an error, the original
345 * value is restored on the way out.
346 * When writing the sigcontext to the stack, we have to write the
347 * original value, so that's passed to copy_sc_to_user, which does
348 * the right thing with it.
349 */
350 PT_REGS_SP(regs) = (unsigned long) frame;
351
352 err |= __put_user(restorer, &frame->pretcode); 390 err |= __put_user(restorer, &frame->pretcode);
353 err |= __put_user(sig, &frame->sig); 391 err |= __put_user(sig, &frame->sig);
354 err |= copy_sc_to_user(&frame->sc, NULL, regs, save_sp); 392 err |= copy_sc_to_user(&frame->sc, &frame->fpstate, regs, mask->sig[0]);
355 err |= __put_user(mask->sig[0], &frame->sc.oldmask);
356 if (_NSIG_WORDS > 1) 393 if (_NSIG_WORDS > 1)
357 err |= __copy_to_user(&frame->extramask, &mask->sig[1], 394 err |= __copy_to_user(&frame->extramask, &mask->sig[1],
358 sizeof(frame->extramask)); 395 sizeof(frame->extramask));
@@ -369,7 +406,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
369 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); 406 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
370 407
371 if (err) 408 if (err)
372 goto err; 409 return err;
373 410
374 PT_REGS_SP(regs) = (unsigned long) frame; 411 PT_REGS_SP(regs) = (unsigned long) frame;
375 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 412 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -380,10 +417,6 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
380 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 417 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
381 ptrace_notify(SIGTRAP); 418 ptrace_notify(SIGTRAP);
382 return 0; 419 return 0;
383
384err:
385 PT_REGS_SP(regs) = save_sp;
386 return err;
387} 420}
388 421
389int setup_signal_stack_si(unsigned long stack_top, int sig, 422int setup_signal_stack_si(unsigned long stack_top, int sig,
@@ -392,7 +425,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
392{ 425{
393 struct rt_sigframe __user *frame; 426 struct rt_sigframe __user *frame;
394 void __user *restorer; 427 void __user *restorer;
395 unsigned long save_sp = PT_REGS_SP(regs);
396 int err = 0; 428 int err = 0;
397 429
398 stack_top &= -8UL; 430 stack_top &= -8UL;
@@ -404,16 +436,13 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
404 if (ka->sa.sa_flags & SA_RESTORER) 436 if (ka->sa.sa_flags & SA_RESTORER)
405 restorer = ka->sa.sa_restorer; 437 restorer = ka->sa.sa_restorer;
406 438
407 /* See comment above about why this is here */
408 PT_REGS_SP(regs) = (unsigned long) frame;
409
410 err |= __put_user(restorer, &frame->pretcode); 439 err |= __put_user(restorer, &frame->pretcode);
411 err |= __put_user(sig, &frame->sig); 440 err |= __put_user(sig, &frame->sig);
412 err |= __put_user(&frame->info, &frame->pinfo); 441 err |= __put_user(&frame->info, &frame->pinfo);
413 err |= __put_user(&frame->uc, &frame->puc); 442 err |= __put_user(&frame->uc, &frame->puc);
414 err |= copy_siginfo_to_user(&frame->info, info); 443 err |= copy_siginfo_to_user(&frame->info, info);
415 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask, 444 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask,
416 save_sp); 445 PT_REGS_SP(regs));
417 446
418 /* 447 /*
419 * This is movl $,%eax ; int $0x80 448 * This is movl $,%eax ; int $0x80
@@ -427,8 +456,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
427 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); 456 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
428 457
429 if (err) 458 if (err)
430 goto err; 459 return err;
431 460
461 PT_REGS_SP(regs) = (unsigned long) frame;
432 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 462 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
433 PT_REGS_EAX(regs) = (unsigned long) sig; 463 PT_REGS_EAX(regs) = (unsigned long) sig;
434 PT_REGS_EDX(regs) = (unsigned long) &frame->info; 464 PT_REGS_EDX(regs) = (unsigned long) &frame->info;
@@ -437,13 +467,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
437 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 467 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
438 ptrace_notify(SIGTRAP); 468 ptrace_notify(SIGTRAP);
439 return 0; 469 return 0;
440
441err:
442 PT_REGS_SP(regs) = save_sp;
443 return err;
444} 470}
445 471
446long sys_sigreturn(struct pt_regs regs) 472long sys_sigreturn(struct pt_regs *regs)
447{ 473{
448 unsigned long sp = PT_REGS_SP(&current->thread.regs); 474 unsigned long sp = PT_REGS_SP(&current->thread.regs);
449 struct sigframe __user *frame = (struct sigframe __user *)(sp - 8); 475 struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
@@ -458,11 +484,7 @@ long sys_sigreturn(struct pt_regs regs)
458 goto segfault; 484 goto segfault;
459 485
460 sigdelsetmask(&set, ~_BLOCKABLE); 486 sigdelsetmask(&set, ~_BLOCKABLE);
461 487 set_current_blocked(&set);
462 spin_lock_irq(&current->sighand->siglock);
463 current->blocked = set;
464 recalc_sigpending();
465 spin_unlock_irq(&current->sighand->siglock);
466 488
467 if (copy_sc_from_user(&current->thread.regs, sc)) 489 if (copy_sc_from_user(&current->thread.regs, sc))
468 goto segfault; 490 goto segfault;
@@ -476,24 +498,107 @@ long sys_sigreturn(struct pt_regs regs)
476 return 0; 498 return 0;
477} 499}
478 500
479long sys_rt_sigreturn(struct pt_regs regs) 501#else
502
503struct rt_sigframe
504{
505 char __user *pretcode;
506 struct ucontext uc;
507 struct siginfo info;
508 struct _fpstate fpstate;
509};
510
511int setup_signal_stack_si(unsigned long stack_top, int sig,
512 struct k_sigaction *ka, struct pt_regs * regs,
513 siginfo_t *info, sigset_t *set)
514{
515 struct rt_sigframe __user *frame;
516 int err = 0;
517 struct task_struct *me = current;
518
519 frame = (struct rt_sigframe __user *)
520 round_down(stack_top - sizeof(struct rt_sigframe), 16);
521 /* Subtract 128 for a red zone and 8 for proper alignment */
522 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
523
524 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
525 goto out;
526
527 if (ka->sa.sa_flags & SA_SIGINFO) {
528 err |= copy_siginfo_to_user(&frame->info, info);
529 if (err)
530 goto out;
531 }
532
533 /* Create the ucontext. */
534 err |= __put_user(0, &frame->uc.uc_flags);
535 err |= __put_user(0, &frame->uc.uc_link);
536 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
537 err |= __put_user(sas_ss_flags(PT_REGS_SP(regs)),
538 &frame->uc.uc_stack.ss_flags);
539 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
540 err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs,
541 set->sig[0]);
542 err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
543 if (sizeof(*set) == 16) {
544 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
545 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
546 }
547 else
548 err |= __copy_to_user(&frame->uc.uc_sigmask, set,
549 sizeof(*set));
550
551 /*
552 * Set up to return from userspace. If provided, use a stub
553 * already in userspace.
554 */
555 /* x86-64 should always use SA_RESTORER. */
556 if (ka->sa.sa_flags & SA_RESTORER)
557 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
558 else
559 /* could use a vstub here */
560 return err;
561
562 if (err)
563 return err;
564
565 /* Set up registers for signal handler */
566 {
567 struct exec_domain *ed = current_thread_info()->exec_domain;
568 if (unlikely(ed && ed->signal_invmap && sig < 32))
569 sig = ed->signal_invmap[sig];
570 }
571
572 PT_REGS_SP(regs) = (unsigned long) frame;
573 PT_REGS_RDI(regs) = sig;
574 /* In case the signal handler was declared without prototypes */
575 PT_REGS_RAX(regs) = 0;
576
577 /*
578 * This also works for non SA_SIGINFO handlers because they expect the
579 * next argument after the signal number on the stack.
580 */
581 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
582 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
583 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
584 out:
585 return err;
586}
587#endif
588
589long sys_rt_sigreturn(struct pt_regs *regs)
480{ 590{
481 unsigned long sp = PT_REGS_SP(&current->thread.regs); 591 unsigned long sp = PT_REGS_SP(&current->thread.regs);
482 struct rt_sigframe __user *frame = 592 struct rt_sigframe __user *frame =
483 (struct rt_sigframe __user *) (sp - 4); 593 (struct rt_sigframe __user *)(sp - sizeof(long));
484 sigset_t set;
485 struct ucontext __user *uc = &frame->uc; 594 struct ucontext __user *uc = &frame->uc;
486 int sig_size = _NSIG_WORDS * sizeof(unsigned long); 595 sigset_t set;
487 596
488 if (copy_from_user(&set, &uc->uc_sigmask, sig_size)) 597 if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set)))
489 goto segfault; 598 goto segfault;
490 599
491 sigdelsetmask(&set, ~_BLOCKABLE); 600 sigdelsetmask(&set, ~_BLOCKABLE);
492 601 set_current_blocked(&set);
493 spin_lock_irq(&current->sighand->siglock);
494 current->blocked = set;
495 recalc_sigpending();
496 spin_unlock_irq(&current->sighand->siglock);
497 602
498 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext)) 603 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext))
499 goto segfault; 604 goto segfault;
@@ -506,3 +611,14 @@ long sys_rt_sigreturn(struct pt_regs regs)
506 force_sig(SIGSEGV, current); 611 force_sig(SIGSEGV, current);
507 return 0; 612 return 0;
508} 613}
614
615#ifdef CONFIG_X86_32
616long ptregs_sigreturn(void)
617{
618 return sys_sigreturn(NULL);
619}
620long ptregs_rt_sigreturn(void)
621{
622 return sys_rt_sigreturn(NULL);
623}
624#endif
diff --git a/arch/um/sys-i386/stub.S b/arch/x86/um/stub_32.S
index 54a36ec20cb7..54a36ec20cb7 100644
--- a/arch/um/sys-i386/stub.S
+++ b/arch/x86/um/stub_32.S
diff --git a/arch/um/sys-x86_64/stub.S b/arch/x86/um/stub_64.S
index 20e4a96a6dcb..20e4a96a6dcb 100644
--- a/arch/um/sys-x86_64/stub.S
+++ b/arch/x86/um/stub_64.S
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/x86/um/stub_segv.c
index ced051afc705..b7450bd22e7d 100644
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/x86/um/stub_segv.c
@@ -3,19 +3,16 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h>
7#include "as-layout.h"
8#include "sysdep/stub.h" 6#include "sysdep/stub.h"
9#include "sysdep/faultinfo.h" 7#include "sysdep/faultinfo.h"
10#include "sysdep/sigcontext.h" 8#include "sysdep/mcontext.h"
11 9
12void __attribute__ ((__section__ (".__syscall_stub"))) 10void __attribute__ ((__section__ (".__syscall_stub")))
13stub_segv_handler(int sig) 11stub_segv_handler(int sig, siginfo_t *info, void *p)
14{ 12{
15 struct ucontext *uc; 13 struct ucontext *uc = p;
16 14
17 __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); 15 GET_FAULTINFO_FROM_MC(*((struct faultinfo *) STUB_DATA),
18 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA),
19 &uc->uc_mcontext); 16 &uc->uc_mcontext);
20 trap_myself(); 17 trap_myself();
21} 18}
diff --git a/arch/um/sys-i386/sys_call_table.S b/arch/x86/um/sys_call_table_32.S
index de274071455d..a7ca80d2dceb 100644
--- a/arch/um/sys-i386/sys_call_table.S
+++ b/arch/x86/um/sys_call_table_32.S
@@ -13,16 +13,14 @@
13#define ptregs_execve sys_execve 13#define ptregs_execve sys_execve
14#define ptregs_iopl sys_iopl 14#define ptregs_iopl sys_iopl
15#define ptregs_vm86old sys_vm86old 15#define ptregs_vm86old sys_vm86old
16#define ptregs_sigreturn sys_sigreturn
17#define ptregs_clone sys_clone 16#define ptregs_clone sys_clone
18#define ptregs_vm86 sys_vm86 17#define ptregs_vm86 sys_vm86
19#define ptregs_rt_sigreturn sys_rt_sigreturn
20#define ptregs_sigaltstack sys_sigaltstack 18#define ptregs_sigaltstack sys_sigaltstack
21#define ptregs_vfork sys_vfork 19#define ptregs_vfork sys_vfork
22 20
23.section .rodata,"a" 21.section .rodata,"a"
24 22
25#include "../../x86/kernel/syscall_table_32.S" 23#include "../kernel/syscall_table_32.S"
26 24
27ENTRY(syscall_table_size) 25ENTRY(syscall_table_size)
28.long .-sys_call_table 26.long .-sys_call_table
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/x86/um/sys_call_table_64.c
index 47d469e7e7ce..99522f78b162 100644
--- a/arch/um/sys-x86_64/syscall_table.c
+++ b/arch/x86/um/sys_call_table_64.c
@@ -6,7 +6,6 @@
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/sys.h> 7#include <linux/sys.h>
8#include <linux/cache.h> 8#include <linux/cache.h>
9#include <kern_constants.h>
10 9
11#define __NO_STUBS 10#define __NO_STUBS
12 11
@@ -59,7 +58,7 @@ extern void sys_ni_syscall(void);
59 */ 58 */
60 59
61sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 60sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
62#include "../../x86/include/asm/unistd_64.h" 61#include <asm/unistd_64.h>
63}; 62};
64 63
65int syscall_table_size = sizeof(sys_call_table); 64int syscall_table_size = sizeof(sys_call_table);
diff --git a/arch/um/sys-i386/syscalls.c b/arch/x86/um/syscalls_32.c
index 70ca357393b8..70ca357393b8 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/x86/um/syscalls_32.c
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/x86/um/syscalls_64.c
index f3d82bb6e15a..f3d82bb6e15a 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/x86/um/syscalls_64.c
diff --git a/arch/um/sys-i386/sysrq.c b/arch/x86/um/sysrq_32.c
index 171b3e9dc867..171b3e9dc867 100644
--- a/arch/um/sys-i386/sysrq.c
+++ b/arch/x86/um/sysrq_32.c
diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/x86/um/sysrq_64.c
index f4f82beb3508..e8913436d7dc 100644
--- a/arch/um/sys-x86_64/sysrq.c
+++ b/arch/x86/um/sysrq_64.c
@@ -20,7 +20,7 @@ void __show_regs(struct pt_regs *regs)
20 current->comm, print_tainted(), init_utsname()->release); 20 current->comm, print_tainted(), init_utsname()->release);
21 printk(KERN_INFO "RIP: %04lx:[<%016lx>]\n", PT_REGS_CS(regs) & 0xffff, 21 printk(KERN_INFO "RIP: %04lx:[<%016lx>]\n", PT_REGS_CS(regs) & 0xffff,
22 PT_REGS_RIP(regs)); 22 PT_REGS_RIP(regs));
23 printk(KERN_INFO "RSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs), 23 printk(KERN_INFO "RSP: %016lx EFLAGS: %08lx\n", PT_REGS_SP(regs),
24 PT_REGS_EFLAGS(regs)); 24 PT_REGS_EFLAGS(regs));
25 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n", 25 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n",
26 PT_REGS_RAX(regs), PT_REGS_RBX(regs), PT_REGS_RCX(regs)); 26 PT_REGS_RAX(regs), PT_REGS_RBX(regs), PT_REGS_RCX(regs));
diff --git a/arch/um/sys-i386/tls.c b/arch/x86/um/tls_32.c
index c6c7131e563b..c6c7131e563b 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/x86/um/tls_32.c
diff --git a/arch/um/sys-x86_64/tls.c b/arch/x86/um/tls_64.c
index f7ba46200ecd..f7ba46200ecd 100644
--- a/arch/um/sys-x86_64/tls.c
+++ b/arch/x86/um/tls_64.c
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/x86/um/user-offsets.c
index 973585414a66..ca49be8ddd0c 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -9,28 +9,43 @@
9#include <asm/types.h> 9#include <asm/types.h>
10 10
11#define DEFINE(sym, val) \ 11#define DEFINE(sym, val) \
12 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 12 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
13 13
14#define DEFINE_LONGS(sym, val) \ 14#define DEFINE_LONGS(sym, val) \
15 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) 15 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
16
17#define OFFSET(sym, str, mem) \
18 DEFINE(sym, offsetof(struct str, mem));
19 16
20void foo(void) 17void foo(void)
21{ 18{
22 OFFSET(HOST_SC_CR2, sigcontext, cr2); 19#ifdef __i386__
23 OFFSET(HOST_SC_ERR, sigcontext, err); 20 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 21 DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
25 22
23 DEFINE(HOST_IP, EIP);
24 DEFINE(HOST_SP, UESP);
25 DEFINE(HOST_EFLAGS, EFL);
26 DEFINE(HOST_AX, EAX);
27 DEFINE(HOST_BX, EBX);
28 DEFINE(HOST_CX, ECX);
29 DEFINE(HOST_DX, EDX);
30 DEFINE(HOST_SI, ESI);
31 DEFINE(HOST_DI, EDI);
32 DEFINE(HOST_BP, EBP);
33 DEFINE(HOST_CS, CS);
34 DEFINE(HOST_SS, SS);
35 DEFINE(HOST_DS, DS);
36 DEFINE(HOST_FS, FS);
37 DEFINE(HOST_ES, ES);
38 DEFINE(HOST_GS, GS);
39 DEFINE(HOST_ORIG_AX, ORIG_EAX);
40#else
26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 41 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
27 DEFINE_LONGS(HOST_RBX, RBX); 42 DEFINE_LONGS(HOST_BX, RBX);
28 DEFINE_LONGS(HOST_RCX, RCX); 43 DEFINE_LONGS(HOST_CX, RCX);
29 DEFINE_LONGS(HOST_RDI, RDI); 44 DEFINE_LONGS(HOST_DI, RDI);
30 DEFINE_LONGS(HOST_RSI, RSI); 45 DEFINE_LONGS(HOST_SI, RSI);
31 DEFINE_LONGS(HOST_RDX, RDX); 46 DEFINE_LONGS(HOST_DX, RDX);
32 DEFINE_LONGS(HOST_RBP, RBP); 47 DEFINE_LONGS(HOST_BP, RBP);
33 DEFINE_LONGS(HOST_RAX, RAX); 48 DEFINE_LONGS(HOST_AX, RAX);
34 DEFINE_LONGS(HOST_R8, R8); 49 DEFINE_LONGS(HOST_R8, R8);
35 DEFINE_LONGS(HOST_R9, R9); 50 DEFINE_LONGS(HOST_R9, R9);
36 DEFINE_LONGS(HOST_R10, R10); 51 DEFINE_LONGS(HOST_R10, R10);
@@ -39,7 +54,7 @@ void foo(void)
39 DEFINE_LONGS(HOST_R13, R13); 54 DEFINE_LONGS(HOST_R13, R13);
40 DEFINE_LONGS(HOST_R14, R14); 55 DEFINE_LONGS(HOST_R14, R14);
41 DEFINE_LONGS(HOST_R15, R15); 56 DEFINE_LONGS(HOST_R15, R15);
42 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX); 57 DEFINE_LONGS(HOST_ORIG_AX, ORIG_RAX);
43 DEFINE_LONGS(HOST_CS, CS); 58 DEFINE_LONGS(HOST_CS, CS);
44 DEFINE_LONGS(HOST_SS, SS); 59 DEFINE_LONGS(HOST_SS, SS);
45 DEFINE_LONGS(HOST_EFLAGS, EFLAGS); 60 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
@@ -52,9 +67,9 @@ void foo(void)
52 67
53 DEFINE_LONGS(HOST_IP, RIP); 68 DEFINE_LONGS(HOST_IP, RIP);
54 DEFINE_LONGS(HOST_SP, RSP); 69 DEFINE_LONGS(HOST_SP, RSP);
55 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 70#endif
56 71
57 /* XXX Duplicated between i386 and x86_64 */ 72 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
58 DEFINE(UM_POLLIN, POLLIN); 73 DEFINE(UM_POLLIN, POLLIN);
59 DEFINE(UM_POLLPRI, POLLPRI); 74 DEFINE(UM_POLLPRI, POLLPRI);
60 DEFINE(UM_POLLOUT, POLLOUT); 75 DEFINE(UM_POLLOUT, POLLOUT);
diff --git a/arch/um/sys-x86_64/vdso/Makefile b/arch/x86/um/vdso/Makefile
index 5dffe6d46686..6c803ca49b5d 100644
--- a/arch/um/sys-x86_64/vdso/Makefile
+++ b/arch/x86/um/vdso/Makefile
@@ -46,8 +46,8 @@ $(vobjs): KBUILD_CFLAGS += $(CFL)
46# 46#
47# vDSO code runs in userspace and -pg doesn't help with profiling anyway. 47# vDSO code runs in userspace and -pg doesn't help with profiling anyway.
48# 48#
49CFLAGS_REMOVE_vdso-note.o = -pg 49CFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage
50CFLAGS_REMOVE_um_vdso.o = -pg 50CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
51 51
52targets += vdso-syms.lds 52targets += vdso-syms.lds
53obj-$(VDSO64-y) += vdso-syms.lds 53obj-$(VDSO64-y) += vdso-syms.lds
diff --git a/arch/um/sys-x86_64/vdso/checkundef.sh b/arch/x86/um/vdso/checkundef.sh
index 7ee90a9b549d..7ee90a9b549d 100644
--- a/arch/um/sys-x86_64/vdso/checkundef.sh
+++ b/arch/x86/um/vdso/checkundef.sh
diff --git a/arch/um/sys-x86_64/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c
index 7c441b59d375..7c441b59d375 100644
--- a/arch/um/sys-x86_64/vdso/um_vdso.c
+++ b/arch/x86/um/vdso/um_vdso.c
diff --git a/arch/um/sys-x86_64/vdso/vdso-layout.lds.S b/arch/x86/um/vdso/vdso-layout.lds.S
index 634a2cf62046..634a2cf62046 100644
--- a/arch/um/sys-x86_64/vdso/vdso-layout.lds.S
+++ b/arch/x86/um/vdso/vdso-layout.lds.S
diff --git a/arch/um/sys-x86_64/vdso/vdso-note.S b/arch/x86/um/vdso/vdso-note.S
index 79a071e4357e..79a071e4357e 100644
--- a/arch/um/sys-x86_64/vdso/vdso-note.S
+++ b/arch/x86/um/vdso/vdso-note.S
diff --git a/arch/um/sys-x86_64/vdso/vdso.S b/arch/x86/um/vdso/vdso.S
index ec82c1686bd6..1cb468adacbb 100644
--- a/arch/um/sys-x86_64/vdso/vdso.S
+++ b/arch/x86/um/vdso/vdso.S
@@ -4,7 +4,7 @@ __INITDATA
4 4
5 .globl vdso_start, vdso_end 5 .globl vdso_start, vdso_end
6vdso_start: 6vdso_start:
7 .incbin "arch/um/sys-x86_64/vdso/vdso.so" 7 .incbin "arch/x86/um/vdso/vdso.so"
8vdso_end: 8vdso_end:
9 9
10__FINIT 10__FINIT
diff --git a/arch/um/sys-x86_64/vdso/vdso.lds.S b/arch/x86/um/vdso/vdso.lds.S
index b96b2677cad8..b96b2677cad8 100644
--- a/arch/um/sys-x86_64/vdso/vdso.lds.S
+++ b/arch/x86/um/vdso/vdso.lds.S
diff --git a/arch/um/sys-x86_64/vdso/vma.c b/arch/x86/um/vdso/vma.c
index 9495c8d0ce37..91f4ec9a0a56 100644
--- a/arch/um/sys-x86_64/vdso/vma.c
+++ b/arch/x86/um/vdso/vma.c
@@ -28,7 +28,7 @@ static int __init init_vdso(void)
28 28
29 um_vdso_addr = task_size - PAGE_SIZE; 29 um_vdso_addr = task_size - PAGE_SIZE;
30 30
31 vdsop = kmalloc(GFP_KERNEL, sizeof(struct page *)); 31 vdsop = kmalloc(sizeof(struct page *), GFP_KERNEL);
32 if (!vdsop) 32 if (!vdsop)
33 goto oom; 33 goto oom;
34 34
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 423fd56bf612..43643033a3ae 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -298,7 +298,7 @@ if RTC_LIB=n
298config RTC 298config RTC
299 tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)" 299 tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)"
300 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \ 300 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \
301 && !ARM && !SUPERH && !S390 && !AVR32 && !BLACKFIN 301 && !ARM && !SUPERH && !S390 && !AVR32 && !BLACKFIN && !UML
302 ---help--- 302 ---help---
303 If you say Y here and create a character special file /dev/rtc with 303 If you say Y here and create a character special file /dev/rtc with
304 major number 10 and minor number 135 using mknod ("man mknod"), you 304 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -346,7 +346,7 @@ config JS_RTC
346 346
347config GEN_RTC 347config GEN_RTC
348 tristate "Generic /dev/rtc emulation" 348 tristate "Generic /dev/rtc emulation"
349 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32 && !BLACKFIN 349 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32 && !BLACKFIN && !UML
350 ---help--- 350 ---help---
351 If you say Y here and create a character special file /dev/rtc with 351 If you say Y here and create a character special file /dev/rtc with
352 major number 10 and minor number 135 using mknod ("man mknod"), you 352 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -490,7 +490,7 @@ config SCx200_GPIO
490 490
491config PC8736x_GPIO 491config PC8736x_GPIO
492 tristate "NatSemi PC8736x GPIO Support" 492 tristate "NatSemi PC8736x GPIO Support"
493 depends on X86_32 493 depends on X86_32 && !UML
494 default SCx200_GPIO # mostly N 494 default SCx200_GPIO # mostly N
495 select NSC_GPIO # needed for support routines 495 select NSC_GPIO # needed for support routines
496 help 496 help
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index e0135873ba9d..0689bf6b0183 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -235,3 +235,18 @@ config HW_RANDOM_PPC4XX
235 module will be called ppc4xx-rng. 235 module will be called ppc4xx-rng.
236 236
237 If unsure, say N. 237 If unsure, say N.
238
239config UML_RANDOM
240 depends on UML
241 tristate "Hardware random number generator"
242 help
243 This option enables UML's "hardware" random number generator. It
244 attaches itself to the host's /dev/random, supplying as much entropy
245 as the host has, rather than the small amount the UML gets from its
246 own drivers. It registers itself as a standard hardware random number
247 generator, major 10, minor 183, and the canonical device name is
248 /dev/hwrng.
249 The way to make use of this is to install the rng-tools package
250 (check your distro, or download from
251 http://sourceforge.net/projects/gkernel/). rngd periodically reads
252 /dev/hwrng and injects the entropy into /dev/random.
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index a1f68af4ccf4..f22861511909 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -170,7 +170,7 @@ static const struct tty_operations ttyprintk_ops = {
170 .ioctl = tpk_ioctl, 170 .ioctl = tpk_ioctl,
171}; 171};
172 172
173struct tty_port_operations null_ops = { }; 173static struct tty_port_operations null_ops = { };
174 174
175static struct tty_driver *ttyprintk_driver; 175static struct tty_driver *ttyprintk_driver;
176 176
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 23e82e46656d..001b147c7f95 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "Input device support" 5menu "Input device support"
6 depends on !S390 6 depends on !S390 && !UML
7 7
8config INPUT 8config INPUT
9 tristate "Generic input layer (needed for keyboard, mouse, ...)" if EXPERT 9 tristate "Generic input layer (needed for keyboard, mouse, ...)" if EXPERT
diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 4fb601670de3..a233ed53913a 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -5,7 +5,7 @@
5menuconfig ISDN 5menuconfig ISDN
6 bool "ISDN support" 6 bool "ISDN support"
7 depends on NET 7 depends on NET
8 depends on !S390 8 depends on !S390 && !UML
9 ---help--- 9 ---help---
10 ISDN ("Integrated Services Digital Network", called RNIS in France) 10 ISDN ("Integrated Services Digital Network", called RNIS in France)
11 is a fully digital telephone service that can be used for voice and 11 is a fully digital telephone service that can be used for voice and
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index 073548836413..09602241901b 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -1,6 +1,6 @@
1menuconfig ATH_COMMON 1menuconfig ATH_COMMON
2 tristate "Atheros Wireless Cards" 2 tristate "Atheros Wireless Cards"
3 depends on CFG80211 3 depends on CFG80211 && (!UML || BROKEN)
4 ---help--- 4 ---help---
5 This will enable the support for the Atheros wireless drivers. 5 This will enable the support for the Atheros wireless drivers.
6 ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option 6 ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig
index 45e14760c16e..d6c42e69bdbd 100644
--- a/drivers/net/wireless/rtlwifi/Kconfig
+++ b/drivers/net/wireless/rtlwifi/Kconfig
@@ -12,7 +12,7 @@ config RTL8192CE
12 12
13config RTL8192SE 13config RTL8192SE
14 tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" 14 tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter"
15 depends on MAC80211 && EXPERIMENTAL 15 depends on MAC80211 && EXPERIMENTAL && PCI
16 select FW_LOADER 16 select FW_LOADER
17 select RTLWIFI 17 select RTLWIFI
18 ---help--- 18 ---help---
@@ -23,7 +23,7 @@ config RTL8192SE
23 23
24config RTL8192DE 24config RTL8192DE
25 tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" 25 tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter"
26 depends on MAC80211 && EXPERIMENTAL 26 depends on MAC80211 && EXPERIMENTAL && PCI
27 select FW_LOADER 27 select FW_LOADER
28 select RTLWIFI 28 select RTLWIFI
29 ---help--- 29 ---help---
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 57de051a74b3..9f88641e67f9 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -70,6 +70,7 @@ config BATTERY_DS2760
70 70
71config BATTERY_DS2780 71config BATTERY_DS2780
72 tristate "DS2780 battery driver" 72 tristate "DS2780 battery driver"
73 depends on HAS_IOMEM
73 select W1 74 select W1
74 select W1_SLAVE_DS2780 75 select W1_SLAVE_DS2780
75 help 76 help
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5a538fc1cc85..53eb4e55b289 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -8,7 +8,7 @@ config RTC_LIB
8menuconfig RTC_CLASS 8menuconfig RTC_CLASS
9 bool "Real Time Clock" 9 bool "Real Time Clock"
10 default n 10 default n
11 depends on !S390 11 depends on !S390 && !UML
12 select RTC_LIB 12 select RTC_LIB
13 help 13 help
14 Generic RTC class support. If you say yes here, you will 14 Generic RTC class support. If you say yes here, you will
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 8816f53e004d..b3d17416d86a 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -1,6 +1,6 @@
1config VT 1config VT
2 bool "Virtual terminal" if EXPERT 2 bool "Virtual terminal" if EXPERT
3 depends on !S390 3 depends on !S390 && !UML
4 select INPUT 4 select INPUT
5 default y 5 default y
6 ---help--- 6 ---help---
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 86b0735e6aa0..64c6752ea2c6 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -726,7 +726,7 @@ config SBC8360_WDT
726 726
727config SBC7240_WDT 727config SBC7240_WDT
728 tristate "SBC Nano 7240 Watchdog Timer" 728 tristate "SBC Nano 7240 Watchdog Timer"
729 depends on X86_32 729 depends on X86_32 && !UML
730 ---help--- 730 ---help---
731 This is the driver for the hardware watchdog found on the IEI 731 This is the driver for the hardware watchdog found on the IEI
732 single board computers EPIC Nano 7240 (and likely others). This 732 single board computers EPIC Nano 7240 (and likely others). This
@@ -1174,6 +1174,10 @@ config XEN_WDT
1174 by Xen 4.0 and newer. The watchdog timeout period is normally one 1174 by Xen 4.0 and newer. The watchdog timeout period is normally one
1175 minute but can be changed with a boot-time parameter. 1175 minute but can be changed with a boot-time parameter.
1176 1176
1177config UML_WATCHDOG
1178 tristate "UML watchdog"
1179 depends on UML
1180
1177# 1181#
1178# ISA-based Watchdog Cards 1182# ISA-based Watchdog Cards
1179# 1183#
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index d51a98384bc0..dd7bc38a3825 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -16,7 +16,6 @@
16#include <sys/vfs.h> 16#include <sys/vfs.h>
17#include "hostfs.h" 17#include "hostfs.h"
18#include "os.h" 18#include "os.h"
19#include "user.h"
20#include <utime.h> 19#include <utime.h>
21 20
22static void stat64_to_hostfs(const struct stat64 *buf, struct hostfs_stat *p) 21static void stat64_to_hostfs(const struct stat64 *buf, struct hostfs_stat *p)
diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
index 19c053b82303..4f554f20dc97 100644
--- a/security/integrity/ima/Kconfig
+++ b/security/integrity/ima/Kconfig
@@ -9,7 +9,7 @@ config IMA
9 select CRYPTO_HMAC 9 select CRYPTO_HMAC
10 select CRYPTO_MD5 10 select CRYPTO_MD5
11 select CRYPTO_SHA1 11 select CRYPTO_SHA1
12 select TCG_TPM if !S390 12 select TCG_TPM if !S390 && !UML
13 select TCG_TIS if TCG_TPM 13 select TCG_TIS if TCG_TPM
14 help 14 help
15 The Trusted Computing Group(TCG) runtime Integrity 15 The Trusted Computing Group(TCG) runtime Integrity
diff --git a/sound/Kconfig b/sound/Kconfig
index 1fef141ef8e7..261a03c8a209 100644
--- a/sound/Kconfig
+++ b/sound/Kconfig
@@ -59,7 +59,7 @@ config SOUND_OSS_CORE_PRECLAIM
59 59
60source "sound/oss/dmasound/Kconfig" 60source "sound/oss/dmasound/Kconfig"
61 61
62if !M68K 62if !M68K && !UML
63 63
64menuconfig SND 64menuconfig SND
65 tristate "Advanced Linux Sound Architecture" 65 tristate "Advanced Linux Sound Architecture"