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"
13 int new_mm(unsigned long stack
)
17 fd
= os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
21 if (skas_needs_stub
) {
22 err
= map_stub_pages(fd
, STUB_CODE
, STUB_DATA
, stack
);
32 extern void start_kernel(void);
34 static int __init
start_kernel_proc(void *unused
)
41 cpu_tasks
[0].pid
= pid
;
42 cpu_tasks
[0].task
= current
;
44 cpu_online_map
= cpumask_of_cpu(0);
50 extern int userspace_pid
[];
52 extern char cpu0_irqstack
[];
54 int __init
start_uml(void)
56 stack_protections((unsigned long) &cpu0_irqstack
);
57 set_sigstack(cpu0_irqstack
, THREAD_SIZE
);
59 userspace_pid
[0] = start_userspace(0);
60 if (userspace_pid
[0] < 0) {
61 printf("start_uml - start_userspace returned %d\n",
67 init_new_thread_signals();
69 init_task
.thread
.request
.u
.thread
.proc
= start_kernel_proc
;
70 init_task
.thread
.request
.u
.thread
.arg
= NULL
;
71 return start_idle_thread(task_stack_page(&init_task
),
72 &init_task
.thread
.switch_buf
);
75 unsigned long current_stub_stack(void)
77 if (current
->mm
== NULL
)
80 return current
->mm
->context
.id
.stack
;