Commit 3fc0447a authored by Jeff Dike's avatar Jeff Dike

Fixed various build problems with the tlb.c merge.

parent f575fea5
...@@ -23,8 +23,8 @@ extern void initial_thread_cb_skas(void (*proc)(void *), void *arg); ...@@ -23,8 +23,8 @@ extern void initial_thread_cb_skas(void (*proc)(void *), void *arg);
extern void init_idle_skas(void); extern void init_idle_skas(void);
extern void flush_tlb_kernel_vm_skas(void); extern void flush_tlb_kernel_vm_skas(void);
extern void __flush_tlb_one_skas(unsigned long addr); extern void __flush_tlb_one_skas(unsigned long addr);
extern void flush_tlb_range_skas(struct mm_struct *mm, unsigned long start, extern void flush_tlb_range_skas(struct vm_area_struct *vma,
unsigned long end); unsigned long start, unsigned long end);
extern void flush_tlb_mm_skas(struct mm_struct *mm); extern void flush_tlb_mm_skas(struct mm_struct *mm);
extern void force_flush_all_skas(void); extern void force_flush_all_skas(void);
extern long execute_syscall_skas(void *r); extern long execute_syscall_skas(void *r);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "linux/stddef.h" #include "linux/stddef.h"
#include "linux/sched.h" #include "linux/sched.h"
#include "linux/mm.h"
#include "asm/page.h" #include "asm/page.h"
#include "asm/pgtable.h" #include "asm/pgtable.h"
#include "asm/mmu.h" #include "asm/mmu.h"
...@@ -28,7 +29,7 @@ static void fix_range(struct mm_struct *mm, unsigned long start_addr, ...@@ -28,7 +29,7 @@ static void fix_range(struct mm_struct *mm, unsigned long start_addr,
npgd = pgd_offset(mm, addr); npgd = pgd_offset(mm, addr);
npmd = pmd_offset(npgd, addr); npmd = pmd_offset(npgd, addr);
if(pmd_present(*npmd)){ if(pmd_present(*npmd)){
npte = pte_offset(npmd, addr); npte = pte_offset_kernel(npmd, addr);
r = pte_read(*npte); r = pte_read(*npte);
w = pte_write(*npte); w = pte_write(*npte);
x = pte_exec(*npte); x = pte_exec(*npte);
...@@ -80,7 +81,7 @@ static void flush_kernel_vm_range(unsigned long start, unsigned long end) ...@@ -80,7 +81,7 @@ static void flush_kernel_vm_range(unsigned long start, unsigned long end)
pgd = pgd_offset(mm, addr); pgd = pgd_offset(mm, addr);
pmd = pmd_offset(pgd, addr); pmd = pmd_offset(pgd, addr);
if(pmd_present(*pmd)){ if(pmd_present(*pmd)){
pte = pte_offset(pmd, addr); pte = pte_offset_kernel(pmd, addr);
if(!pte_present(*pte) || pte_newpage(*pte)){ if(!pte_present(*pte) || pte_newpage(*pte)){
updated = 1; updated = 1;
err = os_unmap_memory((void *) addr, err = os_unmap_memory((void *) addr,
...@@ -123,12 +124,12 @@ void __flush_tlb_one_skas(unsigned long addr) ...@@ -123,12 +124,12 @@ void __flush_tlb_one_skas(unsigned long addr)
flush_kernel_vm_range(addr, addr + PAGE_SIZE); flush_kernel_vm_range(addr, addr + PAGE_SIZE);
} }
void flush_tlb_range_skas(struct mm_struct *mm, unsigned long start, void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
if(mm == NULL) if(vma->vm_mm == NULL)
flush_kernel_vm_range(start, end); flush_kernel_vm_range(start, end);
else fix_range(mm, start, end, 0); else fix_range(vma->vm_mm, start, end, 0);
} }
void flush_tlb_mm_skas(struct mm_struct *mm) void flush_tlb_mm_skas(struct mm_struct *mm)
......
...@@ -6,18 +6,14 @@ ...@@ -6,18 +6,14 @@
#include "linux/mm.h" #include "linux/mm.h"
#include "asm/page.h" #include "asm/page.h"
#include "asm/pgalloc.h" #include "asm/pgalloc.h"
#include "asm/tlbflush.h"
#include "choose-mode.h" #include "choose-mode.h"
#include "mode_kern.h" #include "mode_kern.h"
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
flush_kernel_range(start, end, 1);
}
void flush_tlb_page(struct vm_area_struct *vma, unsigned long address) void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
{ {
address &= PAGE_MASK; address &= PAGE_MASK;
flush_tlb_range(vma->vm_mm, address, address + PAGE_SIZE); flush_tlb_range(vma, address, address + PAGE_SIZE);
} }
void flush_tlb_all(void) void flush_tlb_all(void)
...@@ -35,10 +31,10 @@ void __flush_tlb_one(unsigned long addr) ...@@ -35,10 +31,10 @@ void __flush_tlb_one(unsigned long addr)
CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr); CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr);
} }
void flush_tlb_range(struct mm_struct *mm, unsigned long start, void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, mm, start, CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start,
end); end);
} }
......
...@@ -24,8 +24,8 @@ extern void initial_thread_cb_tt(void (*proc)(void *), void *arg); ...@@ -24,8 +24,8 @@ extern void initial_thread_cb_tt(void (*proc)(void *), void *arg);
extern void init_idle_tt(void); extern void init_idle_tt(void);
extern void flush_tlb_kernel_vm_tt(void); extern void flush_tlb_kernel_vm_tt(void);
extern void __flush_tlb_one_tt(unsigned long addr); extern void __flush_tlb_one_tt(unsigned long addr);
extern void flush_tlb_range_tt(struct mm_struct *mm, unsigned long start, extern void flush_tlb_range_tt(struct vm_area_struct *vma,
unsigned long end); unsigned long start, unsigned long end);
extern void flush_tlb_mm_tt(struct mm_struct *mm); extern void flush_tlb_mm_tt(struct mm_struct *mm);
extern void force_flush_all_tt(void); extern void force_flush_all_tt(void);
extern long execute_syscall_tt(void *r); extern long execute_syscall_tt(void *r);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "linux/stddef.h" #include "linux/stddef.h"
#include "linux/kernel.h" #include "linux/kernel.h"
#include "linux/sched.h" #include "linux/sched.h"
#include "linux/mm.h"
#include "asm/page.h" #include "asm/page.h"
#include "asm/pgtable.h" #include "asm/pgtable.h"
#include "asm/uaccess.h" #include "asm/uaccess.h"
...@@ -130,6 +131,11 @@ void flush_kernel_range(unsigned long start, unsigned long end, int update_seq) ...@@ -130,6 +131,11 @@ void flush_kernel_range(unsigned long start, unsigned long end, int update_seq)
if(updated && update_seq) atomic_inc(&vmchange_seq); if(updated && update_seq) atomic_inc(&vmchange_seq);
} }
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
flush_kernel_range(start, end, 1);
}
static void protect_vm_page(unsigned long addr, int w, int must_succeed) static void protect_vm_page(unsigned long addr, int w, int must_succeed)
{ {
int err; int err;
...@@ -166,25 +172,25 @@ void mprotect_kernel_vm(int w) ...@@ -166,25 +172,25 @@ void mprotect_kernel_vm(int w)
void flush_tlb_kernel_vm_tt(void) void flush_tlb_kernel_vm_tt(void)
{ {
flush_tlb_kernel_vm_range(start_vm, end_vm); flush_tlb_kernel_range(start_vm, end_vm);
} }
void __flush_tlb_one_tt(unsigned long addr) void __flush_tlb_one_tt(unsigned long addr)
{ {
flush_tlb_kernel_vm_range(addr, addr + PAGE_SIZE); flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
} }
void flush_tlb_range_tt(struct mm_struct *mm, unsigned long start, void flush_tlb_range_tt(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
if(mm != current->mm) return; if(vma->vm_mm != current->mm) return;
/* Assumes that the range start ... end is entirely within /* Assumes that the range start ... end is entirely within
* either process memory or kernel vm * either process memory or kernel vm
*/ */
if((start >= start_vm) && (start < end_vm)) if((start >= start_vm) && (start < end_vm))
flush_kernel_vm_range(start, end, 1); flush_kernel_range(start, end, 1);
else fix_range(mm, start, end, 0); else fix_range(vma->vm_mm, start, end, 0);
} }
void flush_tlb_mm_tt(struct mm_struct *mm) void flush_tlb_mm_tt(struct mm_struct *mm)
...@@ -198,13 +204,13 @@ void flush_tlb_mm_tt(struct mm_struct *mm) ...@@ -198,13 +204,13 @@ void flush_tlb_mm_tt(struct mm_struct *mm)
seq = atomic_read(&vmchange_seq); seq = atomic_read(&vmchange_seq);
if(current->thread.mode.tt.vm_seq == seq) return; if(current->thread.mode.tt.vm_seq == seq) return;
current->thread.mode.tt.vm_seq = seq; current->thread.mode.tt.vm_seq = seq;
flush_kernel_vm_range(start_vm, end_vm, 0); flush_kernel_range(start_vm, end_vm, 0);
} }
void force_flush_all_tt(void) void force_flush_all_tt(void)
{ {
fix_range(current->mm, 0, STACK_TOP, 1); fix_range(current->mm, 0, STACK_TOP, 1);
flush_kernel_vm_range(start_vm, end_vm, 0); flush_kernel_range(start_vm, end_vm, 0);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment