Parse SDR1 on mtspr instead of at translate time
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 1 Apr 2011 04:15:15 +0000 (15:15 +1100)
committerAlexander Graf <agraf@suse.de>
Fri, 1 Apr 2011 16:34:55 +0000 (18:34 +0200)
commitd3c8cab503b06f1255d80510dc43ce5c108e9cc0
treec9110bfe11399a7d5d751269cd4a51299304cf55
parent8c215b491407311722b50f85522824c37e2947cf
Parse SDR1 on mtspr instead of at translate time

On ppc machines with hash table MMUs, the special purpose register SDR1
contains both the base address of the encoded size (hashed) page tables.

At present, we interpret the SDR1 value within the address translation
path.  But because the encodings of the size for 32-bit and 64-bit are
different this makes for a confusing branch on the MMU type with a bunch
of curly shifts and masks in the middle of the translate path.

This patch cleans things up by moving the interpretation on SDR1 into the
helper function handling the write to the register.  This leaves a simple
pre-sanitized base address and mask for the hash table in the CPUState
structure which is easier to work with in the translation path.

This makes the translation path more readable.  It addresses the FIXME
comment currently in the mtsdr1 helper, by validating the SDR1 value during
interpretation.  Finally it opens the way for emulating a pSeries-style
partition where the hash table used for translation is not mapped into
the guests's RAM.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
monitor.c
target-ppc/cpu.h
target-ppc/helper.c
target-ppc/kvm.c
target-ppc/machine.c
target-ppc/translate.c
target-ppc/translate_init.c