Upon instruction fetch fault: Hardware does save, regardless of WIM. pc -> %l1, npc -> %l2 code in trap page: psr -> %l0 at inst_mem_fault: ensure from user %l1 -> cpu_mmu_addr // fault address cpudibp -> %l5 // begin SWITCH_TO_KERNEL globals -> DIB[0:31] %l0 -> %g1 i's -> DIB[32:63] Put away PSR, PC, NPC in DIB %l5 -> %g7 // locates DIB Save other windows: elaboration Code in PUTAWAY_WINDOWS stores windows in DIB starting at DIB_BACKSET + 16*64 and working towards smaller addresses in DIB. (There is room in DIB for 32 windows!) It stores only as many windows as necessary according to WIM upon trap. It stores most recent windows first. kernCtx -> MMU Context Register Empty Kernel Stack Pointer -> %o6 (= %sp) // at this point we have n-1 unsaved windows! 0 -> %fp (=%i6) // gaurd against underflow(?) does nonsensical stuff to psr !!! // end SWITCH_TO_KERNEL KERNEL_CYCLES arghh! In general: PUTAWAY_WINDOWS is used in SAVE_REGS, and the currently disabled assembler versions of gate logic. SAVE_REGS is used in SWITCH_TO_KERNEL, level4_dom:, level10_dom: & dom_trap:. SWITCH_TO_KERNEL is used in win_oflo: (sometimes??), win_uflo: (sometimes??), inst_mem_fault:, data_mem_fault:, window_flush: (sometimes??), fp_disabled_trap:, fp_exception. RESTORE_REGS is perhaps the general way of retrieving user register values from DIB. ----------- RESTORE_WINDOW loads l's & i's