On 07/09/2015 02:30 PM, Paolo Bonzini wrote:
On 09/07/2015 09:15, Richard Henderson wrote:
Having segs[].base as a register significantly improves code
generation for real and protected modes, particularly for TBs
that have multiple memory references where the segment base
can be held in a hard register through the TB.
On top of this, "is base 0" could be cached in HFLAGS, and CS.BASE does
not need to be in a register at all. Or, to avoid wasting too many
HFLAGS, "is DS/ES/SS base equal to CS base" since the CS base is known
and usually all four of them (unlike FS and GS) are zero.
We do have CS/DS/ES/SS base not-equal to zero in hflags -- this is
HF_ADDSEG_SHIFT. You're right about CS.BASE being known via the TB though, I
hadn't thought about that.
I'm not sure that CS=DS/ES/SS really helps much 16-bit code though; afaik
except for the smallest COMs they're always different.
r~