xref: /openbmc/linux/arch/um/kernel/skas/mmu.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1 /*
2  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5 
6 #include "linux/sched.h"
7 #include "linux/list.h"
8 #include "linux/spinlock.h"
9 #include "linux/slab.h"
10 #include "asm/current.h"
11 #include "asm/segment.h"
12 #include "asm/mmu.h"
13 #include "os.h"
14 #include "skas.h"
15 
16 int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
17 {
18 	int from;
19 
20 	if((current->mm != NULL) && (current->mm != &init_mm))
21 		from = current->mm->context.skas.mm_fd;
22 	else from = -1;
23 
24 	mm->context.skas.mm_fd = new_mm(from);
25 	if(mm->context.skas.mm_fd < 0){
26 		printk("init_new_context_skas - new_mm failed, errno = %d\n",
27 		       mm->context.skas.mm_fd);
28 		return(mm->context.skas.mm_fd);
29 	}
30 
31 	return(0);
32 }
33 
34 void destroy_context_skas(struct mm_struct *mm)
35 {
36 	os_close_file(mm->context.skas.mm_fd);
37 }
38 
39 /*
40  * Overrides for Emacs so that we follow Linus's tabbing style.
41  * Emacs will notice this stuff at the end of the file and automatically
42  * adjust the settings for this buffer only.  This must remain at the end
43  * of the file.
44  * ---------------------------------------------------------------------------
45  * Local variables:
46  * c-file-style: "linux"
47  * End:
48  */
49