Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* tlbflush.h: TLB flushing functions |
| 2 | * |
| 3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _ASM_TLBFLUSH_H |
| 13 | #define _ASM_TLBFLUSH_H |
| 14 | |
| 15 | #include <linux/config.h> |
| 16 | #include <linux/mm.h> |
| 17 | #include <asm/processor.h> |
| 18 | |
| 19 | #ifdef CONFIG_MMU |
| 20 | |
| 21 | #ifndef __ASSEMBLY__ |
| 22 | extern void asmlinkage __flush_tlb_all(void); |
| 23 | extern void asmlinkage __flush_tlb_mm(unsigned long contextid); |
| 24 | extern void asmlinkage __flush_tlb_page(unsigned long contextid, unsigned long start); |
| 25 | extern void asmlinkage __flush_tlb_range(unsigned long contextid, |
| 26 | unsigned long start, unsigned long end); |
| 27 | #endif /* !__ASSEMBLY__ */ |
| 28 | |
| 29 | #define flush_tlb_all() \ |
| 30 | do { \ |
| 31 | preempt_disable(); \ |
| 32 | __flush_tlb_all(); \ |
| 33 | preempt_enable(); \ |
| 34 | } while(0) |
| 35 | |
| 36 | #define flush_tlb_mm(mm) \ |
| 37 | do { \ |
| 38 | preempt_disable(); \ |
| 39 | __flush_tlb_mm((mm)->context.id); \ |
| 40 | preempt_enable(); \ |
| 41 | } while(0) |
| 42 | |
| 43 | #define flush_tlb_range(vma,start,end) \ |
| 44 | do { \ |
| 45 | preempt_disable(); \ |
| 46 | __flush_tlb_range((vma)->vm_mm->context.id, start, end); \ |
| 47 | preempt_enable(); \ |
| 48 | } while(0) |
| 49 | |
| 50 | #define flush_tlb_page(vma,addr) \ |
| 51 | do { \ |
| 52 | preempt_disable(); \ |
| 53 | __flush_tlb_page((vma)->vm_mm->context.id, addr); \ |
| 54 | preempt_enable(); \ |
| 55 | } while(0) |
| 56 | |
| 57 | |
| 58 | #define __flush_tlb_global() flush_tlb_all() |
| 59 | #define flush_tlb() flush_tlb_all() |
| 60 | #define flush_tlb_kernel_range(start, end) flush_tlb_all() |
| 61 | #define flush_tlb_pgtables(mm,start,end) \ |
| 62 | asm volatile("movgs %0,scr0 ! movgs %0,scr1" :: "r"(ULONG_MAX) : "memory"); |
| 63 | |
| 64 | #else |
| 65 | |
| 66 | #define flush_tlb() BUG() |
| 67 | #define flush_tlb_all() BUG() |
| 68 | #define flush_tlb_mm(mm) BUG() |
| 69 | #define flush_tlb_page(vma,addr) BUG() |
| 70 | #define flush_tlb_range(mm,start,end) BUG() |
| 71 | #define flush_tlb_pgtables(mm,start,end) BUG() |
| 72 | #define flush_tlb_kernel_range(start, end) BUG() |
| 73 | |
| 74 | #endif |
| 75 | |
| 76 | |
| 77 | #endif /* _ASM_TLBFLUSH_H */ |