summaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r--arch/um/sys-x86_64/Makefile22
-rw-r--r--arch/um/sys-x86_64/delay.c39
-rw-r--r--arch/um/sys-x86_64/kernel-offsets.c24
-rw-r--r--arch/um/sys-x86_64/ksyms.c19
-rw-r--r--arch/um/sys-x86_64/ptrace.c53
-rw-r--r--arch/um/sys-x86_64/signal.c12
-rw-r--r--arch/um/sys-x86_64/syscalls.c21
-rw-r--r--arch/um/sys-x86_64/sysrq.c11
-rw-r--r--arch/um/sys-x86_64/um_module.c19
-rw-r--r--arch/um/sys-x86_64/user-offsets.c86
-rw-r--r--arch/um/sys-x86_64/util/Makefile6
-rw-r--r--arch/um/sys-x86_64/util/mk_sc.c79
-rw-r--r--arch/um/sys-x86_64/util/mk_thread.c20
-rw-r--r--arch/um/sys-x86_64/util/mk_thread_kern.c21
-rw-r--r--arch/um/sys-x86_64/util/mk_thread_user.c30
15 files changed, 311 insertions, 151 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index d7ed2f7..608466a 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -4,24 +4,20 @@
# Licensed under the GPL
#
+#XXX: why into lib-y?
lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
syscalls.o sysrq.o thunk.o syscall_table.o
-USER_OBJS := ptrace_user.o sigcontext.o
+obj-y := ksyms.o
+obj-$(CONFIG_MODULES) += module.o um_module.o
-include arch/um/scripts/Makefile.rules
+USER_OBJS := ptrace_user.o sigcontext.o
SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \
- semaphore.c thunk.S
-
-# this needs to be before the foreach, because clean-files does not accept
-# complete paths like $(src)/$f.
-clean-files := $(SYMLINKS)
+ semaphore.c thunk.S module.c
-targets += $(SYMLINKS)
-
-SYMLINKS := $(foreach f,$(SYMLINKS),$(obj)/$f)
+include arch/um/scripts/Makefile.rules
bitops.c-dir = lib
csum-copy.S-dir = lib
@@ -30,8 +26,6 @@ csum-wrappers.c-dir = lib
memcpy.S-dir = lib
semaphore.c-dir = kernel
thunk.S-dir = lib
+module.c-dir = kernel
-$(SYMLINKS): FORCE
- $(call if_changed,make_link)
-
-CFLAGS_csum-partial.o := -Dcsum_partial=arch_csum_partial
+subdir- := util
diff --git a/arch/um/sys-x86_64/delay.c b/arch/um/sys-x86_64/delay.c
index f3b5187..137f444 100644
--- a/arch/um/sys-x86_64/delay.c
+++ b/arch/um/sys-x86_64/delay.c
@@ -5,22 +5,37 @@
* Licensed under the GPL
*/
-#include "asm/processor.h"
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <asm/processor.h>
+#include <asm/param.h>
void __delay(unsigned long loops)
{
unsigned long i;
- for(i = 0; i < loops; i++) ;
+ for(i = 0; i < loops; i++)
+ cpu_relax();
}
-/*
- * 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:
- */
+void __udelay(unsigned long usecs)
+{
+ unsigned long i, n;
+
+ n = (loops_per_jiffy * HZ * usecs) / MILLION;
+ for(i=0;i<n;i++)
+ cpu_relax();
+}
+
+EXPORT_SYMBOL(__udelay);
+
+void __const_udelay(unsigned long usecs)
+{
+ unsigned long i, n;
+
+ n = (loops_per_jiffy * HZ * usecs) / MILLION;
+ for(i=0;i<n;i++)
+ cpu_relax();
+}
+
+EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/sys-x86_64/kernel-offsets.c
new file mode 100644
index 0000000..220e875
--- /dev/null
+++ b/arch/um/sys-x86_64/kernel-offsets.c
@@ -0,0 +1,24 @@
+#include <linux/config.h>
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/time.h>
+#include <asm/page.h>
+
+#define DEFINE(sym, val) \
+ asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define DEFINE_STR1(x) #x
+#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : )
+
+#define BLANK() asm volatile("\n->" : : )
+
+#define OFFSET(sym, str, mem) \
+ DEFINE(sym, offsetof(struct str, mem));
+
+void foo(void)
+{
+#ifdef CONFIG_MODE_TT
+ OFFSET(TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
+#endif
+#include <common-offsets.h>
+}
diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
new file mode 100644
index 0000000..8592738
--- /dev/null
+++ b/arch/um/sys-x86_64/ksyms.c
@@ -0,0 +1,19 @@
+#include "linux/module.h"
+#include "linux/in6.h"
+#include "linux/rwsem.h"
+#include "asm/byteorder.h"
+#include "asm/semaphore.h"
+#include "asm/uaccess.h"
+#include "asm/checksum.h"
+#include "asm/errno.h"
+
+EXPORT_SYMBOL(__down_failed);
+EXPORT_SYMBOL(__down_failed_interruptible);
+EXPORT_SYMBOL(__down_failed_trylock);
+EXPORT_SYMBOL(__up_wakeup);
+
+/*XXX: we need them because they would be exported by x86_64 */
+EXPORT_SYMBOL(__memcpy);
+
+/* Networking helper routines. */
+EXPORT_SYMBOL(ip_compute_csum);
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index 8c146b2..74eee5c 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -5,10 +5,11 @@
*/
#define __FRAME_OFFSETS
-#include "asm/ptrace.h"
-#include "linux/sched.h"
-#include "linux/errno.h"
-#include "asm/elf.h"
+#include <asm/ptrace.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <asm/uaccess.h>
+#include <asm/elf.h>
/* XXX x86_64 */
unsigned long not_ss;
@@ -62,6 +63,27 @@ int putreg(struct task_struct *child, int regno, unsigned long value)
return 0;
}
+int poke_user(struct task_struct *child, long addr, long data)
+{
+ if ((addr & 3) || addr < 0)
+ return -EIO;
+
+ if (addr < MAX_REG_OFFSET)
+ return putreg(child, addr, data);
+
+#if 0 /* Need x86_64 debugregs handling */
+ else if((addr >= offsetof(struct user, u_debugreg[0])) &&
+ (addr <= offsetof(struct user, u_debugreg[7]))){
+ addr -= offsetof(struct user, u_debugreg[0]);
+ addr = addr >> 2;
+ if((addr == 4) || (addr == 5)) return -EIO;
+ child->thread.arch.debugregs[addr] = data;
+ return 0;
+ }
+#endif
+ return -EIO;
+}
+
unsigned long getreg(struct task_struct *child, int regno)
{
unsigned long retval = ~0UL;
@@ -84,6 +106,29 @@ unsigned long getreg(struct task_struct *child, int regno)
return retval;
}
+int peek_user(struct task_struct *child, long addr, long data)
+{
+ /* read the word at location addr in the USER area. */
+ unsigned long tmp;
+
+ if ((addr & 3) || addr < 0)
+ return -EIO;
+
+ tmp = 0; /* Default return condition */
+ if(addr < MAX_REG_OFFSET){
+ tmp = getreg(child, addr);
+ }
+#if 0 /* Need x86_64 debugregs handling */
+ else if((addr >= offsetof(struct user, u_debugreg[0])) &&
+ (addr <= offsetof(struct user, u_debugreg[7]))){
+ addr -= offsetof(struct user, u_debugreg[0]);
+ addr = addr >> 2;
+ tmp = child->thread.arch.debugregs[addr];
+ }
+#endif
+ return put_user(tmp, (unsigned long *) data);
+}
+
void arch_switch(void)
{
/* XXX
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index 5bc5a0d..73a7926 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
struct pt_regs *regs, unsigned long mask)
{
- unsigned long eflags;
+ struct faultinfo * fi = &current->thread.arch.faultinfo;
int err = 0;
err |= __put_user(0, &to->gs);
@@ -84,14 +84,16 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
err |= PUTREG(regs, R14, to, r14);
err |= PUTREG(regs, R15, to, r15);
err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */
- err |= __put_user(current->thread.err, &to->err);
- err |= __put_user(current->thread.trap_no, &to->trapno);
+
+ err |= __put_user(fi->cr2, &to->cr2);
+ err |= __put_user(fi->error_code, &to->err);
+ err |= __put_user(fi->trap_no, &to->trapno);
+
err |= PUTREG(regs, RIP, to, rip);
err |= PUTREG(regs, EFLAGS, to, eflags);
#undef PUTREG
err |= __put_user(mask, &to->oldmask);
- err |= __put_user(current->thread.cr2, &to->cr2);
return(err);
}
@@ -166,7 +168,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
frame = (struct rt_sigframe __user *)
round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
- frame -= 128;
+ ((unsigned char *) frame) -= 128;
if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
goto out;
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index ab4b0ab..6f44f40 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -7,12 +7,15 @@
#include "linux/linkage.h"
#include "linux/slab.h"
#include "linux/shm.h"
+#include "linux/utsname.h"
+#include "linux/personality.h"
#include "asm/uaccess.h"
#define __FRAME_OFFSETS
#include "asm/ptrace.h"
#include "asm/unistd.h"
#include "asm/prctl.h" /* XXX This should get the constants from libc */
#include "choose-mode.h"
+#include "kern.h"
asmlinkage long sys_uname64(struct new_utsname __user * name)
{
@@ -42,6 +45,8 @@ long sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount)
#ifdef CONFIG_MODE_SKAS
extern int userspace_pid[];
+#include "skas_ptrace.h"
+
long sys_modify_ldt_skas(int func, void *ptr, unsigned long bytecount)
{
struct ptrace_ldt ldt;
@@ -128,23 +133,27 @@ static long arch_prctl_tt(int code, unsigned long addr)
#ifdef CONFIG_MODE_SKAS
+/* XXX: Must also call arch_prctl in the host, beside saving the segment bases! */
static long arch_prctl_skas(int code, unsigned long addr)
{
long ret = 0;
switch(code){
- case ARCH_SET_GS:
- current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr;
- break;
case ARCH_SET_FS:
current->thread.regs.regs.skas.regs[FS_BASE / sizeof(unsigned long)] = addr;
break;
+ case ARCH_SET_GS:
+ current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr;
+ break;
case ARCH_GET_FS:
- ret = put_user(current->thread.regs.regs.skas.regs[GS / sizeof(unsigned long)], &addr);
+ ret = put_user(current->thread.regs.regs.skas.
+ regs[FS_BASE / sizeof(unsigned long)],
+ (unsigned long __user *)addr);
break;
case ARCH_GET_GS:
- ret = put_user(current->thread.regs.regs.skas.regs[FS / sizeof(unsigned \
-long)], &addr);
+ ret = put_user(current->thread.regs.regs.skas.
+ regs[GS_BASE / sizeof(unsigned long)],
+ (unsigned long __user *)addr);
break;
default:
ret = -EINVAL;
diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/um/sys-x86_64/sysrq.c
index ddf7469..d0a25af 100644
--- a/arch/um/sys-x86_64/sysrq.c
+++ b/arch/um/sys-x86_64/sysrq.c
@@ -36,14 +36,5 @@ void __show_regs(struct pt_regs * regs)
void show_regs(struct pt_regs *regs)
{
__show_regs(regs);
- show_trace((unsigned long *) &regs);
+ show_trace(current, (unsigned long *) &regs);
}
-
-/* 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:
- */
diff --git a/arch/um/sys-x86_64/um_module.c b/arch/um/sys-x86_64/um_module.c
new file mode 100644
index 0000000..8b8eff1
--- /dev/null
+++ b/arch/um/sys-x86_64/um_module.c
@@ -0,0 +1,19 @@
+#include <linux/vmalloc.h>
+#include <linux/moduleloader.h>
+
+/*Copied from i386 arch/i386/kernel/module.c */
+void *module_alloc(unsigned long size)
+{
+ if (size == 0)
+ return NULL;
+ return vmalloc_exec(size);
+}
+
+/* Free memory returned from module_alloc */
+void module_free(struct module *mod, void *module_region)
+{
+ vfree(module_region);
+ /* FIXME: If module_region == mod->init_region, trim exception
+ table entries. */
+}
+
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
new file mode 100644
index 0000000..513d17c
--- /dev/null
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -0,0 +1,86 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <signal.h>
+#define __FRAME_OFFSETS
+#include <asm/ptrace.h>
+#include <asm/types.h>
+/* For some reason, x86_64 defines u64 and u32 only in <pci/types.h>, which I
+ * refuse to include here, even though they're used throughout the headers.
+ * These are used in asm/user.h, and that include can't be avoided because of
+ * the sizeof(struct user_regs_struct) below.
+ */
+typedef __u64 u64;
+typedef __u32 u32;
+#include <asm/user.h>
+
+#define DEFINE(sym, val) \
+ asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define OFFSET(sym, str, mem) \
+ DEFINE(sym, offsetof(struct str, mem));
+
+void foo(void)
+{
+ OFFSET(SC_RBX, sigcontext, rbx);
+ OFFSET(SC_RCX, sigcontext, rcx);
+ OFFSET(SC_RDX, sigcontext, rdx);
+ OFFSET(SC_RSI, sigcontext, rsi);
+ OFFSET(SC_RDI, sigcontext, rdi);
+ OFFSET(SC_RBP, sigcontext, rbp);
+ OFFSET(SC_RAX, sigcontext, rax);
+ OFFSET(SC_R8, sigcontext, r8);
+ OFFSET(SC_R9, sigcontext, r9);
+ OFFSET(SC_R10, sigcontext, r10);
+ OFFSET(SC_R11, sigcontext, r11);
+ OFFSET(SC_R12, sigcontext, r12);
+ OFFSET(SC_R13, sigcontext, r13);
+ OFFSET(SC_R14, sigcontext, r14);
+ OFFSET(SC_R15, sigcontext, r15);
+ OFFSET(SC_IP, sigcontext, rip);
+ OFFSET(SC_SP, sigcontext, rsp);
+ OFFSET(SC_CR2, sigcontext, cr2);
+ OFFSET(SC_ERR, sigcontext, err);
+ OFFSET(SC_TRAPNO, sigcontext, trapno);
+ OFFSET(SC_CS, sigcontext, cs);
+ OFFSET(SC_FS, sigcontext, fs);
+ OFFSET(SC_GS, sigcontext, gs);
+ OFFSET(SC_EFLAGS, sigcontext, eflags);
+ OFFSET(SC_SIGMASK, sigcontext, oldmask);
+#if 0
+ OFFSET(SC_ORIG_RAX, sigcontext, orig_rax);
+ OFFSET(SC_DS, sigcontext, ds);
+ OFFSET(SC_ES, sigcontext, es);
+ OFFSET(SC_SS, sigcontext, ss);
+#endif
+
+ DEFINE(HOST_FRAME_SIZE, FRAME_SIZE);
+ DEFINE(HOST_RBX, RBX);
+ DEFINE(HOST_RCX, RCX);
+ DEFINE(HOST_RDI, RDI);
+ DEFINE(HOST_RSI, RSI);
+ DEFINE(HOST_RDX, RDX);
+ DEFINE(HOST_RBP, RBP);
+ DEFINE(HOST_RAX, RAX);
+ DEFINE(HOST_R8, R8);
+ DEFINE(HOST_R9, R9);
+ DEFINE(HOST_R10, R10);
+ DEFINE(HOST_R11, R11);
+ DEFINE(HOST_R12, R12);
+ DEFINE(HOST_R13, R13);
+ DEFINE(HOST_R14, R14);
+ DEFINE(HOST_R15, R15);
+ DEFINE(HOST_ORIG_RAX, ORIG_RAX);
+ DEFINE(HOST_CS, CS);
+ DEFINE(HOST_SS, SS);
+ DEFINE(HOST_EFLAGS, EFLAGS);
+#if 0
+ DEFINE(HOST_FS, FS);
+ DEFINE(HOST_GS, GS);
+ DEFINE(HOST_DS, DS);
+ DEFINE(HOST_ES, ES);
+#endif
+
+ DEFINE(HOST_IP, RIP);
+ DEFINE(HOST_SP, RSP);
+ DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct));
+}
diff --git a/arch/um/sys-x86_64/util/Makefile b/arch/um/sys-x86_64/util/Makefile
index 0026079..75b052c 100644
--- a/arch/um/sys-x86_64/util/Makefile
+++ b/arch/um/sys-x86_64/util/Makefile
@@ -4,7 +4,5 @@
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)
+HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um
+HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
diff --git a/arch/um/sys-x86_64/util/mk_sc.c b/arch/um/sys-x86_64/util/mk_sc.c
index c236e21..7619bc3 100644
--- a/arch/um/sys-x86_64/util/mk_sc.c
+++ b/arch/um/sys-x86_64/util/mk_sc.c
@@ -3,56 +3,45 @@
*/
#include <stdio.h>
-#include <signal.h>
-#include <linux/stddef.h>
+#include <user-offsets.h>
-#define SC_OFFSET(name, field) \
- printf("#define " name \
- "(sc) *((unsigned long *) &(((char *) (sc))[%ld]))\n",\
- offsetof(struct sigcontext, field))
-
-#define SC_FP_OFFSET(name, field) \
- printf("#define " name \
- "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%ld]))\n",\
- offsetof(struct _fpstate, field))
-
-#define SC_FP_OFFSET_PTR(name, field, type) \
- printf("#define " name \
- "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
- offsetof(struct _fpstate, field))
+#define SC_OFFSET(name) \
+ printf("#define " #name \
+ "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\
+ name)
int main(int argc, char **argv)
{
- SC_OFFSET("SC_RBX", rbx);
- SC_OFFSET("SC_RCX", rcx);
- SC_OFFSET("SC_RDX", rdx);
- SC_OFFSET("SC_RSI", rsi);
- SC_OFFSET("SC_RDI", rdi);
- SC_OFFSET("SC_RBP", rbp);
- SC_OFFSET("SC_RAX", rax);
- SC_OFFSET("SC_R8", r8);
- SC_OFFSET("SC_R9", r9);
- SC_OFFSET("SC_R10", r10);
- SC_OFFSET("SC_R11", r11);
- SC_OFFSET("SC_R12", r12);
- SC_OFFSET("SC_R13", r13);
- SC_OFFSET("SC_R14", r14);
- SC_OFFSET("SC_R15", r15);
- SC_OFFSET("SC_IP", rip);
- SC_OFFSET("SC_SP", rsp);
- SC_OFFSET("SC_CR2", cr2);
- SC_OFFSET("SC_ERR", err);
- SC_OFFSET("SC_TRAPNO", trapno);
- SC_OFFSET("SC_CS", cs);
- SC_OFFSET("SC_FS", fs);
- SC_OFFSET("SC_GS", gs);
- SC_OFFSET("SC_EFLAGS", eflags);
- SC_OFFSET("SC_SIGMASK", oldmask);
+ SC_OFFSET(SC_RBX);
+ SC_OFFSET(SC_RCX);
+ SC_OFFSET(SC_RDX);
+ SC_OFFSET(SC_RSI);
+ SC_OFFSET(SC_RDI);
+ SC_OFFSET(SC_RBP);
+ SC_OFFSET(SC_RAX);
+ SC_OFFSET(SC_R8);
+ SC_OFFSET(SC_R9);
+ SC_OFFSET(SC_R10);
+ SC_OFFSET(SC_R11);
+ SC_OFFSET(SC_R12);
+ SC_OFFSET(SC_R13);
+ SC_OFFSET(SC_R14);
+ SC_OFFSET(SC_R15);
+ SC_OFFSET(SC_IP);
+ SC_OFFSET(SC_SP);
+ SC_OFFSET(SC_CR2);
+ SC_OFFSET(SC_ERR);
+ SC_OFFSET(SC_TRAPNO);
+ SC_OFFSET(SC_CS);
+ SC_OFFSET(SC_FS);
+ SC_OFFSET(SC_GS);
+ SC_OFFSET(SC_EFLAGS);
+ SC_OFFSET(SC_SIGMASK);
#if 0
- SC_OFFSET("SC_ORIG_RAX", orig_rax);
- SC_OFFSET("SC_DS", ds);
- SC_OFFSET("SC_ES", es);
- SC_OFFSET("SC_SS", ss);
+ SC_OFFSET(SC_ORIG_RAX);
+ SC_OFFSET(SC_DS);
+ SC_OFFSET(SC_ES);
+ SC_OFFSET(SC_SS);
#endif
return(0);
}
diff --git a/arch/um/sys-x86_64/util/mk_thread.c b/arch/um/sys-x86_64/util/mk_thread.c
new file mode 100644
index 0000000..1551739
--- /dev/null
+++ b/arch/um/sys-x86_64/util/mk_thread.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <kernel-offsets.h>
+
+int main(int argc, char **argv)
+{
+ 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");
+#ifdef TASK_EXTERN_PID
+ printf("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n",
+ TASK_EXTERN_PID);
+#endif
+ printf("\n");
+ printf("#endif\n");
+ return(0);
+}
diff --git a/arch/um/sys-x86_64/util/mk_thread_kern.c b/arch/um/sys-x86_64/util/mk_thread_kern.c
deleted file mode 100644
index a281673..0000000
--- a/arch/um/sys-x86_64/util/mk_thread_kern.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#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);
-}
-
diff --git a/arch/um/sys-x86_64/util/mk_thread_user.c b/arch/um/sys-x86_64/util/mk_thread_user.c
deleted file mode 100644
index 7989725..0000000
--- a/arch/um/sys-x86_64/util/mk_thread_user.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#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");
-}
OpenPOWER on IntegriCloud