Rev 945 | Rev 993 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 945 | Rev 947 | ||
---|---|---|---|
Line 92... | Line 92... | ||
92 | /* TODO */ |
92 | /* TODO */ |
93 | tlb_invalidate_all(); |
93 | tlb_invalidate_all(); |
94 | } |
94 | } |
95 | 95 | ||
96 | 96 | ||
97 | void tlb_invalidate_pages(asid_t asid, __address va, count_t cnt) |
97 | void tlb_invalidate_pages(asid_t asid, __address page, count_t cnt) |
98 | { |
98 | { |
99 | 99 | ||
100 | 100 | ||
101 | region_register rr; |
101 | region_register rr; |
102 | bool restore_rr = false; |
102 | bool restore_rr = false; |
103 | int b=0; |
103 | int b=0; |
104 | int c=cnt; |
104 | int c=cnt; |
- | 105 | ||
- | 106 | __address va; |
|
105 | int i; |
107 | va=page; |
106 | 108 | ||
107 | rr.word = rr_read(VA2VRN(va)); |
109 | rr.word = rr_read(VA2VRN(va)); |
108 | if ((restore_rr = (rr.map.rid != ASID2RID(asid, VA2VRN(va))))) { |
110 | if ((restore_rr = (rr.map.rid != ASID2RID(asid, VA2VRN(va))))) { |
109 | /* |
111 | /* |
110 | * The selected region register does not contain required RID. |
112 | * The selected region register does not contain required RID. |
Line 130... | Line 132... | ||
130 | ps=PAGE_WIDTH; |
132 | ps=PAGE_WIDTH; |
131 | break; |
133 | break; |
132 | } |
134 | } |
133 | case 1: /*cnt 4-15*/ |
135 | case 1: /*cnt 4-15*/ |
134 | { |
136 | { |
135 | cnt=(cnt/4)+1; |
137 | /*cnt=((cnt-1)/4)+1;*/ |
136 | ps=PAGE_WIDTH+2; |
138 | ps=PAGE_WIDTH+2; |
137 | va&=~((1<<ps)-1); |
139 | va&=~((1<<ps)-1); |
138 | break; |
140 | break; |
139 | } |
141 | } |
140 | case 2: /*cnt 16-63*/ |
142 | case 2: /*cnt 16-63*/ |
141 | { |
143 | { |
142 | cnt=(cnt/16)+1; |
144 | /*cnt=((cnt-1)/16)+1;*/ |
143 | ps=PAGE_WIDTH+4; |
145 | ps=PAGE_WIDTH+4; |
144 | va&=~((1<<ps)-1); |
146 | va&=~((1<<ps)-1); |
145 | break; |
147 | break; |
146 | } |
148 | } |
147 | case 3: /*cnt 64-255*/ |
149 | case 3: /*cnt 64-255*/ |
148 | { |
150 | { |
149 | cnt=(cnt/64)+1; |
151 | /*cnt=((cnt-1)/64)+1;*/ |
150 | ps=PAGE_WIDTH+6; |
152 | ps=PAGE_WIDTH+6; |
151 | va&=~((1<<ps)-1); |
153 | va&=~((1<<ps)-1); |
152 | break; |
154 | break; |
153 | } |
155 | } |
154 | case 4: /*cnt 256-1023*/ |
156 | case 4: /*cnt 256-1023*/ |
155 | { |
157 | { |
156 | cnt=(cnt/256)+1; |
158 | /*cnt=((cnt-1)/256)+1;*/ |
157 | ps=PAGE_WIDTH+8; |
159 | ps=PAGE_WIDTH+8; |
158 | va&=~((1<<ps)-1); |
160 | va&=~((1<<ps)-1); |
159 | break; |
161 | break; |
160 | } |
162 | } |
161 | case 5: /*cnt 1024-4095*/ |
163 | case 5: /*cnt 1024-4095*/ |
162 | { |
164 | { |
163 | cnt=(cnt/1024)+1; |
165 | /*cnt=((cnt-1)/1024)+1;*/ |
164 | ps=PAGE_WIDTH+10; |
166 | ps=PAGE_WIDTH+10; |
165 | va&=~((1<<ps)-1); |
167 | va&=~((1<<ps)-1); |
166 | break; |
168 | break; |
167 | } |
169 | } |
168 | case 6: /*cnt 4096-16383*/ |
170 | case 6: /*cnt 4096-16383*/ |
169 | { |
171 | { |
170 | cnt=(cnt/4096)+1; |
172 | /*cnt=((cnt-1)/4096)+1;*/ |
171 | ps=PAGE_WIDTH+12; |
173 | ps=PAGE_WIDTH+12; |
172 | va&=~((1<<ps)-1); |
174 | va&=~((1<<ps)-1); |
173 | break; |
175 | break; |
174 | } |
176 | } |
175 | case 7: /*cnt 16384-65535*/ |
177 | case 7: /*cnt 16384-65535*/ |
176 | case 8: /*cnt 65536-(256K-1)*/ |
178 | case 8: /*cnt 65536-(256K-1)*/ |
177 | { |
179 | { |
178 | cnt=(cnt/16384)+1; |
180 | /*cnt=((cnt-1)/16384)+1;*/ |
179 | ps=PAGE_WIDTH+14; |
181 | ps=PAGE_WIDTH+14; |
180 | va&=~((1<<ps)-1); |
182 | va&=~((1<<ps)-1); |
181 | break; |
183 | break; |
182 | } |
184 | } |
183 | default: |
185 | default: |
184 | { |
186 | { |
185 | cnt=(cnt/(16384*16))+1; |
187 | /*cnt=((cnt-1)/(16384*16))+1;*/ |
186 | ps=PAGE_WIDTH+18; |
188 | ps=PAGE_WIDTH+18; |
187 | va&=~((1<<ps)-1); |
189 | va&=~((1<<ps)-1); |
188 | break; |
190 | break; |
189 | } |
191 | } |
190 | - | ||
191 | } |
192 | } |
192 | for(i=0;i<cnt;i++) { |
193 | /*cnt+=(page!=va);*/ |
- | 194 | for(;va<(page+cnt*(PAGE_SIZE));va+=(1<<ps)) { |
|
193 | __asm__ volatile |
195 | __asm__ volatile |
194 | ( |
196 | ( |
195 | "ptc.l %0,%1;;" |
197 | "ptc.l %0,%1;;" |
196 | : |
198 | : |
197 | : "r"(va), "r"(ps<<2) |
199 | : "r"(va), "r"(ps<<2) |
198 | ); |
200 | ); |
199 | va+=(1<<ps); |
- | |
200 | } |
201 | } |
201 | srlz_d(); |
202 | srlz_d(); |
202 | srlz_i(); |
203 | srlz_i(); |
203 | 204 | ||
204 | 205 |