aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/skas/tlb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/skas/tlb.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/kernel/skas/tlb.c')
-rw-r--r--arch/um/kernel/skas/tlb.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c
new file mode 100644
index 000000000000..b8c5e71763d1
--- /dev/null
+++ b/arch/um/kernel/skas/tlb.c
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#include "linux/stddef.h"
8#include "linux/sched.h"
9#include "linux/mm.h"
10#include "asm/page.h"
11#include "asm/pgtable.h"
12#include "asm/mmu.h"
13#include "user_util.h"
14#include "mem_user.h"
15#include "mem.h"
16#include "skas.h"
17#include "os.h"
18#include "tlb.h"
19
20static void do_ops(int fd, struct host_vm_op *ops, int last)
21{
22 struct host_vm_op *op;
23 int i;
24
25 for(i = 0; i <= last; i++){
26 op = &ops[i];
27 switch(op->type){
28 case MMAP:
29 map(fd, 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.fd, op->u.mmap.offset);
32 break;
33 case MUNMAP:
34 unmap(fd, (void *) op->u.munmap.addr,
35 op->u.munmap.len);
36 break;
37 case MPROTECT:
38 protect(fd, op->u.mprotect.addr, op->u.mprotect.len,
39 op->u.mprotect.r, op->u.mprotect.w,
40 op->u.mprotect.x);
41 break;
42 default:
43 printk("Unknown op type %d in do_ops\n", op->type);
44 break;
45 }
46 }
47}
48
49static void fix_range(struct mm_struct *mm, unsigned long start_addr,
50 unsigned long end_addr, int force)
51{
52 int fd = mm->context.skas.mm_fd;
53
54 fix_range_common(mm, start_addr, end_addr, force, fd, do_ops);
55}
56
57void __flush_tlb_one_skas(unsigned long addr)
58{
59 flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE);
60}
61
62void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start,
63 unsigned long end)
64{
65 if(vma->vm_mm == NULL)
66 flush_tlb_kernel_range_common(start, end);
67 else fix_range(vma->vm_mm, start, end, 0);
68}
69
70void flush_tlb_mm_skas(struct mm_struct *mm)
71{
72 /* Don't bother flushing if this address space is about to be
73 * destroyed.
74 */
75 if(atomic_read(&mm->mm_users) == 0)
76 return;
77
78 fix_range(mm, 0, host_task_size, 0);
79 flush_tlb_kernel_range_common(start_vm, end_vm);
80}
81
82void force_flush_all_skas(void)
83{
84 fix_range(current->mm, 0, host_task_size, 1);
85}