diff options
Diffstat (limited to 'arch/um/kernel/skas/tlb.c')
-rw-r--r-- | arch/um/kernel/skas/tlb.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c index 18f9a7711de1..6230999c672c 100644 --- a/arch/um/kernel/skas/tlb.c +++ b/arch/um/kernel/skas/tlb.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include "linux/stddef.h" | 7 | #include "linux/stddef.h" |
8 | #include "linux/sched.h" | 8 | #include "linux/sched.h" |
9 | #include "linux/config.h" | ||
9 | #include "linux/mm.h" | 10 | #include "linux/mm.h" |
10 | #include "asm/page.h" | 11 | #include "asm/page.h" |
11 | #include "asm/pgtable.h" | 12 | #include "asm/pgtable.h" |
@@ -17,7 +18,7 @@ | |||
17 | #include "os.h" | 18 | #include "os.h" |
18 | #include "tlb.h" | 19 | #include "tlb.h" |
19 | 20 | ||
20 | static void do_ops(int fd, struct host_vm_op *ops, int last) | 21 | static void do_ops(union mm_context *mmu, struct host_vm_op *ops, int last) |
21 | { | 22 | { |
22 | struct host_vm_op *op; | 23 | struct host_vm_op *op; |
23 | int i; | 24 | int i; |
@@ -26,18 +27,18 @@ static void do_ops(int fd, struct host_vm_op *ops, int last) | |||
26 | op = &ops[i]; | 27 | op = &ops[i]; |
27 | switch(op->type){ | 28 | switch(op->type){ |
28 | case MMAP: | 29 | case MMAP: |
29 | map(fd, op->u.mmap.addr, op->u.mmap.len, | 30 | map(&mmu->skas.id, op->u.mmap.addr, op->u.mmap.len, |
30 | op->u.mmap.r, op->u.mmap.w, op->u.mmap.x, | 31 | op->u.mmap.r, op->u.mmap.w, op->u.mmap.x, |
31 | op->u.mmap.fd, op->u.mmap.offset); | 32 | op->u.mmap.fd, op->u.mmap.offset); |
32 | break; | 33 | break; |
33 | case MUNMAP: | 34 | case MUNMAP: |
34 | unmap(fd, (void *) op->u.munmap.addr, | 35 | unmap(&mmu->skas.id, (void *) op->u.munmap.addr, |
35 | op->u.munmap.len); | 36 | op->u.munmap.len); |
36 | break; | 37 | break; |
37 | case MPROTECT: | 38 | case MPROTECT: |
38 | protect(fd, op->u.mprotect.addr, op->u.mprotect.len, | 39 | protect(&mmu->skas.id, op->u.mprotect.addr, |
39 | op->u.mprotect.r, op->u.mprotect.w, | 40 | op->u.mprotect.len, op->u.mprotect.r, |
40 | op->u.mprotect.x); | 41 | op->u.mprotect.w, op->u.mprotect.x); |
41 | break; | 42 | break; |
42 | default: | 43 | default: |
43 | printk("Unknown op type %d in do_ops\n", op->type); | 44 | printk("Unknown op type %d in do_ops\n", op->type); |
@@ -46,12 +47,15 @@ static void do_ops(int fd, struct host_vm_op *ops, int last) | |||
46 | } | 47 | } |
47 | } | 48 | } |
48 | 49 | ||
50 | extern int proc_mm; | ||
51 | |||
49 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, | 52 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, |
50 | unsigned long end_addr, int force) | 53 | unsigned long end_addr, int force) |
51 | { | 54 | { |
52 | int fd = mm->context.skas.mm_fd; | 55 | if(!proc_mm && (end_addr > CONFIG_STUB_START)) |
56 | end_addr = CONFIG_STUB_START; | ||
53 | 57 | ||
54 | fix_range_common(mm, start_addr, end_addr, force, fd, do_ops); | 58 | fix_range_common(mm, start_addr, end_addr, force, do_ops); |
55 | } | 59 | } |
56 | 60 | ||
57 | void __flush_tlb_one_skas(unsigned long addr) | 61 | void __flush_tlb_one_skas(unsigned long addr) |
@@ -69,16 +73,20 @@ void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start, | |||
69 | 73 | ||
70 | void flush_tlb_mm_skas(struct mm_struct *mm) | 74 | void flush_tlb_mm_skas(struct mm_struct *mm) |
71 | { | 75 | { |
76 | unsigned long end; | ||
77 | |||
72 | /* Don't bother flushing if this address space is about to be | 78 | /* Don't bother flushing if this address space is about to be |
73 | * destroyed. | 79 | * destroyed. |
74 | */ | 80 | */ |
75 | if(atomic_read(&mm->mm_users) == 0) | 81 | if(atomic_read(&mm->mm_users) == 0) |
76 | return; | 82 | return; |
77 | 83 | ||
78 | fix_range(mm, 0, host_task_size, 0); | 84 | end = proc_mm ? task_size : CONFIG_STUB_START; |
85 | fix_range(mm, 0, end, 0); | ||
79 | } | 86 | } |
80 | 87 | ||
81 | void force_flush_all_skas(void) | 88 | void force_flush_all_skas(void) |
82 | { | 89 | { |
83 | fix_range(current->mm, 0, host_task_size, 1); | 90 | unsigned long end = proc_mm ? task_size : CONFIG_STUB_START; |
91 | fix_range(current->mm, 0, end, 1); | ||
84 | } | 92 | } |