/* RegisterSaveRestore.S * Save and restore all the global registers on a SPARC. * * Peter B. Kessler, November 15, 1989 5:42:14 pm PST */ #include <sun4/asm←linkage.h> #include "leaf←linkage.h" /* Caller must allocate double word aligned block of STATESIZE. * Then you call save←regs(&block) to save * and restore←regs(&block) to restore. * To find out how much space you need is to call state←size(). * * The address of the block is passed to save←regs and restore←regs * in %o0, and the return address for save←regs and restore←regs is * in %o7. The caller must save those registers before calling save←regs * and must restore them after returning from restore←regs. * You can save those registers and allocate the space by using * the SPARC's save instruction. */ ALTENTRY(save←regs←maxi) LEAF←SAVE←LOCALS(%o0) LEAF←SAVE←OUTS(%o0) ALTENTRY(save←regs) LEAF←SAVE←FLOATS(%o0) ALTENTRY(save←regs←mini) LEAF←SAVE←INS(%o0) ALTENTRY(save←regs←globals) LEAF←SAVE←GLOBALS(%o0) ENTRY(save←regs←none) retl nop ALTENTRY(restore←regs←maxi) LEAF←RESTORE←LOCALS(%o0) LEAF←RESTORE←OUTS(%o0) ALTENTRY(restore←regs) LEAF←RESTORE←FLOATS(%o0) ALTENTRY(restore←regs←mini) LEAF←RESTORE←INS(%o0) ALTENTRY(restore←regs←globals) LEAF←RESTORE←GLOBALS(%o0) ENTRY(restore←regs←none) retl nop ENTRY(reg←state←size) GET←STATESIZE() retl nop