aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/skas/tlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/skas/tlb.c')
-rw-r--r--arch/um/kernel/skas/tlb.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c
index c43901aa9368..b3d722ddde31 100644
--- a/arch/um/kernel/skas/tlb.c
+++ b/arch/um/kernel/skas/tlb.c
@@ -27,9 +27,9 @@ static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last,
27 switch(op->type){ 27 switch(op->type){
28 case MMAP: 28 case MMAP:
29 ret = map(&mmu->skas.id, op->u.mmap.addr, 29 ret = map(&mmu->skas.id, op->u.mmap.addr,
30 op->u.mmap.len, op->u.mmap.r, op->u.mmap.w, 30 op->u.mmap.len, op->u.mmap.prot,
31 op->u.mmap.x, op->u.mmap.fd, 31 op->u.mmap.fd, op->u.mmap.offset, finished,
32 op->u.mmap.offset, finished, flush); 32 flush);
33 break; 33 break;
34 case MUNMAP: 34 case MUNMAP:
35 ret = unmap(&mmu->skas.id, op->u.munmap.addr, 35 ret = unmap(&mmu->skas.id, op->u.munmap.addr,
@@ -37,8 +37,7 @@ static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last,
37 break; 37 break;
38 case MPROTECT: 38 case MPROTECT:
39 ret = protect(&mmu->skas.id, op->u.mprotect.addr, 39 ret = protect(&mmu->skas.id, op->u.mprotect.addr,
40 op->u.mprotect.len, op->u.mprotect.r, 40 op->u.mprotect.len, op->u.mprotect.prot,
41 op->u.mprotect.w, op->u.mprotect.x,
42 finished, flush); 41 finished, flush);
43 break; 42 break;
44 default: 43 default:
@@ -102,10 +101,10 @@ void flush_tlb_page_skas(struct vm_area_struct *vma, unsigned long address)
102 pte_t *pte; 101 pte_t *pte;
103 struct mm_struct *mm = vma->vm_mm; 102 struct mm_struct *mm = vma->vm_mm;
104 void *flush = NULL; 103 void *flush = NULL;
105 int r, w, x, err = 0; 104 int r, w, x, prot, err = 0;
106 struct mm_id *mm_id; 105 struct mm_id *mm_id;
107 106
108 pgd = pgd_offset(vma->vm_mm, address); 107 pgd = pgd_offset(mm, address);
109 if(!pgd_present(*pgd)) 108 if(!pgd_present(*pgd))
110 goto kill; 109 goto kill;
111 110
@@ -130,19 +129,21 @@ void flush_tlb_page_skas(struct vm_area_struct *vma, unsigned long address)
130 } 129 }
131 130
132 mm_id = &mm->context.skas.id; 131 mm_id = &mm->context.skas.id;
132 prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) |
133 (x ? UM_PROT_EXEC : 0));
133 if(pte_newpage(*pte)){ 134 if(pte_newpage(*pte)){
134 if(pte_present(*pte)){ 135 if(pte_present(*pte)){
135 unsigned long long offset; 136 unsigned long long offset;
136 int fd; 137 int fd;
137 138
138 fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset); 139 fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset);
139 err = map(mm_id, address, PAGE_SIZE, r, w, x, fd, 140 err = map(mm_id, address, PAGE_SIZE, prot, fd, offset,
140 offset, 1, &flush); 141 1, &flush);
141 } 142 }
142 else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush); 143 else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush);
143 } 144 }
144 else if(pte_newprot(*pte)) 145 else if(pte_newprot(*pte))
145 err = protect(mm_id, address, PAGE_SIZE, r, w, x, 1, &flush); 146 err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush);
146 147
147 if(err) 148 if(err)
148 goto kill; 149 goto kill;