WIP: Improve MMU emulation documentation.

This commit is contained in:
Maxim Poliakovski 2021-08-03 16:03:03 +02:00
parent c5f45c6f9a
commit e3a4539b02
2 changed files with 35 additions and 0 deletions

23
zdocs/cpu/powerpc/mmu.md Normal file
View File

@ -0,0 +1,23 @@
## Disabling BAT translation
BAT translation can be disabled by invalidating BAT registers. This is somewhat CPU specific.
MPC601 implements its own format for BAT registers that differs from the PowerPC specification.
MPC601-specific lower BAT registers has the "V" bit. If it's cleared, the corresponding BAT pair
is invalid and won't be used for address translation. To invalidate BATs on MPC601, it's enough
to write NULL to lower BAT registers. That's exactly what PowerMac 6100 ROM does:
```
li r0, 0
mtspr ibat0l, r0
mtspr ibat1l, r0
mtspr ibat2l, r0
```
PowerPC CPUs starting with 603 uses the BAT register format described in the PowerPC specification.
The upper BAT registers contain two bits: Vs (supervisor state valid bit) and Vp (problem/user state valid bit).
PowerPC Architecture First Edition from 1993 gives the following code:
```BAT_entry_valid = (Vs & ~MSR_PR) | (Vp & MSR_PR)```
If neither Vs nor Vp is set, the corresponding BAT pair isn't valid and doesn't participate in address translation.
To invalidate BATs on non-601, it's sufficient to set the upper BAT register to 0x00000000.

View File

@ -0,0 +1,12 @@
# PowerPC Memory Management Unit Emulation
Emulation of a [memory management unit](https://en.wikipedia.org/wiki/Memory_management_unit)
(MMU) in a full system emulator is considered a hard task. The biggest challenge is to do it fast.
In this article, I'm going to describe a solution for a reasonably fast emulation
of the PowerPC MMU.
This article is based on ideas presented in the paper "Optimizing Memory Emulation
in Full System Emulators" by Xin Tong and Motohiro Kawahito (IBM Research Laboratory).
## PowerPC MMU operation