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/config.h>
14 #include <linux/linkage.h>
16 #include <asm/ptrace.h>
17 #include <asm/spr-regs.h>
20 # sethi.p %hi(0xfeff9c00),gr4
21 # setlo %lo(0xfeff9c00),gr4
29 # sizes corresponding to TPXR.LMAX
40 ###############################################################################
43 # - void __flush_tlb_all(void)
45 ###############################################################################
46 .globl __flush_tlb_all
47 .type __flush_tlb_all,@function
51 # kill cached PGE value
52 setlos #0xffffffff,gr4
56 # kill AMPR-cached TLB values
62 # find out how many lines there are
64 sethi.p %hi(__tlb_lmax_sizes),gr4
65 srli gr5,#TPXR_LMAX_SHIFT,gr5
66 setlo.p %lo(__tlb_lmax_sizes),gr4
67 andi gr5,#TPXR_LMAX_SMASK,gr5
70 # now, we assume that the TLB line step is page size in size
71 setlos.p #PAGE_SIZE,gr5
75 subicc.p gr4,#1,gr4,icc0
82 .size __flush_tlb_all, .-__flush_tlb_all
84 ###############################################################################
86 # flush everything to do with one context
87 # - void __flush_tlb_mm(unsigned long contextid [GR8])
89 ###############################################################################
91 .type __flush_tlb_mm,@function
95 # kill cached PGE value
96 setlos #0xffffffff,gr4
100 # specify the context we want to flush
103 # find out how many lines there are
105 sethi.p %hi(__tlb_lmax_sizes),gr4
106 srli gr5,#TPXR_LMAX_SHIFT,gr5
107 setlo.p %lo(__tlb_lmax_sizes),gr4
108 andi gr5,#TPXR_LMAX_SMASK,gr5
111 # now, we assume that the TLB line step is page size in size
112 setlos.p #PAGE_SIZE,gr5
116 subicc.p gr4,#1,gr4,icc0
123 .size __flush_tlb_mm, .-__flush_tlb_mm
125 ###############################################################################
127 # flush a range of addresses from the TLB
128 # - void __flush_tlb_page(unsigned long contextid [GR8],
129 # unsigned long start [GR9])
131 ###############################################################################
132 .globl __flush_tlb_page
133 .type __flush_tlb_page,@function
135 # kill cached PGE value
136 setlos #0xffffffff,gr4
140 # specify the context we want to flush
143 # zap the matching TLB line and AMR values
144 setlos #~(PAGE_SIZE-1),gr5
150 .size __flush_tlb_page, .-__flush_tlb_page
152 ###############################################################################
154 # flush a range of addresses from the TLB
155 # - void __flush_tlb_range(unsigned long contextid [GR8],
156 # unsigned long start [GR9],
157 # unsigned long end [GR10])
159 ###############################################################################
160 .globl __flush_tlb_range
161 .type __flush_tlb_range,@function
163 # kill cached PGE value
164 setlos #0xffffffff,gr4
168 # specify the context we want to flush
171 # round the start down to beginning of TLB line and end up to beginning of next TLB line
172 setlos.p #~(PAGE_SIZE-1),gr5
173 setlos #PAGE_SIZE,gr6
179 subcc.p gr9,gr10,gr0,icc0
181 bne icc0,#0,2b ; most likely a 1-page flush
185 .size __flush_tlb_range, .-__flush_tlb_range