| 1 | |
| 2 | |
| 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
| 4 |
|
| 5 |
|
| 6 | #include <linux/init.h>
|
| 7 | #include <linux/sched/mm.h>
|
| 8 | #include <linux/sched/task_stack.h>
|
| 9 | #include <linux/sched/task.h>
|
| 10 | #include <linux/smp-internal.h>
|
| 11 |
|
| 12 | #include <asm/tlbflush.h>
|
| 13 |
|
| 14 | #include <as-layout.h>
|
| 15 | #include <kern.h>
|
| 16 | #include <os.h>
|
| 17 | #include <skas.h>
|
| 18 | #include <kern_util.h>
|
| 19 |
|
| 20 | extern void start_kernel(void);
|
| 21 |
|
| 22 | static int __init start_kernel_proc(void *unused)
|
| 23 | {
|
| 24 | block_signals_trace();
|
| 25 |
|
| 26 | start_kernel();
|
| 27 | return 0;
|
| 28 | }
|
| 29 |
|
| 30 | char cpu_irqstacks[NR_CPUS][THREAD_SIZE] __aligned(THREAD_SIZE);
|
| 31 |
|
| 32 | int __init start_uml(void)
|
| 33 | {
|
| 34 | stack_protections((unsigned long) &cpu_irqstacks[0]);
|
| 35 | set_sigstack(cpu_irqstacks[0], THREAD_SIZE);
|
| 36 |
|
| 37 | init_new_thread_signals();
|
| 38 |
|
| 39 | init_task.thread.request.thread.proc = start_kernel_proc;
|
| 40 | init_task.thread.request.thread.arg = NULL;
|
| 41 | return start_idle_thread(task_stack_page(&init_task),
|
| 42 | &init_task.thread.switch_buf);
|
| 43 | }
|
| 44 |
|
| 45 | unsigned long current_stub_stack(void)
|
| 46 | {
|
| 47 | if (current->mm == NULL)
|
| 48 | return 0;
|
| 49 |
|
| 50 | return current->mm->context.id.stack;
|
| 51 | }
|
| 52 |
|
| 53 | struct mm_id *current_mm_id(void)
|
| 54 | {
|
| 55 | if (current->mm == NULL)
|
| 56 | return NULL;
|
| 57 |
|
| 58 | return ¤t->mm->context.id;
|
| 59 | }
|
| 60 |
|
| 61 | void current_mm_sync(void)
|
| 62 | {
|
| 63 | if (current->mm == NULL)
|
| 64 | return;
|
| 65 |
|
| 66 | um_tlb_sync(current->mm);
|
| 67 | }
|
| 68 |
|
| 69 | static DEFINE_SPINLOCK(initial_jmpbuf_spinlock);
|
| 70 |
|
| 71 | void initial_jmpbuf_lock(void)
|
| 72 | {
|
| 73 | spin_lock_irq(&initial_jmpbuf_spinlock);
|
| 74 | }
|
| 75 |
|
| 76 | void initial_jmpbuf_unlock(void)
|
| 77 | {
|
| 78 | spin_unlock_irq(&initial_jmpbuf_spinlock);
|
| 79 | }
|