|
|
1.1 ! root 1: /* ctxsw.s - ctxsw */ ! 2: ! 3: #include <procreg.h> ! 4: ! 5: /*------------------------------------------------------------------------ ! 6: * ctxsw -- actually perform context switch, saving/loading registers ! 7: *------------------------------------------------------------------------ ! 8: * Upon entry to this routine, the current stack is assumed to be the kernel ! 9: * stack. The stack contains: ! 10: * ! 11: * AP+4 => address of save area with new registers, etc. ! 12: * Size of save area is PNREGS * sizeof (longword). ! 13: * ! 14: * Assumes interrupts are disabled. ! 15: * See proc.h for a description of the saved state (process control block). ! 16: */ ! 17: .text ! 18: .align 1 /* location counter lowest bit is 0 */ ! 19: .globl _ctxsw /* declare the routine name global */ ! 20: _ctxsw: /* entry point to context switch */ ! 21: .word 0x0 /* entry mask -- save no registers */ ! 22: movpsl -(sp) /* push psl */ ! 23: pushal ctxswend /* push address at which old process */ ! 24: /* should resume when re-started */ ! 25: svpctx /* save old process' context in proctab */ ! 26: /* The values to save for PC & PSL are */ ! 27: /* popped off the kernel stack. */ ! 28: mtpr 4(ap), $PCBB /* move address of new process' save */ ! 29: /* area to Process Control Block Base */ ! 30: ldpctx /* load new process' context, push PSL */ ! 31: /* & PC on kernel stack. */ ! 32: rei /* start executing new process */ ! 33: ctxswend: ! 34: /* the OLD process returns here when resumed. */ ! 35: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.