/*
* on return from this function we will be running in virtual mode.
* We set up the Block Address Translation (BAT) registers thus:
* 1) first 3 BATs are 256M blocks, starting from KZERO->0
* 2) remaining BAT maps last 256M directly
*/
TEXT mmuinit0(SB), $0
/* reset all the tlbs */
MOVW $64, R3
MOVW R3, CTR
MOVW $0, R4
tlbloop:
TLBIE R4
SYNC
ADD $BIT(19), R4
BDNZ tlbloop
TLBSYNC
/* BATs 0 and 1 cover memory from 0x00000000 to 0x20000000 */
/* direct map last block, uncached, (not guarded, doesn't work for BAT), DBAT only */
MOVW $(INTMEM|(0x7ff<<2)|2), R3
MOVW $(INTMEM|PTEWRITE|PTEUNCACHED), R4 /* Don't set PTEVALID here */
MOVW R3, SPR(DBATU(3))
MOVW R4, SPR(DBATL(3))