- 0B4157A311317D55241B7A9700E16B0952CC540285D4922EC2D6626C29C3A9C83DE29D18068D9BE2A721B801CDED2D930A4CDECF4991C5C2EAB707E5E987BDE6
+ 931B5FD9AC59730BBCB95E9A9D3DBA41483BBE6B3FC204AD8194397191795BACF3EF76DF5335F8F17B3479A007DE3A808DF640FCA949A7802B183BC25E7FE0C3
m/mipsinst/m_instrs.asm
(92 . 6)(92 . 25)
288 _m_tlbwr:
289 ; no fields
290 mov ecx, Sr(CP0_Wired) ; ecx := CP0_Wired
291 %ifdef TLBWR_CHEAT ; 'Cheat' behaviour (see knobs.asm for rationale) :
292 mov AUX, ecx ; save this index in AUX, we will use
293 mov edx, TLB_ENTRIES_COUNT - 1 ; index of last entry
294 ; Move all TLB entries after the Wired entries down by one slot:
295 .tlbwr_slide: ; Start by replacing the last entry with the next-to-last:
296 cmp edx, AUX ; time to stop?
297 je .tlbr_slide_done ; ... then stop.
298 mov ecx, edx ; ecx := edx
299 dec ecx ; ecx := ecx - 1 (prev. TLB index)
300 mov eax, TLB_E(ecx) ; eax := current TLB entry
301 mov TLB_E(edx), eax ; move the current into the next
302 mov eax, TLB_PFN_E(ecx) ; eax := current PFN_EVEN entry
303 mov TLB_PFN_E(edx), eax ; move the current into the next
304 mov eax, TLB_PFN_O(ecx) ; eax := current PFN_ODD entry
305 mov TLB_PFN_O(edx), eax ; move the current into the next
306 dec edx ; move back by one
307 jmp .tlbwr_slide ; Continue the slide.
308 .tlbr_slide_done: ; Now we freed up the top-most non-wired slot in TLB table:
309 %else ; 'Traditional' behaviour per the MIPS Standard:
310 mov ebx, TLB_ENTRIES_COUNT ; ebx := #tlbentries
311 sub ebx, ecx ; ebx := #tlbentries - Wired
312 mov edx, 0 ; edx (upper half of dividend) := 0
(99 . 7)(118 . 8)
314 div ebx ; edx:eax / ebx
315 add edx, ecx ; edx (remainder) := edx + wired
316 mov AUX, edx ; make edx the index for tlb write
317 call _write_tlb_entry ; Write the indexed TLB entry.
318 %endif
319 call _write_tlb_entry ; Write the AUX-indexed TLB entry.
320 jmp _end_cycle
321 ;-----------------------------------------------------------------------------
322
(446 . 7)(466 . 12)
324 test ecx, ecx ; Sel != 0 ?
325 jnz _mtc0_unknown ; ... then unknown; else:
326 and ebx, ~0x1F00 ; T := T & ~0x1F00
327 mov Sr(CP0_EntryHi), ebx ; CP0_EntryHi := T
328 cmp ebx, Sr(CP0_EntryHi) ; Find whether changing CP0_EntryHi
329 je .Not_Changed_EntryHi ; ... if not, skip;
330 .Changed_EntryHi: ; If we are changing CP0_EntryHi:
331 Invalidate_TLB_Cache ; Invalidate both R and W TLB Caches
332 mov Sr(CP0_EntryHi), ebx ; CP0_EntryHi := ebx
333 .Not_Changed_EntryHi:
334 jmp _end_cycle ; Done
335 ;-----------------------------------------------------------------------------
336 _mtc0_r11: ; 0x0b