2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
15 #include <sys/ptrace.h>
16 #include <linux/ptrace.h>
19 #include <asm/ptrace.h>
20 #include <asm/unistd.h>
22 #include "user_util.h"
23 #include "kern_util.h"
25 #include "signal_kern.h"
26 #include "signal_user.h"
27 #include "sysdep/ptrace.h"
28 #include "sysdep/sigcontext.h"
30 #include "ptrace_user.h"
31 #include "time_user.h"
34 #include "uml-config.h"
35 #include "choose-mode.h"
40 *-------------------------
41 * only for tt mode (will be deleted in future...)
42 *-------------------------
48 unsigned long temp_stack;
53 /* See above for why sigkill is here */
55 int sigkill = SIGKILL;
57 int outer_tramp(void *arg)
63 t->pid = clone(t->tramp, (void *) t->temp_stack + page_size()/2,
64 t->flags, t->tramp_data);
65 if(t->pid > 0) wait_for_stop(t->pid, SIGSTOP, PTRACE_CONT, NULL);
66 kill(os_getpid(), sig);
70 int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
71 int clone_flags, int (*tramp)(void *))
75 int new_pid, status, err;
77 /* The trampoline will run on the temporary stack */
78 sp = stack_sp(temp_stack);
80 clone_flags |= CLONE_FILES | SIGCHLD;
83 arg.tramp_data = thread_arg;
84 arg.temp_stack = temp_stack;
85 arg.flags = clone_flags;
87 /* Start the process and wait for it to kill itself */
88 new_pid = clone(outer_tramp, (void *) sp, clone_flags, &arg);
92 CATCH_EINTR(err = waitpid(new_pid, &status, 0));
94 panic("Waiting for outer trampoline failed - errno = %d",
97 if(!WIFSIGNALED(status) || (WTERMSIG(status) != SIGKILL))
98 panic("outer trampoline didn't exit with SIGKILL, "
99 "status = %d", status);
104 void forward_pending_sigio(int target)
108 if(sigpending(&sigs))
109 panic("forward_pending_sigio : sigpending failed");
110 if(sigismember(&sigs, SIGIO))