0001
0002
0003
0004
0005
0006 #include <linux/init.h>
0007 #include <linux/sched/mm.h>
0008 #include <linux/sched/task_stack.h>
0009 #include <linux/sched/task.h>
0010
0011 #include <as-layout.h>
0012 #include <kern.h>
0013 #include <os.h>
0014 #include <skas.h>
0015
0016 extern void start_kernel(void);
0017
0018 static int __init start_kernel_proc(void *unused)
0019 {
0020 int pid;
0021
0022 block_signals_trace();
0023 pid = os_getpid();
0024
0025 cpu_tasks[0].pid = pid;
0026 cpu_tasks[0].task = current;
0027
0028 start_kernel();
0029 return 0;
0030 }
0031
0032 extern int userspace_pid[];
0033
0034 extern char cpu0_irqstack[];
0035
0036 int __init start_uml(void)
0037 {
0038 stack_protections((unsigned long) &cpu0_irqstack);
0039 set_sigstack(cpu0_irqstack, THREAD_SIZE);
0040
0041 init_new_thread_signals();
0042
0043 init_task.thread.request.u.thread.proc = start_kernel_proc;
0044 init_task.thread.request.u.thread.arg = NULL;
0045 return start_idle_thread(task_stack_page(&init_task),
0046 &init_task.thread.switch_buf);
0047 }
0048
0049 unsigned long current_stub_stack(void)
0050 {
0051 if (current->mm == NULL)
0052 return 0;
0053
0054 return current->mm->context.id.stack;
0055 }