process.c (77bf4400319db9d2a8af6b00c2be6faa0f3d07cb) process.c (ba180fd437156f7fd8cfb2fdd021d949eeef08d6)
1/*
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
3 * Licensed under the GPL
4 */
5
6#include "linux/sched.h"
7#include "linux/slab.h"
8#include "linux/ptrace.h"
9#include "linux/proc_fs.h"
10#include "linux/file.h"
11#include "linux/errno.h"
12#include "linux/init.h"
6#include "linux/init.h"
13#include "asm/uaccess.h"
14#include "asm/atomic.h"
15#include "kern_util.h"
7#include "linux/sched.h"
16#include "as-layout.h"
8#include "as-layout.h"
17#include "skas.h"
18#include "os.h"
9#include "os.h"
19#include "tlb.h"
20#include "kern.h"
21#include "registers.h"
10#include "skas.h"
22
11
23extern void schedule_tail(struct task_struct *prev);
24
25int new_mm(unsigned long stack)
26{
27 int fd;
28
29 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
12int new_mm(unsigned long stack)
13{
14 int fd;
15
16 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
30 if(fd < 0)
17 if (fd < 0)
31 return fd;
32
18 return fd;
19
33 if(skas_needs_stub)
20 if (skas_needs_stub)
34 map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack);
35
36 return fd;
37}
38
39extern void start_kernel(void);
40
41static int __init start_kernel_proc(void *unused)

--- 15 unchanged lines hidden (view full) ---

57extern int userspace_pid[];
58
59extern char cpu0_irqstack[];
60
61int __init start_uml(void)
62{
63 stack_protections((unsigned long) &cpu0_irqstack);
64 set_sigstack(cpu0_irqstack, THREAD_SIZE);
21 map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack);
22
23 return fd;
24}
25
26extern void start_kernel(void);
27
28static int __init start_kernel_proc(void *unused)

--- 15 unchanged lines hidden (view full) ---

44extern int userspace_pid[];
45
46extern char cpu0_irqstack[];
47
48int __init start_uml(void)
49{
50 stack_protections((unsigned long) &cpu0_irqstack);
51 set_sigstack(cpu0_irqstack, THREAD_SIZE);
65 if(proc_mm)
52 if (proc_mm)
66 userspace_pid[0] = start_userspace(0);
67
68 init_new_thread_signals();
69
70 init_task.thread.request.u.thread.proc = start_kernel_proc;
71 init_task.thread.request.u.thread.arg = NULL;
72 return start_idle_thread(task_stack_page(&init_task),
73 &init_task.thread.switch_buf);
74}
75
76unsigned long current_stub_stack(void)
77{
53 userspace_pid[0] = start_userspace(0);
54
55 init_new_thread_signals();
56
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);
61}
62
63unsigned long current_stub_stack(void)
64{
78 if(current->mm == NULL)
65 if (current->mm == NULL)
79 return 0;
80
81 return current->mm->context.skas.id.stack;
82}
66 return 0;
67
68 return current->mm->context.skas.id.stack;
69}