2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
6 #include "linux/init.h"
7 #include "linux/sched.h"
12 int new_mm(unsigned long stack)
16 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
21 map_stub_pages(fd, STUB_CODE, STUB_DATA, stack);
26 extern void start_kernel(void);
28 static int __init start_kernel_proc(void *unused)
35 cpu_tasks[0].pid = pid;
36 cpu_tasks[0].task = current;
38 cpu_online_map = cpumask_of_cpu(0);
44 extern int userspace_pid[];
46 extern char cpu0_irqstack[];
48 int __init start_uml(void)
50 stack_protections((unsigned long) &cpu0_irqstack);
51 set_sigstack(cpu0_irqstack, THREAD_SIZE);
53 userspace_pid[0] = start_userspace(0);
55 init_new_thread_signals();
57 init_task.thread.request.u.thread.proc = start_kernel_proc;
58 init_task.thread.request.u.thread.arg = NULL;
59 return start_idle_thread(task_stack_page(&init_task),
60 &init_task.thread.switch_buf);
63 unsigned long current_stub_stack(void)
65 if (current->mm == NULL)
68 return current->mm->context.id.stack;