Is it clear whether the CurrentWindowPointer and the
WindowInvalidMask are compared for an overflow or an underflow
before or after the change in the value of CWP? From the little I
understood browsing through sparcsim.cc, it seems that CWP and WIM
are checked AFTER CWP is incremented or decremented, according to
the particular instruction SAVE or RESTORE.
An example for the single process model. If all this is correct,
then initially, if we want to take advantage of the largest number
of SAVES before we flush, we will set CWP to 2 (as ordained :-))
and WIM to 0. The first SAVE will take CWP to 1 (which is initially
fine). The second SAVE will take CWP to 0, which is when we want
the first flush to happen. Therefore, we need WIM to be initially
set to 0, right?
The evil, misleading, broken etc. etc. version of the AddrSpace
constructor sets WIM initially to 1. Is this yet another one of the
evil bugs implanted into AddrSpace to help us build character, or
do I have the workings of WIM and CWP wrong?
Thanks again.
Petros