1 /* tlb-flush.S: TLB flushing routines
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
12 #include <linux/sys.h>
13 #include <linux/linkage.h>
15 #include <asm/ptrace.h>
16 #include <asm/spr-regs.h>
19 # sethi.p %hi(0xfeff9c00),gr4
20 # setlo %lo(0xfeff9c00),gr4
28 # sizes corresponding to TPXR.LMAX
39 ###############################################################################
42 # - void __flush_tlb_all(void)
44 ###############################################################################
45 .globl __flush_tlb_all
46 .type __flush_tlb_all,@function
50 # kill cached PGE value
51 setlos #0xffffffff,gr4
55 # kill AMPR-cached TLB values
61 # find out how many lines there are
63 sethi.p %hi(__tlb_lmax_sizes),gr4
64 srli gr5,#TPXR_LMAX_SHIFT,gr5
65 setlo.p %lo(__tlb_lmax_sizes),gr4
66 andi gr5,#TPXR_LMAX_SMASK,gr5
69 # now, we assume that the TLB line step is page size in size
70 setlos.p #PAGE_SIZE,gr5
74 subicc.p gr4,#1,gr4,icc0
81 .size __flush_tlb_all, .-__flush_tlb_all
83 ###############################################################################
85 # flush everything to do with one context
86 # - void __flush_tlb_mm(unsigned long contextid [GR8])
88 ###############################################################################
90 .type __flush_tlb_mm,@function
94 # kill cached PGE value
95 setlos #0xffffffff,gr4
99 # specify the context we want to flush
102 # find out how many lines there are
104 sethi.p %hi(__tlb_lmax_sizes),gr4
105 srli gr5,#TPXR_LMAX_SHIFT,gr5
106 setlo.p %lo(__tlb_lmax_sizes),gr4
107 andi gr5,#TPXR_LMAX_SMASK,gr5
110 # now, we assume that the TLB line step is page size in size
111 setlos.p #PAGE_SIZE,gr5
115 subicc.p gr4,#1,gr4,icc0
122 .size __flush_tlb_mm, .-__flush_tlb_mm
124 ###############################################################################
126 # flush a range of addresses from the TLB
127 # - void __flush_tlb_page(unsigned long contextid [GR8],
128 # unsigned long start [GR9])
130 ###############################################################################
131 .globl __flush_tlb_page
132 .type __flush_tlb_page,@function
134 # kill cached PGE value
135 setlos #0xffffffff,gr4
139 # specify the context we want to flush
142 # zap the matching TLB line and AMR values
143 setlos #~(PAGE_SIZE-1),gr5
149 .size __flush_tlb_page, .-__flush_tlb_page
151 ###############################################################################
153 # flush a range of addresses from the TLB
154 # - void __flush_tlb_range(unsigned long contextid [GR8],
155 # unsigned long start [GR9],
156 # unsigned long end [GR10])
158 ###############################################################################
159 .globl __flush_tlb_range
160 .type __flush_tlb_range,@function
162 # kill cached PGE value
163 setlos #0xffffffff,gr4
167 # specify the context we want to flush
170 # round the start down to beginning of TLB line and end up to beginning of next TLB line
171 setlos.p #~(PAGE_SIZE-1),gr5
172 setlos #PAGE_SIZE,gr6
178 subcc.p gr9,gr10,gr0,icc0
180 bne icc0,#0,2b ; most likely a 1-page flush
184 .size __flush_tlb_range, .-__flush_tlb_range