Commit | Line | Data |
---|---|---|
995473ae | 1 | /* |
ba180fd4 | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
995473ae JD |
3 | * Licensed under the GPL |
4 | */ | |
5 | ||
37185b33 | 6 | #include <linux/init.h> |
589ee628 | 7 | #include <linux/sched/mm.h> |
68db0cf1 | 8 | #include <linux/sched/task_stack.h> |
589ee628 | 9 | |
37185b33 AV |
10 | #include <as-layout.h> |
11 | #include <kern.h> | |
12 | #include <os.h> | |
13 | #include <skas.h> | |
995473ae | 14 | |
995473ae JD |
15 | extern void start_kernel(void); |
16 | ||
97a1fcbb | 17 | static int __init start_kernel_proc(void *unused) |
995473ae JD |
18 | { |
19 | int pid; | |
20 | ||
21 | block_signals(); | |
22 | pid = os_getpid(); | |
23 | ||
24 | cpu_tasks[0].pid = pid; | |
25 | cpu_tasks[0].task = current; | |
28fa468f | 26 | |
995473ae | 27 | start_kernel(); |
77bf4400 | 28 | return 0; |
995473ae JD |
29 | } |
30 | ||
31 | extern int userspace_pid[]; | |
32 | ||
c14b8494 JD |
33 | extern char cpu0_irqstack[]; |
34 | ||
77bf4400 | 35 | int __init start_uml(void) |
995473ae | 36 | { |
c14b8494 JD |
37 | stack_protections((unsigned long) &cpu0_irqstack); |
38 | set_sigstack(cpu0_irqstack, THREAD_SIZE); | |
995473ae JD |
39 | |
40 | init_new_thread_signals(); | |
41 | ||
42 | init_task.thread.request.u.thread.proc = start_kernel_proc; | |
43 | init_task.thread.request.u.thread.arg = NULL; | |
77bf4400 JD |
44 | return start_idle_thread(task_stack_page(&init_task), |
45 | &init_task.thread.switch_buf); | |
995473ae JD |
46 | } |
47 | ||
48 | unsigned long current_stub_stack(void) | |
49 | { | |
ba180fd4 | 50 | if (current->mm == NULL) |
77bf4400 | 51 | return 0; |
995473ae | 52 | |
6c738ffa | 53 | return current->mm->context.id.stack; |
995473ae | 54 | } |