diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2011-08-18 20:06:39 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2011-11-02 14:15:05 +0100 |
commit | 5c48b108ecbf6505d929e64d50dace13ac2bdf34 (patch) | |
tree | 016904f84fbe05aa301c5cdfe712d90f6bb828fe /arch/um | |
parent | 7bbe7204e93734fe79d8aac3e08a7cb4624b5004 (diff) |
um: take arch/um/sys-x86 to arch/x86/um
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
93 files changed, 14 insertions, 6775 deletions
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86 deleted file mode 100644 index 21bebe63df6..00000000000 --- a/arch/um/Kconfig.x86 +++ /dev/null @@ -1,70 +0,0 @@ -mainmenu "User Mode Linux/$SUBARCH $KERNELVERSION Kernel Configuration" - -source "arch/um/Kconfig.common" - -menu "UML-specific options" - -menu "Host processor type and features" - -config CMPXCHG_LOCAL - bool - default n - -config CMPXCHG_DOUBLE - bool - default n - -source "arch/x86/Kconfig.cpu" - -endmenu - -config UML_X86 - def_bool y - select GENERIC_FIND_FIRST_BIT - -config 64BIT - bool - default SUBARCH = "x86_64" - -config X86_32 - def_bool !64BIT - select HAVE_AOUT - -config X86_64 - def_bool 64BIT - -config RWSEM_XCHGADD_ALGORITHM - def_bool X86_XADD && 64BIT - -config RWSEM_GENERIC_SPINLOCK - def_bool !RWSEM_XCHGADD_ALGORITHM - -config 3_LEVEL_PGTABLES - bool "Three-level pagetables (EXPERIMENTAL)" if !64BIT - default 64BIT - depends on EXPERIMENTAL - help - Three-level pagetables will let UML have more than 4G of physical - memory. All the memory that can't be mapped directly will be treated - as high memory. - - However, this it experimental on 32-bit architectures, so if unsure say - N (on x86-64 it's automatically enabled, instead, as it's safe there). - -config ARCH_HAS_SC_SIGNALS - def_bool !64BIT - -config ARCH_REUSE_HOST_VSYSCALL_AREA - def_bool !64BIT - -config SMP_BROKEN - def_bool 64BIT - -config GENERIC_HWEIGHT - def_bool y - -source "arch/um/Kconfig.um" - -endmenu - -source "arch/um/Kconfig.rest" diff --git a/arch/um/Makefile b/arch/um/Makefile index 7492ee5837c..7730af6ec13 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -30,13 +30,17 @@ ifeq ($(SUBARCH),x86_64) HEADER_ARCH := x86 endif +HOST_DIR := arch/$(HEADER_ARCH) + include $(srctree)/$(ARCH_DIR)/Makefile-skas -include $(srctree)/$(ARCH_DIR)/Makefile-$(HEADER_ARCH) +include $(srctree)/$(HOST_DIR)/Makefile.um + +core-y += $(HOST_DIR)/um/ SHARED_HEADERS := $(ARCH_DIR)/include/shared ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS) -ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(HEADER_ARCH)/shared -KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(HEADER_ARCH) +ARCH_INCLUDE += -I$(srctree)/$(HOST_DIR)/um/shared +KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um # -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so # named - it's a common symbol in libpcap, so we get a binary which crashes. @@ -60,7 +64,7 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ #This will adjust *FLAGS accordingly to the platform. include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) -KBUILD_CPPFLAGS += -I$(srctree)/arch/$(HEADER_ARCH)/include +KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include # -Derrno=kernel_errno - This turns all kernel references to errno into # kernel_errno to separate them from the libc errno. This allows -fno-common @@ -90,7 +94,7 @@ define archhelp echo ' find in the kernel root.' endef -KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) +KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig archprepare: include/generated/user_constants.h @@ -131,8 +135,8 @@ archclean: # Generated files -$(ARCH_DIR)/sys-$(HEADER_ARCH)/user-offsets.s: FORCE - $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(HEADER_ARCH) $@ +$(HOST_DIR)/um/user-offsets.s: FORCE + $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@ define filechk_gen-asm-offsets (set -e; \ @@ -147,7 +151,7 @@ define filechk_gen-asm-offsets echo ""; ) endef -include/generated/user_constants.h: $(ARCH_DIR)/sys-$(HEADER_ARCH)/user-offsets.s +include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s $(call filechk,gen-asm-offsets) -export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH +export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH diff --git a/arch/um/Makefile-x86 b/arch/um/Makefile-x86 deleted file mode 100644 index 68fbd1b7c9f..00000000000 --- a/arch/um/Makefile-x86 +++ /dev/null @@ -1,61 +0,0 @@ -core-y += arch/um/sys-x86/ arch/x86/crypto/ - -ifeq ($(CONFIG_X86_32),y) -START := 0x8048000 - -LDFLAGS += -m elf_i386 -ELF_ARCH := i386 -ELF_FORMAT := elf32-i386 -CHECKFLAGS += -D__i386__ - -ifeq ("$(origin SUBARCH)", "command line") -ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") -KBUILD_CFLAGS += $(call cc-option,-m32) -KBUILD_AFLAGS += $(call cc-option,-m32) -LINK-y += $(call cc-option,-m32) - -export LDFLAGS -endif -endif - -# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. -include $(srctree)/arch/x86/Makefile_32.cpu - -# prevent gcc from keeping the stack 16 byte aligned. Taken from i386. -cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) - -# Prevent sprintf in nfsd from being converted to strcpy and resulting in -# an unresolved reference. -cflags-y += -ffreestanding - -# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use -# a lot more stack due to the lack of sharing of stacklots. Also, gcc -# 4.3.0 needs -funit-at-a-time for extern inline functions. -KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \ - echo $(call cc-option,-fno-unit-at-a-time); \ - else echo $(call cc-option,-funit-at-a-time); fi ;) - -KBUILD_CFLAGS += $(cflags-y) - -else - -START := 0x60000000 - -KBUILD_CFLAGS += -fno-builtin -m64 - -CHECKFLAGS += -m64 -D__x86_64__ -KBUILD_AFLAGS += -m64 -LDFLAGS += -m elf_x86_64 -KBUILD_CPPFLAGS += -m64 - -ELF_ARCH := i386:x86-64 -ELF_FORMAT := elf64-x86-64 - -# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. - -LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 -LINK-y += -m64 - -# Do unit-at-a-time unconditionally on x86_64, following the host -KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) -endif diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index 7879e76e998..015d0005766 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile @@ -5,7 +5,7 @@ obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ registers.o sigio.o signal.o start_up.o time.o tty.o \ - umid.o tls.o user_syms.o util.o drivers/ sys-$(HEADER_ARCH)/ skas/ + umid.o tls.o user_syms.o util.o drivers/ skas/ obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o diff --git a/arch/um/os-Linux/sys-x86/Makefile b/arch/um/os-Linux/sys-x86/Makefile deleted file mode 100644 index 253bfb8cb70..00000000000 --- a/arch/um/os-Linux/sys-x86/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) -# Licensed under the GPL -# - -obj-y = registers.o task_size.o mcontext.o - -obj-$(CONFIG_X86_32) += tls.o -obj-$(CONFIG_64BIT) += prctl.o - -USER_OBJS := $(obj-y) - -include arch/um/scripts/Makefile.rules diff --git a/arch/um/os-Linux/sys-x86/mcontext.c b/arch/um/os-Linux/sys-x86/mcontext.c deleted file mode 100644 index 1d33d72c628..00000000000 --- a/arch/um/os-Linux/sys-x86/mcontext.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <sys/ucontext.h> -#define __FRAME_OFFSETS -#include <asm/ptrace.h> -#include <sysdep/ptrace.h> - -void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc) -{ -#ifdef __i386__ -#define COPY2(X,Y) regs->gp[X] = mc->gregs[REG_##Y] -#define COPY(X) regs->gp[X] = mc->gregs[REG_##X] -#define COPY_SEG(X) regs->gp[X] = mc->gregs[REG_##X] & 0xffff; -#define COPY_SEG_CPL3(X) regs->gp[X] = (mc->gregs[REG_##X] & 0xffff) | 3; - COPY_SEG(GS); COPY_SEG(FS); COPY_SEG(ES); COPY_SEG(DS); - COPY(EDI); COPY(ESI); COPY(EBP); - COPY2(UESP, ESP); /* sic */ - COPY(EBX); COPY(EDX); COPY(ECX); COPY(EAX); - COPY(EIP); COPY_SEG_CPL3(CS); COPY(EFL); COPY_SEG_CPL3(SS); -#else -#define COPY2(X,Y) regs->gp[X/sizeof(unsigned long)] = mc->gregs[REG_##Y] -#define COPY(X) regs->gp[X/sizeof(unsigned long)] = mc->gregs[REG_##X] - COPY(R8); COPY(R9); COPY(R10); COPY(R11); - COPY(R12); COPY(R13); COPY(R14); COPY(R15); - COPY(RDI); COPY(RSI); COPY(RBP); COPY(RBX); - COPY(RDX); COPY(RAX); COPY(RCX); COPY(RSP); - COPY(RIP); - COPY2(EFLAGS, EFL); - COPY2(CS, CSGSFS); - regs->gp[CS / sizeof(unsigned long)] &= 0xffff; - regs->gp[CS / sizeof(unsigned long)] |= 3; -#endif -} diff --git a/arch/um/os-Linux/sys-x86/prctl.c b/arch/um/os-Linux/sys-x86/prctl.c deleted file mode 100644 index 9d34eddb517..00000000000 --- a/arch/um/os-Linux/sys-x86/prctl.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (C) 2007 Jeff Dike (jdike@{addtoit.com,linux.intel.com}) - * Licensed under the GPL - */ - -#include <sys/ptrace.h> -#include <linux/ptrace.h> - -int os_arch_prctl(int pid, int code, unsigned long *addr) -{ - return ptrace(PTRACE_ARCH_PRCTL, pid, (unsigned long) addr, code); -} diff --git a/arch/um/os-Linux/sys-x86/registers.c b/arch/um/os-Linux/sys-x86/registers.c deleted file mode 100644 index 3a9b6247bbb..00000000000 --- a/arch/um/os-Linux/sys-x86/registers.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2004 PathScale, Inc - * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) - * Licensed under the GPL - */ - -#include <errno.h> -#include <sys/ptrace.h> -#include <sys/user.h> -#include "longjmp.h" -#include "sysdep/ptrace_user.h" - -int save_fp_registers(int pid, unsigned long *fp_regs) -{ - if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) - return -errno; - return 0; -} - -int restore_fp_registers(int pid, unsigned long *fp_regs) -{ - if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) - return -errno; - return 0; -} - -#ifdef __i386__ -int have_fpx_regs = 1; -int save_fpx_registers(int pid, unsigned long *fp_regs) -{ - if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) - return -errno; - return 0; -} - -int restore_fpx_registers(int pid, unsigned long *fp_regs) -{ - if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0) - return -errno; - return 0; -} - -int get_fp_registers(int pid, unsigned long *regs) -{ - if (have_fpx_regs) - return save_fpx_registers(pid, regs); - else - return save_fp_registers(pid, regs); -} - -int put_fp_registers(int pid, unsigned long *regs) -{ - if (have_fpx_regs) - return restore_fpx_registers(pid, regs); - else - return restore_fp_registers(pid, |