aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/tt/exec_kern.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/tt/exec_kern.c
downloadlinux-dev-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.xz
linux-dev-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.zip
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/kernel/tt/exec_kern.c')
-rw-r--r--arch/um/kernel/tt/exec_kern.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c
new file mode 100644
index 000000000000..065b504a653b
--- /dev/null
+++ b/arch/um/kernel/tt/exec_kern.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#include "linux/kernel.h"
+#include "linux/mm.h"
+#include "asm/signal.h"
+#include "asm/ptrace.h"
+#include "asm/uaccess.h"
+#include "asm/pgalloc.h"
+#include "asm/tlbflush.h"
+#include "user_util.h"
+#include "kern_util.h"
+#include "irq_user.h"
+#include "time_user.h"
+#include "signal_user.h"
+#include "mem_user.h"
+#include "os.h"
+#include "tlb.h"
+#include "mode.h"
+
+static int exec_tramp(void *sig_stack)
+{
+ init_new_thread_stack(sig_stack, NULL);
+ init_new_thread_signals(1);
+ os_stop_process(os_getpid());
+ return(0);
+}
+
+void flush_thread_tt(void)
+{
+ unsigned long stack;
+ int new_pid;
+
+ stack = alloc_stack(0, 0);
+ if(stack == 0){
+ printk(KERN_ERR
+ "flush_thread : failed to allocate temporary stack\n");
+ do_exit(SIGKILL);
+ }
+
+ new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp);
+ if(new_pid < 0){
+ printk(KERN_ERR
+ "flush_thread : new thread failed, errno = %d\n",
+ -new_pid);
+ do_exit(SIGKILL);
+ }
+
+ if(current_thread->cpu == 0)
+ forward_interrupts(new_pid);
+ current->thread.request.op = OP_EXEC;
+ current->thread.request.u.exec.pid = new_pid;
+ unprotect_stack((unsigned long) current_thread);
+ os_usr1_process(os_getpid());
+ change_sig(SIGUSR1, 1);
+
+ change_sig(SIGUSR1, 0);
+ enable_timer();
+ free_page(stack);
+ protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
+ task_protections((unsigned long) current_thread);
+ force_flush_all();
+ unblock_signals();
+}
+
+void start_thread_tt(struct pt_regs *regs, unsigned long eip,
+ unsigned long esp)
+{
+ set_fs(USER_DS);
+ flush_tlb_mm(current->mm);
+ PT_REGS_IP(regs) = eip;
+ PT_REGS_SP(regs) = esp;
+ PT_FIX_EXEC_STACK(esp);
+}
+
+/*
+ * 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:
+ */