Notes on Sparc V8 window logic. I hate register windows. I shall take the RESTORE_REGS code in locore.s as the definition of the meaning of the register store in the DIB. First I think that we must modify this code to clean windows of registers values that this domain did not produce. There are two ways to do this; Erase them at this point Set WIM to keep noise registers from being read. The first is rather easy. The second might be more efficient because the register cleaning can be deferred and perhaps avoided. Trapping to clean windows is, however, more complex and has more overhead for we must define new state in the DIB indicating that window overflows are to provoke the cleaning of a window and liberalization of the wim. A count in the DIB might indicate how many dirty (and wim protected windows) there were to be cleaned before overflow-to-stack was to resume its normal role. I hope the V8 Sparc goes away before we need this. Here is what RESTORE_REGS does. It leaves the machine so that only are needed. None of the window values at entry are used. It assumes that we are perhaps running in the invalid (reserved) window. Traps are disabled. (Watchdog mode) It discards the wim, setting it to 0. (If the kernel stack isn't empty now we have worse problems.) It presumes %g7 locates the DIB (looks plausible). The first "backwindow" that it loads is from backset[backdiboldest in DIB]. 64*(backalloc in DIB) in %g6 "backset" is declared as an array of 32 windows (type = "backwindow") in the DIB. j = backdiboldest; do {(Registers L & I) <- backset[j++ mod 32]; save (--CWP);} until j == backalloc Register wim is set to mark the window that was current as we entered this code, as invalid. That is also the window just one beyond where we loaded the oldest window value. The window restoration proceeded from that window -1. ------- When prepdom prepares a domain it is flexible about how many nodes there are for register window states. It sets "backmax" in the dib according to how many nodes there are in the domain. No one looks at backmax, however. --------- Bugs to fix: next_statenode must verify sometimes that key 0 is also a data key. Clean windows somehow. ------ It looks to me like the program counter values upon window overflow are completely lost if the window save is thwarted by missing page. It is OK. SWITCH_TO_KERNEL does it!