UML - x86-64 core support
PATCH 5/28 UML - x86-64 core support
This adds the new files from the x86_64 port which just drop in and don't require any work anywhere else.
Signed-off-by Jeff Dike <[email protected]>
arch/um/Makefile +4 -2
@@ -12,8 +12,7 @@ filechk_gen_header = $< core-y += $(ARCH_DIR)/kernel/ \ - $(ARCH_DIR)/drivers/ \ - $(ARCH_DIR)/sys-$(SUBARCH)/ + $(ARCH_DIR)/drivers/ # Have to precede the include because the included Makefiles reference them. SYMLINK_HEADERS = archparam.h system.h sigcontext.h processor.h ptrace.h \
@@ -38,6 +37,9 @@ include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) +core-y += $(SUBARCH_CORE) +libs-y += $(SUBARCH_LIBS) + # -Derrno=kernel_errno - This turns all kernel references to errno into # kernel_errno to separate them from the libc errno. This allows -fno-common # in CFLAGS. Otherwise, it would cause ld to complain about the two different
arch/um/Makefile-i386 +2 -0
@@ -1,3 +1,5 @@ +SUBARCH_CORE := arch/um/sys-i386/ + ifeq ($(CONFIG_HOST_2G_2G), y) TOP_ADDR := 0x80000000 else
arch/um/Makefile-x86_64 +35 -0
@@ -1 +1,36 @@ +# Copyright 2003 - 2004 Pathscale, Inc +# Released under the GPL + +SUBARCH_LIBS := arch/um/sys-x86_64/ +START := 0x60000000 + +CFLAGS += -U__$(SUBARCH)__ -fno-builtin ARCH_USER_CFLAGS := -D__x86_64__ + +ELF_ARCH := i386:x86-64 +ELF_FORMAT := elf64-x86-64 + +SYS_UTIL_DIR := $(ARCH_DIR)/sys-x86_64/util +SYS_DIR := $(ARCH_DIR)/include/sysdep-x86_64 + +SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h + +prepare: $(SYS_HEADERS) + +$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc + $(call filechk,gen_header) + +$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread + $(call filechk,gen_header) + +$(SYS_UTIL_DIR)/mk_sc: scripts_basic FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE + $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ + +CLEAN_FILES += $(SYS_HEADERS) + +LIBC_DIR := /usr/lib64 + +export LIBC_DIR
arch/um/include/sysdep-x86_64/checksum.h +151 -0
151 lines not on this page · raw message
arch/um/include/sysdep-x86_64/sigcontext.h +49 -0
49 lines not on this page · raw message
arch/um/kernel/tt/Makefile +4 -1
@@ -24,6 +24,9 @@ $(obj)/unmap.o: $(src)/unmap.c $(CC) $(UNMAP_CFLAGS) -c -o $@ $< +LIBC_DIR ?= /usr/lib + $(obj)/unmap_fin.o : $(obj)/unmap.o - ld -r -o $(obj)/unmap_tmp.o $< -lc -L/usr/lib + ld -r -o $(obj)/unmap_tmp.o $< -lc -L$(LIBC_DIR) objcopy $(obj)/unmap_tmp.o $@ -G switcheroo +
arch/um/sys-x86_64/Makefile +39 -0
@@ -0,0 +1,39 @@ +# +# Copyright 2003 PathScale, Inc. +# +# Licensed under the GPL +# + +lib-y = bitops.o bugs.o csum-partial.o fault.o mem.o memcpy.o \ + ptrace.o semaphore.o sigcontext.o signal.o syscalls.o \ + sysrq.o thunk.o + +USER_OBJS := sigcontext.o +USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) + +SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ + semaphore.c thunk.S +SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f) + +clean-files := $(SYMLINKS) + +bitops.c-dir = lib +csum-copy.S-dir = lib +csum-partial.c-dir = lib +csum-wrappers.c-dir = lib +memcpy.S-dir = lib +semaphore.c-dir = kernel +thunk.S-dir = lib + +define make_link + -rm -f $1 + ln -sf $(TOPDIR)/arch/x86_64/$($(notdir $1)-dir)/$(notdir $1) $1 +endef + +$(SYMLINKS): + $(call make_link,$@) + +$(USER_OBJS) : %.o: %.c + $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< + +CFLAGS_csum-partial.o := -Dcsum_partial=arch_csum_partial
arch/um/sys-x86_64/bugs.c +122 -0
122 lines not on this page · raw message
arch/um/sys-x86_64/fault.c +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#include "user.h" + +int arch_fixup (unsigned long address,void *sc_ptr) +{ +/* XXX search_exception_tables() */ +return (0 ); +} + +/* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
arch/um/sys-x86_64/mem.c +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#include "linux/mm.h" +#include "asm/page.h" +#include "asm/mman.h" + +unsigned long vm_stack_flags = __VM_STACK_FLAGS; +unsigned long vm_stack_flags32 = __VM_STACK_FLAGS; +unsigned long vm_data_default_flags = __VM_DATA_DEFAULT_FLAGS; +unsigned long vm_data_default_flags32 = __VM_DATA_DEFAULT_FLAGS; +unsigned long vm_force_exec32 =PROT_EXEC ; + +/* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
arch/um/sys-x86_64/sigcontext.c +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#include <stdio.h> +#include <string.h> +#include <signal.h> +#include "user.h" + +void sc_to_sc (void *to_ptr,void *from_ptr) +{ +struct sigcontext *to = to_ptr, *from = from_ptr; +int size =sizeof (*to);/* + sizeof(struct _fpstate); */ + +memcpy (to, from, size); +if (from->fpstate !=NULL ) + to->fpstate = (struct _fpstate *) (to +1 ); + + to->fpstate =NULL ; +} + +unsigned long *sc_sigmask (void *sc_ptr) +{ +struct sigcontext *sc = sc_ptr; + +return (&sc->oldmask); +} + +/* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
arch/um/sys-x86_64/signal.c +276 -0
276 lines not on this page · raw message
arch/um/sys-x86_64/sysrq.c +49 -0
49 lines not on this page · raw message
arch/um/sys-x86_64/util/Makefile +10 -0
@@ -0,0 +1,10 @@ +# Copyright 2003 - 2004 Pathscale, Inc +# Released under the GPL + +hostprogs-y := mk_sc mk_thread +always := $(hostprogs-y) + +mk_thread-objs := mk_thread_kern.o mk_thread_user.o + +HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS) +HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
arch/um/sys-x86_64/util/mk_sc.c +58 -0
58 lines not on this page · raw message
arch/um/sys-x86_64/util/mk_thread_kern.c +21 -0
@@ -0,0 +1,21 @@ +#include "linux/config.h" +#include "linux/stddef.h" +#include "linux/sched.h" + +extern void print_head (void ); +extern void print_constant_ptr (char *name,int value); +extern void print_constant (char *name,char *type,int value); +extern void print_tail (void ); + +#define THREAD_OFFSET (field) offsetof(struct task_struct, thread.field) + +int main (int argc,char **argv) +{ +print_head (); +#ifdef CONFIG_MODE_TT +print_constant ("TASK_EXTERN_PID" ,"int" ,THREAD_OFFSET (mode.tt.extern_pid)); +#endif +print_tail (); +return (0 ); +} +
arch/um/sys-x86_64/util/mk_thread_user.c +30 -0
@@ -0,0 +1,30 @@ +#include <stdio.h> + +void print_head (void ) +{ +printf ("/*\n" ); +printf (" * Generated by mk_thread\n" ); +printf (" */\n" ); +printf ("\n" ); +printf ("#ifndef __UM_THREAD_H\n" ); +printf ("#define __UM_THREAD_H\n" ); +printf ("\n" ); +} + +void print_constant_ptr (char *name,int value) +{ +printf ("#define %s(task) ((unsigned long *) " +"&(((char *) (task))[%d]))\n" , name, value); +} + +void print_constant (char *name,char *type,int value) +{ +printf ("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n" , name, type, + value); +} + +void print_tail (void ) +{ +printf ("\n" ); +printf ("#endif\n" ); +}
include/asm-um/apic.h +4 -0
@@ -0,0 +1,4 @@ +#ifndef __UM_APIC_H +#define __UM_APIC_H + +#endif
include/asm-um/module-x86_64.h +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#ifndef __UM_MODULE_X86_64_H +#define __UM_MODULE_X86_64_H + +/* UML is simple */ +struct mod_arch_specific +{ +}; + +#define Elf_Shdr Elf64_Shdr +#define Elf_Sym Elf64_Sym +#define Elf_Ehdr Elf64_Ehdr + +#endif + +/* +* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
include/asm-um/pda.h +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#ifndef __UM_PDA_X86_64_H +#define __UM_PDA_X86_64_H + +/* XXX */ +struct foo { +unsigned int __softirq_pending; +unsigned int __nmi_count; +}; + +extern struct foo me; + +#define read_pda (me) (&me) + +#endif + +/* +* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
include/asm-um/prctl.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __UM_PRCTL_H +#define __UM_PRCTL_H + +#include "asm/arch/prctl.h" + +#endif
include/asm-um/processor-x86_64.h +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#ifndef __UM_PROCESSOR_X86_64_H +#define __UM_PROCESSOR_X86_64_H + +#include "asm/arch/user.h" + +struct arch_thread { +}; + +#define INIT_ARCH_THREAD { } + +#define current_text_addr () \ + ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) + +#include "asm/processor-generic.h" + +#endif + +/* +* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
include/asm-um/sigcontext-x86_64.h +22 -0
@@ -0,0 +1,22 @@ +/* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#ifndef __UM_SIGCONTEXT_X86_64_H +#define __UM_SIGCONTEXT_X86_64_H + +#include "asm/sigcontext-generic.h" + +#endif + +/* +* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
include/asm-um/system-x86_64.h +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright 2003 PathScale, Inc. +* +* Licensed under the GPL +*/ + +#ifndef __UM_SYSTEM_X86_64_H +#define __UM_SYSTEM_X86_64_H + +#include "asm/system-generic.h" + +#endif + +/* +* Overrides for Emacs so that we follow Linus's tabbing style. +* Emacs will notice this stuff at the end of the file and automatically +* adjust the settings for this buffer only. This must remain at the end +* of the file. +* --------------------------------------------------------------------------- +* Local variables: +* c-file-style: "linux" +* End: +*/
include/asm-um/vm-flags-x86_64.h +6 -0
@@ -17,11 +17,17 @@extern unsigned long vm_data_default_flags, vm_data_default_flags32;extern unsigned long vm_force_exec32; +#ifdef TIF_IA32 #define VM_DATA_DEFAULT_FLAGS \ (test_thread_flag(TIF_IA32) ? vm_data_default_flags32 : \ vm_data_default_flags)#define VM_STACK_DEFAULT_FLAGS \ (test_thread_flag(TIF_IA32) ? vm_stack_flags32 : vm_stack_flags) +#endif + +#define VM_DATA_DEFAULT_FLAGS vm_data_default_flags + +#define VM_STACK_DEFAULT_FLAGS vm_stack_flags#endif