2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
7 #include "linux/stddef.h"
8 #include "linux/sched.h"
11 #include "asm/pgtable.h"
13 #include "user_util.h"
20 static void do_ops(int fd
, struct host_vm_op
*ops
, int last
)
22 struct host_vm_op
*op
;
25 for(i
= 0; i
<= last
; i
++){
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
);
34 unmap(fd
, (void *) op
->u
.munmap
.addr
,
38 protect(fd
, op
->u
.mprotect
.addr
, op
->u
.mprotect
.len
,
39 op
->u
.mprotect
.r
, op
->u
.mprotect
.w
,
43 printk("Unknown op type %d in do_ops\n", op
->type
);
49 static void fix_range(struct mm_struct
*mm
, unsigned long start_addr
,
50 unsigned long end_addr
, int force
)
52 int fd
= mm
->context
.skas
.mm_fd
;
54 fix_range_common(mm
, start_addr
, end_addr
, force
, fd
, do_ops
);
57 void __flush_tlb_one_skas(unsigned long addr
)
59 flush_tlb_kernel_range_common(addr
, addr
+ PAGE_SIZE
);
62 void flush_tlb_range_skas(struct vm_area_struct
*vma
, unsigned long start
,
65 if(vma
->vm_mm
== NULL
)
66 flush_tlb_kernel_range_common(start
, end
);
67 else fix_range(vma
->vm_mm
, start
, end
, 0);
70 void flush_tlb_mm_skas(struct mm_struct
*mm
)
72 /* Don't bother flushing if this address space is about to be
75 if(atomic_read(&mm
->mm_users
) == 0)
78 fix_range(mm
, 0, host_task_size
, 0);
79 flush_tlb_kernel_range_common(start_vm
, end_vm
);
82 void force_flush_all_skas(void)
84 fix_range(current
->mm
, 0, host_task_size
, 1);