CLEAN_WINDOW_HANDLER on sun4v can be optimized
The following quotation from the UltraSPARC T1 Supplement
to the UltraSPARC Architecture 2005:
12.2.3 Clean Window Handling (Impl. Dep. #102)
SPARC V9 introduced the concept of “clean window” to enhance security and integrity during program execution. A clean window is defined to be a register window that contains either all zeroes or addresses and data that belong to the current context. The CLEANWIN register records the number of available clean windows. When a SAVE instruction requests a window and there are no more clean windows, a clean_window trap is generated. Note that the behavior on a clean_window trap for UltraSPARC T1 is the same as for a SAVE instruction, namely, the local registers for the new window remain the same as the local registers from the old window, while the out registers in the new window contain the contents of the in registers from the old window. Thus, while UltraSPARC T1 generates a clean_window trap, the new window is automatically cleaned by hardware. System software only needs to increment CLEANWIN before returning to the requesting context.
Makes a case for optimization of the CLEAN_WINDOW_HANDLER_MACRO.
(The guarantee seems to be valid for the entire UA2005 architecture.)